(ConstantCollecting): New protocol.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@318 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Andrew McCallum 1995-04-08 17:04:07 +00:00
parent 0f103da9d3
commit 711e81f6ae
2 changed files with 118 additions and 104 deletions

View file

@ -1,5 +1,5 @@
/* Protocol for Objective-C objects that hold collections of elements.
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>
Date: May 1993
@ -38,34 +38,12 @@
#include <objc/Object.h>
#include <objects/elt.h>
@protocol Collecting
@protocol ConstantCollecting
// INITIALIZING;
- init;
- initWithContentsOf: (id <Collecting>)aCollection;
// ADDING;
- addObject: newObject;
- addObjectIfAbsent: newObject;
- addContentsOf: (id <Collecting>)aCollection;
- addContentsOfIfAbsent: (id <Collecting>)aCollection;
- addObjectsCount: (unsigned)count, ...;
// REMOVING;
- removeObject: oldObject;
- removeObject: oldObject ifAbsentCall: (id(*)(arglist_t))excFunc;
- removeAllOccurrencesOfObject: oldObject;
- removeContentsIn: (id <Collecting>)aCollection;
- removeContentsNotIn: (id <Collecting>)aCollection;
- uniqueContents;
- empty;
// REPLACING;
- replaceObject: oldObject with: newObject;
- replaceObject: oldObject with: newObject
ifAbsentCall:(id(*)(arglist_t))excFunc;
- replaceAllOccurrencesOfObject: oldObject with: newObject;
// TESTING;
- (BOOL) isEmpty;
- (BOOL) includesObject: anObject;
@ -96,12 +74,6 @@
- makeObjectsPerform: (SEL)aSel;
- makeObjectsPerform: (SEL)aSel with: argObject;
// ENUMERATING WHILE CHANGING CONTENTS;
- safeMakeObjectsPerform: (SEL)aSel;
- safeMakeObjectsPerform: (SEL)aSel with: argObject;
- safeWithObjectsCall: (void(*)(id))aFunc;
- safeWithObjectsCall: (void(*)(id))aFunc whileTrue:(BOOL *)flag;
// FILTERED ENUMERATING;
- withObjectsTrueByCalling: (BOOL(*)(id))testFunc
call: (void(*)(id))destFunc;
@ -119,29 +91,11 @@
- copyAs: (Class)aCollectionClass;
- species;
// NON-OBJECT ELEMENT METHOD NAMES;
// INITIALIZING;
- initWithType:(const char *)contentEncoding;
// ADDING;
- addElement: (elt)newElement;
- addElementIfAbsent: (elt)newElement;
- addElementsCount: (unsigned)count, ...;
// REMOVING;
- (elt) removeElement: (elt)oldElement;
- (elt) removeElement: (elt)oldElement
ifAbsentCall: (elt(*)(arglist_t))excFunc;
- removeAllOccurrencesOfElement: (elt)oldElement;
// REPLACING;
- (elt) replaceElement: (elt)oldElement with: (elt)newElement;
- (elt) replaceElement: (elt)oldElement with: (elt)newElement
ifAbsentCall: (elt(*)(arglist_t))excFunc;
- replaceAllOccurrencesOfElement: (elt)oldElement with: (elt)newElement;
// TESTING;
- (BOOL) includesElement: (elt)anElement;
- (unsigned) occurrencesOfElement: (elt)anElement;
@ -164,10 +118,6 @@
- withElementsCall: (void(*)(elt))aFunc whileTrue: (BOOL*)flag;
- (elt) injectElement: (elt)initialElement byCalling: (elt(*)(elt,elt))aFunc;
// ENUMERATING WHILE CHANGING CONTENTS;
- safeWithElementsCall: (void(*)(elt))aFunc;
- safeWithElementsCall: (void(*)(elt))aFunc whileTrue: (BOOL*)flag;
// FILTERED ENUMERATING;
- withElementsTrueByCalling: (BOOL(*)(elt))testFunc
call: (void(*)(elt))destFunc;
@ -178,4 +128,61 @@
@end
@protocol Collecting <ConstantCollecting>
// ADDING;
- addObject: newObject;
- addObjectIfAbsent: newObject;
- addContentsOf: (id <Collecting>)aCollection;
- addContentsOfIfAbsent: (id <Collecting>)aCollection;
- addObjectsCount: (unsigned)count, ...;
// REMOVING;
- removeObject: oldObject;
- removeObject: oldObject ifAbsentCall: (id(*)(arglist_t))excFunc;
- removeAllOccurrencesOfObject: oldObject;
- removeContentsIn: (id <Collecting>)aCollection;
- removeContentsNotIn: (id <Collecting>)aCollection;
- uniqueContents;
- empty;
// REPLACING;
- replaceObject: oldObject with: newObject;
- replaceObject: oldObject with: newObject
ifAbsentCall:(id(*)(arglist_t))excFunc;
- replaceAllOccurrencesOfObject: oldObject with: newObject;
// ENUMERATING WHILE CHANGING CONTENTS;
- safeMakeObjectsPerform: (SEL)aSel;
- safeMakeObjectsPerform: (SEL)aSel with: argObject;
- safeWithObjectsCall: (void(*)(id))aFunc;
- safeWithObjectsCall: (void(*)(id))aFunc whileTrue:(BOOL *)flag;
// NON-OBJECT ELEMENT METHOD NAMES;
// ADDING;
- addElement: (elt)newElement;
- addElementIfAbsent: (elt)newElement;
- addElementsCount: (unsigned)count, ...;
// REMOVING;
- (elt) removeElement: (elt)oldElement;
- (elt) removeElement: (elt)oldElement
ifAbsentCall: (elt(*)(arglist_t))excFunc;
- removeAllOccurrencesOfElement: (elt)oldElement;
// REPLACING;
- (elt) replaceElement: (elt)oldElement with: (elt)newElement;
- (elt) replaceElement: (elt)oldElement with: (elt)newElement
ifAbsentCall: (elt(*)(arglist_t))excFunc;
- replaceAllOccurrencesOfElement: (elt)oldElement with: (elt)newElement;
// ENUMERATING WHILE CHANGING CONTENTS;
- safeWithElementsCall: (void(*)(elt))aFunc;
- safeWithElementsCall: (void(*)(elt))aFunc whileTrue: (BOOL*)flag;
@end
#endif /* __Collecting_h_INCLUDE_GNU */

View file

@ -1,5 +1,5 @@
/* Protocol for Objective-C objects that hold collections of elements.
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>
Date: May 1993
@ -38,34 +38,12 @@
#include <objc/Object.h>
#include <objects/elt.h>
@protocol Collecting
@protocol ConstantCollecting
// INITIALIZING;
- init;
- initWithContentsOf: (id <Collecting>)aCollection;
// ADDING;
- addObject: newObject;
- addObjectIfAbsent: newObject;
- addContentsOf: (id <Collecting>)aCollection;
- addContentsOfIfAbsent: (id <Collecting>)aCollection;
- addObjectsCount: (unsigned)count, ...;
// REMOVING;
- removeObject: oldObject;
- removeObject: oldObject ifAbsentCall: (id(*)(arglist_t))excFunc;
- removeAllOccurrencesOfObject: oldObject;
- removeContentsIn: (id <Collecting>)aCollection;
- removeContentsNotIn: (id <Collecting>)aCollection;
- uniqueContents;
- empty;
// REPLACING;
- replaceObject: oldObject with: newObject;
- replaceObject: oldObject with: newObject
ifAbsentCall:(id(*)(arglist_t))excFunc;
- replaceAllOccurrencesOfObject: oldObject with: newObject;
// TESTING;
- (BOOL) isEmpty;
- (BOOL) includesObject: anObject;
@ -96,12 +74,6 @@
- makeObjectsPerform: (SEL)aSel;
- makeObjectsPerform: (SEL)aSel with: argObject;
// ENUMERATING WHILE CHANGING CONTENTS;
- safeMakeObjectsPerform: (SEL)aSel;
- safeMakeObjectsPerform: (SEL)aSel with: argObject;
- safeWithObjectsCall: (void(*)(id))aFunc;
- safeWithObjectsCall: (void(*)(id))aFunc whileTrue:(BOOL *)flag;
// FILTERED ENUMERATING;
- withObjectsTrueByCalling: (BOOL(*)(id))testFunc
call: (void(*)(id))destFunc;
@ -119,29 +91,11 @@
- copyAs: (Class)aCollectionClass;
- species;
// NON-OBJECT ELEMENT METHOD NAMES;
// INITIALIZING;
- initWithType:(const char *)contentEncoding;
// ADDING;
- addElement: (elt)newElement;
- addElementIfAbsent: (elt)newElement;
- addElementsCount: (unsigned)count, ...;
// REMOVING;
- (elt) removeElement: (elt)oldElement;
- (elt) removeElement: (elt)oldElement
ifAbsentCall: (elt(*)(arglist_t))excFunc;
- removeAllOccurrencesOfElement: (elt)oldElement;
// REPLACING;
- (elt) replaceElement: (elt)oldElement with: (elt)newElement;
- (elt) replaceElement: (elt)oldElement with: (elt)newElement
ifAbsentCall: (elt(*)(arglist_t))excFunc;
- replaceAllOccurrencesOfElement: (elt)oldElement with: (elt)newElement;
// TESTING;
- (BOOL) includesElement: (elt)anElement;
- (unsigned) occurrencesOfElement: (elt)anElement;
@ -164,10 +118,6 @@
- withElementsCall: (void(*)(elt))aFunc whileTrue: (BOOL*)flag;
- (elt) injectElement: (elt)initialElement byCalling: (elt(*)(elt,elt))aFunc;
// ENUMERATING WHILE CHANGING CONTENTS;
- safeWithElementsCall: (void(*)(elt))aFunc;
- safeWithElementsCall: (void(*)(elt))aFunc whileTrue: (BOOL*)flag;
// FILTERED ENUMERATING;
- withElementsTrueByCalling: (BOOL(*)(elt))testFunc
call: (void(*)(elt))destFunc;
@ -178,4 +128,61 @@
@end
@protocol Collecting <ConstantCollecting>
// ADDING;
- addObject: newObject;
- addObjectIfAbsent: newObject;
- addContentsOf: (id <Collecting>)aCollection;
- addContentsOfIfAbsent: (id <Collecting>)aCollection;
- addObjectsCount: (unsigned)count, ...;
// REMOVING;
- removeObject: oldObject;
- removeObject: oldObject ifAbsentCall: (id(*)(arglist_t))excFunc;
- removeAllOccurrencesOfObject: oldObject;
- removeContentsIn: (id <Collecting>)aCollection;
- removeContentsNotIn: (id <Collecting>)aCollection;
- uniqueContents;
- empty;
// REPLACING;
- replaceObject: oldObject with: newObject;
- replaceObject: oldObject with: newObject
ifAbsentCall:(id(*)(arglist_t))excFunc;
- replaceAllOccurrencesOfObject: oldObject with: newObject;
// ENUMERATING WHILE CHANGING CONTENTS;
- safeMakeObjectsPerform: (SEL)aSel;
- safeMakeObjectsPerform: (SEL)aSel with: argObject;
- safeWithObjectsCall: (void(*)(id))aFunc;
- safeWithObjectsCall: (void(*)(id))aFunc whileTrue:(BOOL *)flag;
// NON-OBJECT ELEMENT METHOD NAMES;
// ADDING;
- addElement: (elt)newElement;
- addElementIfAbsent: (elt)newElement;
- addElementsCount: (unsigned)count, ...;
// REMOVING;
- (elt) removeElement: (elt)oldElement;
- (elt) removeElement: (elt)oldElement
ifAbsentCall: (elt(*)(arglist_t))excFunc;
- removeAllOccurrencesOfElement: (elt)oldElement;
// REPLACING;
- (elt) replaceElement: (elt)oldElement with: (elt)newElement;
- (elt) replaceElement: (elt)oldElement with: (elt)newElement
ifAbsentCall: (elt(*)(arglist_t))excFunc;
- replaceAllOccurrencesOfElement: (elt)oldElement with: (elt)newElement;
// ENUMERATING WHILE CHANGING CONTENTS;
- safeWithElementsCall: (void(*)(elt))aFunc;
- safeWithElementsCall: (void(*)(elt))aFunc whileTrue: (BOOL*)flag;
@end
#endif /* __Collecting_h_INCLUDE_GNU */