Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OOShipGroup(Private) Category Reference

Instance Methods

(BOOL) - resizeTo:
 
(void) - cleanUp
 
(NSUInteger) - updateCount
 

Detailed Description

Definition at line 65 of file OOShipGroup.m.

Method Documentation

◆ cleanUp

- (void) cleanUp

Extends class OOShipGroup.

Definition at line 54 of file OOShipGroup.m.

444{
445 NSUInteger newCapacity = _capacity;
446
447 if (_count >= kMaxFreeSpace)
448 {
449 if (_capacity > _count + kMaxFreeSpace)
450 {
451 newCapacity = _count + 1; // +1 keeps us at powers of two + multiples of kMaxFreespace.
452 }
453 }
454 else
455 {
456 if (_capacity > _count * 2)
457 {
458 newCapacity = OORoundUpToPowerOf2_NS(_count);
459 if (newCapacity < kMinSize) newCapacity = kMinSize;
460 }
461 }
462
463 if (newCapacity != _capacity) [self resizeTo:newCapacity];
464}
@ kMaxFreeSpace
Definition OOShipGroup.m:44
@ kMinSize
Definition OOShipGroup.m:43

Referenced by OOShipGroup::countByEnumeratingWithState:objects:count:.

+ Here is the caller graph for this function:

◆ resizeTo:

- (BOOL) resizeTo: (NSUInteger) newCapacity

Extends class OOShipGroup.

Definition at line 54 of file OOShipGroup.m.

428 :(NSUInteger)newCapacity
429{
430 OOWeakReference **temp = NULL;
431
432 if (newCapacity < _count) return NO;
433
434 temp = realloc(_members, newCapacity * sizeof *_members);
435 if (temp == NULL) return NO;
436
437 _members = temp;
438 _capacity = newCapacity;
439 return YES;
440}

◆ updateCount

- (NSUInteger) updateCount

Extends class OOShipGroup.

Definition at line 54 of file OOShipGroup.m.

468{
469 return _updateCount;
470}

The documentation for this category was generated from the following file: