CPObjectCPIndexSet
@implementation CPIndexSet : CPObject
Instances of this class are collections of numbers. Each integer can appear in a collection only once.
Method Summary | |
---|---|
+(id) | indexSet Returns a new empty index set. |
+(id) | indexSetWithIndex:(int)anIndex Returns a new index set with just one index. |
+(id) | indexSetWithIndexesInRange:(CPRange)aRange Returns a new index set with all the numbers in the specified range. |
-(id) | init Initializes the receiver. |
-(id) | initWithCoder:(CPCoder)aCoder Initializes the index set from a coder. |
-(id) | initWithIndex:(int)anIndex Initializes the index set with a single index. |
-(id) | initWithIndexSet:(CPIndexSet)anIndexSet Initializes the index set with another index set. |
-(id) | initWithIndexesInRange:(CPRange)aRange Initializes the index set with numbers from the specified range. |
-(void) | addIndex:(unsigned)anIndex Adds an index to the set. |
-(void) | addIndexes:(CPIndexSet)anIndexSet Adds indices to the set. |
-(void) | addIndexesInRange:(CPRange)aRange Adds the range of indices to the set. |
-(BOOL) | containsIndex:(unsigned)anIndex Returns YES if the index set contains the specified index. |
-(BOOL) | containsIndexes:(CPIndexSet)anIndexSet Returns YES if the receving index set contains all the indices in the argument. |
-(BOOL) | containsIndexesInRange:(CPRange)aRange Returns YES if the index set contains all the numbers in the specified range. |
-(id) | copy Creates a deep copy of the index set. |
-(int) | count The number of indices in the set. |
-(CPString) | description Returns a human readable string describing the receiver. |
-(void) | encodeWithCoder:(CPCoder)aCoder Writes out the index set to the specified coder. |
-(int) | firstIndex Return the first index in the set. |
-(unsigned) | getIndexes:(CPArray)anArray maxCount:(unsigned)aMaxCount inIndexRange:(CPRange)aRangePointer Fills up the specified array with numbers from the index set within the specified range. |
-(unsigned) | indexGreaterThanIndex:(unsigned)anIndex Returns the first index value in the receiver which is greater than anIndex . |
-(unsigned int) | indexGreaterThanOrEqualToIndex:(unsigned)anIndex Returns the first index value in the receiver which is greater than or equal to anIndex . |
-(unsigned) | indexLessThanIndex:(unsigned)anIndex Returns the first index value in the receiver which is less than anIndex . |
-(unsigned int) | indexLessThanOrEqualToIndex:(unsigned)anIndex Returns the first index value in the receiver which is less than or equal to anIndex . |
-(BOOL) | intersectsIndexesInRange:(CPRange)aRange Checks if the receiver contains at least one number in aRange . |
-(BOOL) | isEqualToIndexSet:(CPIndexSet)anIndexSet Compares the receiver with the provided index set. |
-(int) | lastIndex Returns the last index in the set. |
-(id) | mutableCopy Creates a deep copy of the index set. |
-(void) | removeAllIndexes Removes all indices from the set. |
-(void) | removeIndex:(unsigned int)anIndex Removes an index from the set. |
-(void) | removeIndexes:(CPIndexSet)anIndexSet Removes the indices from the receiving set. |
-(void) | removeIndexesInRange:(CPRange)aRange Removes the indices in the range from the set. |
-(void) | shiftIndexesStartingAtIndex:(unsigned)anIndex by:(int)aDelta Shifts the values of indices left or right by a specified amount. |
Method Detail |
---|
+(id)indexSet
+(id)indexSetWithIndex:(int)anIndex
anIndex
+(id)indexSetWithIndexesInRange:(CPRange)aRange
aRange
- the range of numbers to add to the index set.-(id)init
-(id)initWithCoder:(CPCoder)aCoder
aCoder
- the coder from which to read the
index set data-(id)initWithIndex:(int)anIndex
anIndex
-(id)initWithIndexSet:(CPIndexSet)anIndexSet
anIndexSet
- the index set from which to read the initial index set-(id)initWithIndexesInRange:(CPRange)aRange
aRange
- the range of numbers to add to the index set-(void)addIndex:(unsigned)anIndex
anIndex
- the index to add-(void)addIndexes:(CPIndexSet)anIndexSet
anIndexSet
- a set of indices to add to the receiver-(void)addIndexesInRange:(CPRange)aRange
aRange
- the range of numbers to add as indices to the set-(BOOL)containsIndex:(unsigned)anIndex
YES
if the index set contains the specified index.anIndex
- the index to check for in the setYES
if anIndex
is in the receiver index set
-(BOOL)containsIndexes:(CPIndexSet)anIndexSet
YES
if the receving index set contains all the indices in the argument.anIndexSet
- the set of indices to check for in the receiving index set-(BOOL)containsIndexesInRange:(CPRange)aRange
YES
if the index set contains all the numbers in the specified range.aRange
- the range of numbers to check for in the index set-(id)copy
-(int)count
-(CPString)description
-(void)encodeWithCoder:(CPCoder)aCoder
aCoder
- the coder to which the index set will
be written-(int)firstIndex
-(unsigned)getIndexes:(CPArray)anArray maxCount:(unsigned)aMaxCount inIndexRange:(CPRange)aRangePointer
aMaxCount
number have been added or the range maximum is reached.anArray
- the array to fill upaMaxCount
- the maximum number of numbers to addsaRangePointer
- the range of indices to add-(unsigned)indexGreaterThanIndex:(unsigned)anIndex
anIndex
.anIndex
CPNotFound
if no match was found
-(unsigned int)indexGreaterThanOrEqualToIndex:(unsigned)anIndex
anIndex
.anIndex
CPNotFound
if no match was found
-(unsigned)indexLessThanIndex:(unsigned)anIndex
anIndex
.anIndex
CPNotFound
if no match was found
-(unsigned int)indexLessThanOrEqualToIndex:(unsigned)anIndex
anIndex
.anIndex
CPNotFound
if no match was found
-(BOOL)intersectsIndexesInRange:(CPRange)aRange
aRange
.aRange
- the range of numbers to check.YES
if the receiving index set contains at least one number in the provided range
-(BOOL)isEqualToIndexSet:(CPIndexSet)anIndexSet
anIndexSet
- the index set to compare toYES
if the receiver and the index set are functionally equivalent
-(int)lastIndex
-(id)mutableCopy
-(void)removeAllIndexes
-(void)removeIndex:(unsigned int)anIndex
anIndex
- the index to remove-(void)removeIndexes:(CPIndexSet)anIndexSet
anIndexSet
- the set of indices to remove
from the receiver-(void)removeIndexesInRange:(CPRange)aRange
aRange
- the range of indices to remove-(void)shiftIndexesStartingAtIndex:(unsigned)anIndex by:(int)aDelta
anIndex
- the index to start the shifting operation from (inclusive)aDelta
- the amount and direction to shift. A positive value shifts to
the right. A negative value shifts to the left.Created on Sat Sep 13 14:15:43 PDT 2008