Oolite
Loading...
Searching...
No Matches
OOShipGroup(Private) Category Reference

Instance Methods

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

Detailed Description

Definition at line 60 of file OOShipGroup.m.

Method Documentation

◆ cleanUp

- (void) cleanUp

Extends class OOShipGroup.

Definition at line 344 of file OOShipGroup.m.

345{
346 NSUInteger newCapacity = _capacity;
347
348 if (_count >= kMaxFreeSpace) {
349 if (_capacity > _count + kMaxFreeSpace) {
350 newCapacity = _count + 1; // +1 keeps us at powers of two + multiples of kMaxFreespace.
351 }
352 } else {
353 if (_capacity > _count * 2) {
354 newCapacity = OORoundUpToPowerOf2_NS(_count);
355 if (newCapacity < kMinSize)
356 newCapacity = kMinSize;
357 }
358 }
359
360 if (newCapacity != _capacity)
361 [self resizeTo:newCapacity];
362}
@ kMaxFreeSpace
Definition OOShipGroup.m:42
@ kMinSize
Definition OOShipGroup.m:41

References cleanUp, kMaxFreeSpace, kMinSize, and OOShipGroup::resizeTo:.

Referenced by cleanUp, OOShipGroup::countByEnumeratingWithState:objects:count:, OOShipGroup::removeShip:, and OOShipGroup::ShipGroupIterate.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resizeTo:

- (BOOL) resizeTo: (NSUInteger) newCapacity

Extends class OOShipGroup.

Definition at line 328 of file OOShipGroup.m.

328 :(NSUInteger)newCapacity
329{
330 OOWeakReference** temp = NULL;
331
332 if (newCapacity < _count)
333 return NO;
334
335 temp = realloc(_members, newCapacity * sizeof *_members);
336 if (temp == NULL)
337 return NO;
338
339 _members = temp;
340 _capacity = newCapacity;
341 return YES;
342}

Referenced by cleanUp.

Here is the caller graph for this function:

◆ updateCount

- (NSUInteger) updateCount

Extends class OOShipGroup.

Definition at line 364 of file OOShipGroup.m.

365{
366 return _updateCount;
367}

References updateCount.

Referenced by OOShipGroupEnumerator::initWithShipGroup:, and updateCount.

Here is the call graph for this function:
Here is the caller graph for this function:

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