mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Implement filteredOrderedSetUserPredicate
This commit is contained in:
parent
e97ecd6e03
commit
bb6f7ceed8
1 changed files with 17 additions and 5 deletions
|
@ -692,13 +692,13 @@ static SEL rlSel;
|
||||||
return [self objectAtIndex: 0];
|
return [self objectAtIndex: 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) objectAtIndex: (NSUInteger)index
|
- (id) objectAtIndex: (NSUInteger)index // required override...
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) objectAtIndexedSubscript: (NSUInteger)index
|
- (id) objectAtIndexedSubscript: (NSUInteger)index // required override...
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -1018,7 +1018,7 @@ static SEL rlSel;
|
||||||
- removeObserver:forKeyPath:
|
- removeObserver:forKeyPath:
|
||||||
- removeObserver:forKeyPath:context:
|
- removeObserver:forKeyPath:context:
|
||||||
*/
|
*/
|
||||||
- (NSUInteger)_countForObject: (id)object
|
- (NSUInteger)_countForObject: (id)object // required override...
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1143,7 +1143,7 @@ static SEL rlSel;
|
||||||
|
|
||||||
- (NSArray *)
|
- (NSArray *)
|
||||||
sortedArrayWithOptions: (NSSortOptions)options
|
sortedArrayWithOptions: (NSSortOptions)options
|
||||||
usingComparator: (NSComparator)comparator
|
usingComparator: (NSComparator)comparator
|
||||||
{
|
{
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
@ -1151,7 +1151,19 @@ static SEL rlSel;
|
||||||
// Filtering Ordered Sets
|
// Filtering Ordered Sets
|
||||||
- (NSOrderedSet *)filteredOrderedSetUsingPredicate: (NSPredicate *)predicate
|
- (NSOrderedSet *)filteredOrderedSetUsingPredicate: (NSPredicate *)predicate
|
||||||
{
|
{
|
||||||
return nil;
|
NSMutableOrderedSet *result = nil;
|
||||||
|
NSEnumerator *e = [self objectEnumerator];
|
||||||
|
id object = nil;
|
||||||
|
|
||||||
|
result = [NSMutableOrderedSet orderedSetWithCapacity: [self count]];
|
||||||
|
while ((object = [e nextObject]) != nil)
|
||||||
|
{
|
||||||
|
if ([predicate evaluateWithObject: object] == YES)
|
||||||
|
{
|
||||||
|
[result addObject: object]; // passes filter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GS_IMMUTABLE(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Describing a set
|
// Describing a set
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue