CPObjectCPSortDescriptor
@implementation CPSortDescriptor : CPObject
A CPSortDescriptor
holds the attributes necessary to describe how
to sort a set of objects. The sort descriptor instance holds a property key path
to the sort item of the objects to compare, the method selector to call for sorting and the sort order.
Method Summary | |
---|---|
-(id) | initWithKey:(CPString)aKey ascending:(BOOL)isAscending Initializes the sort descriptor. |
-(id) | initWithKey:(CPString)aKey ascending:(BOOL)isAscending selector:(SEL)aSelector Initializes the sort descriptor. |
-(BOOL) | ascending Returns YES if the sort descriptor's order is ascending. |
-(CPComparisonResult) | compareObject:(id)lhsObject withObject:(id)rhsObject Compares two objects. |
-(CPString) | key Returns the descriptor's property key. |
-(id) | reversedSortDescriptor Makes a copy of this sort descriptor with a reversed sort order. |
-(SEL) | selector Returns the selector of the method to call when comparing objects. |
Method Detail |
---|
-(id)initWithKey:(CPString)aKey ascending:(BOOL)isAscending
aKey
- the property key path to sortisAscending
- the sort order-(id)initWithKey:(CPString)aKey ascending:(BOOL)isAscending selector:(SEL)aSelector
aKey
- the property key path to sortisAscending
- the sort orderaSelector
- this method gets called to compare objects. The method will take one argument
(the object to compare against itself, and must return a CPComparisonResult
.-(BOOL)ascending
YES
if the sort descriptor's order is ascending.-(CPComparisonResult)compareObject:(id)lhsObject withObject:(id)rhsObject
lhsObject
- the left hand side object to comprerhsObject
- the right hand side object to compare-(CPString)key
-(id)reversedSortDescriptor
-(SEL)selector
Created on Sat Sep 13 14:15:43 PDT 2008