mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
(ConstantIndexedCollecting): New protocol extracted from
IndexedCollecting. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@320 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e890363959
commit
67498ed7cc
2 changed files with 106 additions and 94 deletions
|
@ -1,5 +1,5 @@
|
||||||
/* Protocol for Objective-C objects that hold elements accessible by index
|
/* Protocol for Objective-C objects that hold elements accessible by index
|
||||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||||
Date: May 1993
|
Date: May 1993
|
||||||
|
@ -48,29 +48,7 @@ typedef struct _IndexRange {
|
||||||
__a.start<=__b.start && __a.end>=__b.end;})
|
__a.start<=__b.start && __a.end>=__b.end;})
|
||||||
|
|
||||||
|
|
||||||
@protocol IndexedCollecting <KeyedCollecting>
|
@protocol ConstantIndexedCollecting <ConstantKeyedCollecting>
|
||||||
|
|
||||||
// ADDING;
|
|
||||||
- insertObject: newObject atIndex: (unsigned)index;
|
|
||||||
- insertObject: newObject before: oldObject;
|
|
||||||
- insertObject: newObject after: oldObject;
|
|
||||||
- insertContentsOf: (id <Collecting>)aCollection atIndex: (unsigned)index;
|
|
||||||
- appendObject: newObject;
|
|
||||||
- prependObject: newObject;
|
|
||||||
- appendContentsOf: (id <Collecting>)aCollection;
|
|
||||||
- prependContentsOf: (id <Collecting>)aCollection;
|
|
||||||
|
|
||||||
// REPLACING AND SWAPPING
|
|
||||||
- replaceObjectAtIndex: (unsigned)index with: newObject;
|
|
||||||
- replaceRange: (IndexRange)aRange with: (id <Collecting>)aCollection;
|
|
||||||
- replaceRange: (IndexRange)aRange using: (id <Collecting>)aCollection;
|
|
||||||
- swapAtIndeces: (unsigned)index1 : (unsigned)index2;
|
|
||||||
|
|
||||||
// REMOVING
|
|
||||||
- removeObjectAtIndex: (unsigned)index;
|
|
||||||
- removeFirstObject;
|
|
||||||
- removeLastObject;
|
|
||||||
- removeRange: (IndexRange)aRange;
|
|
||||||
|
|
||||||
// GETTING MEMBERS BY INDEX;
|
// GETTING MEMBERS BY INDEX;
|
||||||
- objectAtIndex: (unsigned)index;
|
- objectAtIndex: (unsigned)index;
|
||||||
|
@ -102,6 +80,57 @@ typedef struct _IndexRange {
|
||||||
- withObjectsInReverseCall: (void(*)(id))aFunc;
|
- withObjectsInReverseCall: (void(*)(id))aFunc;
|
||||||
- withObjectsInReverseCall: (void(*)(id))aFunc whileTrue:(BOOL *)flag;
|
- withObjectsInReverseCall: (void(*)(id))aFunc whileTrue:(BOOL *)flag;
|
||||||
|
|
||||||
|
// NON-OBJECT MESSAGE NAMES;
|
||||||
|
|
||||||
|
// GETTING ELEMENTS BY INDEX;
|
||||||
|
- (elt) elementAtIndex: (unsigned)index;
|
||||||
|
- (elt) firstElement;
|
||||||
|
- (elt) lastElement;
|
||||||
|
|
||||||
|
// GETTING MEMBERS BY NEIGHBOR;
|
||||||
|
- (elt) successorOfElement: (elt)anElement;
|
||||||
|
- (elt) predecessorOfElement: (elt)anElement;
|
||||||
|
|
||||||
|
// GETTING INDICES BY MEMBER;
|
||||||
|
- (unsigned) indexOfElement: (elt)anElement;
|
||||||
|
- (unsigned) indexOfElement: (elt)anElement
|
||||||
|
ifAbsentCall: (unsigned(*)(arglist_t))excFunc;
|
||||||
|
- (unsigned) indexOfElement: (elt)anElement inRange: (IndexRange)aRange;
|
||||||
|
- (unsigned) indexOfElement: (elt)anElement inRange: (IndexRange)aRange
|
||||||
|
ifAbsentCall: (unsigned(*)(arglist_t))excFunc;
|
||||||
|
|
||||||
|
// ENUMERATING;
|
||||||
|
- (BOOL) getPrevElement:(elt*)anElementPtr withEnumState: (void**)enumState;
|
||||||
|
- withElementsInRange: (IndexRange)aRange call:(void(*)(elt))aFunc;
|
||||||
|
- withElementsInReverseCall: (void(*)(elt))aFunc;
|
||||||
|
- withElementsInReverseCall: (void(*)(elt))aFunc whileTrue:(BOOL *)flag;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@protocol IndexedCollecting <ConstantIndexedCollecting, KeyedCollecting>
|
||||||
|
|
||||||
|
// ADDING;
|
||||||
|
- insertObject: newObject atIndex: (unsigned)index;
|
||||||
|
- insertObject: newObject before: oldObject;
|
||||||
|
- insertObject: newObject after: oldObject;
|
||||||
|
- insertContentsOf: (id <Collecting>)aCollection atIndex: (unsigned)index;
|
||||||
|
- appendObject: newObject;
|
||||||
|
- prependObject: newObject;
|
||||||
|
- appendContentsOf: (id <Collecting>)aCollection;
|
||||||
|
- prependContentsOf: (id <Collecting>)aCollection;
|
||||||
|
|
||||||
|
// REPLACING AND SWAPPING
|
||||||
|
- replaceObjectAtIndex: (unsigned)index with: newObject;
|
||||||
|
- replaceRange: (IndexRange)aRange with: (id <Collecting>)aCollection;
|
||||||
|
- replaceRange: (IndexRange)aRange using: (id <Collecting>)aCollection;
|
||||||
|
- swapAtIndeces: (unsigned)index1 : (unsigned)index2;
|
||||||
|
|
||||||
|
// REMOVING
|
||||||
|
- removeObjectAtIndex: (unsigned)index;
|
||||||
|
- removeFirstObject;
|
||||||
|
- removeLastObject;
|
||||||
|
- removeRange: (IndexRange)aRange;
|
||||||
|
|
||||||
// ENUMERATING WHILE CHANGING CONTENTS;
|
// ENUMERATING WHILE CHANGING CONTENTS;
|
||||||
- safeWithObjectsInReverseCall: (void(*)(id))aFunc;
|
- safeWithObjectsInReverseCall: (void(*)(id))aFunc;
|
||||||
- safeWithObjectsInReverseCall: (void(*)(id))aFunc whileTrue:(BOOL *)flag;
|
- safeWithObjectsInReverseCall: (void(*)(id))aFunc whileTrue:(BOOL *)flag;
|
||||||
|
@ -128,29 +157,6 @@ typedef struct _IndexRange {
|
||||||
- (elt) removeLastElement;
|
- (elt) removeLastElement;
|
||||||
- (elt) replaceElementAtIndex: (unsigned)index with: (elt)newElement;
|
- (elt) replaceElementAtIndex: (unsigned)index with: (elt)newElement;
|
||||||
|
|
||||||
// GETTING ELEMENTS BY INDEX;
|
|
||||||
- (elt) elementAtIndex: (unsigned)index;
|
|
||||||
- (elt) firstElement;
|
|
||||||
- (elt) lastElement;
|
|
||||||
|
|
||||||
// GETTING MEMBERS BY NEIGHBOR;
|
|
||||||
- (elt) successorOfElement: (elt)anElement;
|
|
||||||
- (elt) predecessorOfElement: (elt)anElement;
|
|
||||||
|
|
||||||
// GETTING INDICES BY MEMBER;
|
|
||||||
- (unsigned) indexOfElement: (elt)anElement;
|
|
||||||
- (unsigned) indexOfElement: (elt)anElement
|
|
||||||
ifAbsentCall: (unsigned(*)(arglist_t))excFunc;
|
|
||||||
- (unsigned) indexOfElement: (elt)anElement inRange: (IndexRange)aRange;
|
|
||||||
- (unsigned) indexOfElement: (elt)anElement inRange: (IndexRange)aRange
|
|
||||||
ifAbsentCall: (unsigned(*)(arglist_t))excFunc;
|
|
||||||
|
|
||||||
// ENUMERATING;
|
|
||||||
- (BOOL) getPrevElement:(elt*)anElementPtr withEnumState: (void**)enumState;
|
|
||||||
- withElementsInRange: (IndexRange)aRange call:(void(*)(elt))aFunc;
|
|
||||||
- withElementsInReverseCall: (void(*)(elt))aFunc;
|
|
||||||
- withElementsInReverseCall: (void(*)(elt))aFunc whileTrue:(BOOL *)flag;
|
|
||||||
|
|
||||||
// ENUMERATING WHILE CHANGING CONTENTS;
|
// ENUMERATING WHILE CHANGING CONTENTS;
|
||||||
- safeWithElementsInRange: (IndexRange)aRange call:(void(*)(elt))aFunc;
|
- safeWithElementsInRange: (IndexRange)aRange call:(void(*)(elt))aFunc;
|
||||||
- safeWithElementsInReverseCall: (void(*)(elt))aFunc;
|
- safeWithElementsInReverseCall: (void(*)(elt))aFunc;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Protocol for Objective-C objects that hold elements accessible by index
|
/* Protocol for Objective-C objects that hold elements accessible by index
|
||||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||||
Date: May 1993
|
Date: May 1993
|
||||||
|
@ -48,29 +48,7 @@ typedef struct _IndexRange {
|
||||||
__a.start<=__b.start && __a.end>=__b.end;})
|
__a.start<=__b.start && __a.end>=__b.end;})
|
||||||
|
|
||||||
|
|
||||||
@protocol IndexedCollecting <KeyedCollecting>
|
@protocol ConstantIndexedCollecting <ConstantKeyedCollecting>
|
||||||
|
|
||||||
// ADDING;
|
|
||||||
- insertObject: newObject atIndex: (unsigned)index;
|
|
||||||
- insertObject: newObject before: oldObject;
|
|
||||||
- insertObject: newObject after: oldObject;
|
|
||||||
- insertContentsOf: (id <Collecting>)aCollection atIndex: (unsigned)index;
|
|
||||||
- appendObject: newObject;
|
|
||||||
- prependObject: newObject;
|
|
||||||
- appendContentsOf: (id <Collecting>)aCollection;
|
|
||||||
- prependContentsOf: (id <Collecting>)aCollection;
|
|
||||||
|
|
||||||
// REPLACING AND SWAPPING
|
|
||||||
- replaceObjectAtIndex: (unsigned)index with: newObject;
|
|
||||||
- replaceRange: (IndexRange)aRange with: (id <Collecting>)aCollection;
|
|
||||||
- replaceRange: (IndexRange)aRange using: (id <Collecting>)aCollection;
|
|
||||||
- swapAtIndeces: (unsigned)index1 : (unsigned)index2;
|
|
||||||
|
|
||||||
// REMOVING
|
|
||||||
- removeObjectAtIndex: (unsigned)index;
|
|
||||||
- removeFirstObject;
|
|
||||||
- removeLastObject;
|
|
||||||
- removeRange: (IndexRange)aRange;
|
|
||||||
|
|
||||||
// GETTING MEMBERS BY INDEX;
|
// GETTING MEMBERS BY INDEX;
|
||||||
- objectAtIndex: (unsigned)index;
|
- objectAtIndex: (unsigned)index;
|
||||||
|
@ -102,6 +80,57 @@ typedef struct _IndexRange {
|
||||||
- withObjectsInReverseCall: (void(*)(id))aFunc;
|
- withObjectsInReverseCall: (void(*)(id))aFunc;
|
||||||
- withObjectsInReverseCall: (void(*)(id))aFunc whileTrue:(BOOL *)flag;
|
- withObjectsInReverseCall: (void(*)(id))aFunc whileTrue:(BOOL *)flag;
|
||||||
|
|
||||||
|
// NON-OBJECT MESSAGE NAMES;
|
||||||
|
|
||||||
|
// GETTING ELEMENTS BY INDEX;
|
||||||
|
- (elt) elementAtIndex: (unsigned)index;
|
||||||
|
- (elt) firstElement;
|
||||||
|
- (elt) lastElement;
|
||||||
|
|
||||||
|
// GETTING MEMBERS BY NEIGHBOR;
|
||||||
|
- (elt) successorOfElement: (elt)anElement;
|
||||||
|
- (elt) predecessorOfElement: (elt)anElement;
|
||||||
|
|
||||||
|
// GETTING INDICES BY MEMBER;
|
||||||
|
- (unsigned) indexOfElement: (elt)anElement;
|
||||||
|
- (unsigned) indexOfElement: (elt)anElement
|
||||||
|
ifAbsentCall: (unsigned(*)(arglist_t))excFunc;
|
||||||
|
- (unsigned) indexOfElement: (elt)anElement inRange: (IndexRange)aRange;
|
||||||
|
- (unsigned) indexOfElement: (elt)anElement inRange: (IndexRange)aRange
|
||||||
|
ifAbsentCall: (unsigned(*)(arglist_t))excFunc;
|
||||||
|
|
||||||
|
// ENUMERATING;
|
||||||
|
- (BOOL) getPrevElement:(elt*)anElementPtr withEnumState: (void**)enumState;
|
||||||
|
- withElementsInRange: (IndexRange)aRange call:(void(*)(elt))aFunc;
|
||||||
|
- withElementsInReverseCall: (void(*)(elt))aFunc;
|
||||||
|
- withElementsInReverseCall: (void(*)(elt))aFunc whileTrue:(BOOL *)flag;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@protocol IndexedCollecting <ConstantIndexedCollecting, KeyedCollecting>
|
||||||
|
|
||||||
|
// ADDING;
|
||||||
|
- insertObject: newObject atIndex: (unsigned)index;
|
||||||
|
- insertObject: newObject before: oldObject;
|
||||||
|
- insertObject: newObject after: oldObject;
|
||||||
|
- insertContentsOf: (id <Collecting>)aCollection atIndex: (unsigned)index;
|
||||||
|
- appendObject: newObject;
|
||||||
|
- prependObject: newObject;
|
||||||
|
- appendContentsOf: (id <Collecting>)aCollection;
|
||||||
|
- prependContentsOf: (id <Collecting>)aCollection;
|
||||||
|
|
||||||
|
// REPLACING AND SWAPPING
|
||||||
|
- replaceObjectAtIndex: (unsigned)index with: newObject;
|
||||||
|
- replaceRange: (IndexRange)aRange with: (id <Collecting>)aCollection;
|
||||||
|
- replaceRange: (IndexRange)aRange using: (id <Collecting>)aCollection;
|
||||||
|
- swapAtIndeces: (unsigned)index1 : (unsigned)index2;
|
||||||
|
|
||||||
|
// REMOVING
|
||||||
|
- removeObjectAtIndex: (unsigned)index;
|
||||||
|
- removeFirstObject;
|
||||||
|
- removeLastObject;
|
||||||
|
- removeRange: (IndexRange)aRange;
|
||||||
|
|
||||||
// ENUMERATING WHILE CHANGING CONTENTS;
|
// ENUMERATING WHILE CHANGING CONTENTS;
|
||||||
- safeWithObjectsInReverseCall: (void(*)(id))aFunc;
|
- safeWithObjectsInReverseCall: (void(*)(id))aFunc;
|
||||||
- safeWithObjectsInReverseCall: (void(*)(id))aFunc whileTrue:(BOOL *)flag;
|
- safeWithObjectsInReverseCall: (void(*)(id))aFunc whileTrue:(BOOL *)flag;
|
||||||
|
@ -128,29 +157,6 @@ typedef struct _IndexRange {
|
||||||
- (elt) removeLastElement;
|
- (elt) removeLastElement;
|
||||||
- (elt) replaceElementAtIndex: (unsigned)index with: (elt)newElement;
|
- (elt) replaceElementAtIndex: (unsigned)index with: (elt)newElement;
|
||||||
|
|
||||||
// GETTING ELEMENTS BY INDEX;
|
|
||||||
- (elt) elementAtIndex: (unsigned)index;
|
|
||||||
- (elt) firstElement;
|
|
||||||
- (elt) lastElement;
|
|
||||||
|
|
||||||
// GETTING MEMBERS BY NEIGHBOR;
|
|
||||||
- (elt) successorOfElement: (elt)anElement;
|
|
||||||
- (elt) predecessorOfElement: (elt)anElement;
|
|
||||||
|
|
||||||
// GETTING INDICES BY MEMBER;
|
|
||||||
- (unsigned) indexOfElement: (elt)anElement;
|
|
||||||
- (unsigned) indexOfElement: (elt)anElement
|
|
||||||
ifAbsentCall: (unsigned(*)(arglist_t))excFunc;
|
|
||||||
- (unsigned) indexOfElement: (elt)anElement inRange: (IndexRange)aRange;
|
|
||||||
- (unsigned) indexOfElement: (elt)anElement inRange: (IndexRange)aRange
|
|
||||||
ifAbsentCall: (unsigned(*)(arglist_t))excFunc;
|
|
||||||
|
|
||||||
// ENUMERATING;
|
|
||||||
- (BOOL) getPrevElement:(elt*)anElementPtr withEnumState: (void**)enumState;
|
|
||||||
- withElementsInRange: (IndexRange)aRange call:(void(*)(elt))aFunc;
|
|
||||||
- withElementsInReverseCall: (void(*)(elt))aFunc;
|
|
||||||
- withElementsInReverseCall: (void(*)(elt))aFunc whileTrue:(BOOL *)flag;
|
|
||||||
|
|
||||||
// ENUMERATING WHILE CHANGING CONTENTS;
|
// ENUMERATING WHILE CHANGING CONTENTS;
|
||||||
- safeWithElementsInRange: (IndexRange)aRange call:(void(*)(elt))aFunc;
|
- safeWithElementsInRange: (IndexRange)aRange call:(void(*)(elt))aFunc;
|
||||||
- safeWithElementsInReverseCall: (void(*)(elt))aFunc;
|
- safeWithElementsInReverseCall: (void(*)(elt))aFunc;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue