#import <ObjectiveLib/Set.h>
Inheritance diagram for OLSet:
Public Member Functions  
(OLAssociativeIterator *)   begin 
Return an iterator pointing to the beginning of the sequence.  
(void)   clear 
Remove all elements.  
(int)   compare: 
Compare this set to another object.  
(id)   copy 
Make a copy of this set.  
(unsigned)   count: 
Return the number of elements equal to key.  
(BOOL)   empty 
Test whether the set is empty.  
(OLAssociativeIterator *)   end 
Return an iterator pointing to one position beyond the end of the sequence.  
(OLPair *)   equalRange: 
Return a range whose elements are equal to key.  
(void)   erase: 
Remove the element designated by where.  
(void)   eraseFrom:to: 
Remove a range of elements.  
(unsigned)   eraseKey: 
Erase all instances of key.  
(OLAssociativeIterator *)   find: 
Find an element.  
(id)   insert: 
Insert an object into the set.  
(OLAssociativeIterator *)   insertAt:value: 
Insert an object into the set.  
(void)   insertFrom:to: 
Insert a range of objects into the set.  
(BOOL)   isEqual: 
Test whether another set is equal to this one.  
(OLStreamableFunctor< OLBoolBinaryFunction > *)   keyComp 
Return the function used to compare keys in the set.  
(OLAssociativeIterator *)   lowerBound: 
Find the lower bound of a given key.  
(unsigned)   maxSize 
Return the maxiumum number of objects that can be stored in a set.  
(OLReverseBidiIterator *)   rbegin 
Return a reverse iterator pointing to the end of the sequence.  
(OLReverseBidiIterator *)   rend 
Return a reverse iterator pointing to the beginning of the sequence.  
(unsigned)   size 
Return the number of elements in the set.  
(void)   swap: 
Swap this set with another one.  
(OLAssociativeIterator *)   upperBound: 
Find the upper bound of a given key.  
(OLStreamableFunctor< OLBoolBinaryFunction > *)   valueComp 
Return the function used to compare values.  
(void)   writeSelfToStream: 
Write the object to a stream.  
Initializers and Deallocators  
(id)   free 
Finalize the set and deallocate any allocated memory.  
(id)   init 
Initialize the set.  
(id)   initFrom:to: 
Initialize the set.  
(id)   initFrom:to:compare: 
Initialize the set.  
(id)   initWithCompare: 
Initialize the set.  
(id)   initWithObjectInStream: 
Initialize the object.  
(id)   initWithOLSet: 
Initialize the set.  
Static Public Member Functions  
(id)  + set 
Create and return a new set.  
(id)  + setFrom:to: 
Create and return a new set.  
(id)  + setWithCompare: 
Create and return a new set.  
(id)  + setWithOLSet: 
Create and return a new set.  
Protected Attributes  
OLTree *  tree 
The underlying data structure. 
A set is a sorted associative container of objects. Each object is unique; if an object is inserted into the set and another object that is equal is already in the set, then the insertion will fail. Sets are, due to their underlying data structure, sorted by definition, and the sorting order is determined by a comparison function that is passed during intialization. If no function is given to the set, then OLLess is used, thus ordering the set in ascending order.
 (OLAssociativeIterator*) begin 
Return an iterator pointing to the beginning of the sequence.
 (void) clear 
Remove all elements.
 (int) compare:  (id)  other 
Compare this set to another object.
If the other object is of type OLSet, each of the contained objects is compared to the corresponding object in other by calling the compare:
method.
other  the object with which to compare this one 
 (id) copy 
Make a copy of this set.
 (unsigned) count:  (id)  key 
Return the number of elements equal to key.
key  the key to search for in the set 
 (BOOL) empty 
Test whether the set is empty.
 (OLAssociativeIterator*) end 
Return an iterator pointing to one position beyond the end of the sequence.
 (OLPair*) equalRange:  (id)  key 
Return a range whose elements are equal to key.
The returned pair contains two instances of OLAssociativeIterator delimiting the range of elements.
key  the value for which to search 
 (void) erase:  (OLAssociativeIterator *)  where 
Remove the element designated by where.
where  an iterator designating the element to remove 
 (void) eraseFrom:  (OLAssociativeIterator *)  first  
to:  (OLAssociativeIterator *)  last  
Remove a range of elements.
All elements in the range [first, last)
will be removed from the set.
first  the first in the range of elements to remove  
last  one position beyond the last in the range of elements to remove 
 (unsigned) eraseKey:  (id)  key 
Erase all instances of key.
The set is searched for key, all instances are removed from the set and the number removed is returned.
key  the key to remove from the set 
 (OLAssociativeIterator*) find:  (id)  key 
Find an element.
The element key is searched for in the set and an iterator to its location is returned. If the element does not exist in the set, then the returned iterator will be equal to the iterator returned by end.
key  the key for which to search 
 (id) free 
Finalize the set and deallocate any allocated memory.
 (id) init 
Initialize the set.
The set is initially empty.
 (id) initFrom:  (OLForwardIterator *)  first  
to:  (OLForwardIterator *)  last  
Initialize the set.
The set uses the comparison function OLLess for sorting and inserts all elements referred to in the range [first, last)
. It doesn't matter whether the elements are already sorted using OLLess because the set will sort them, anyway.
first  the first in the range of elements to insert  
last  one beyond the last in the range of elements to insert 
 (id) initFrom:  (OLForwardIterator *)  first  
to:  (OLForwardIterator *)  last  
compare:  (OLStreamableFunctor< OLBoolBinaryFunction > *)  comp  
Initialize the set.
The set uses the given comparison function for sorting, comp, and inserts all elements referred to in the range [first, last)
. It doesn't matter whether the elements are already sorted using comp because the set will sort them, anyway.
first  the first in the range of elements to insert  
last  one beyond the last in the range of elements to insert  
comp  the function to use to sort the set 
 (id) initWithCompare:  (OLStreamableFunctor< OLBoolBinaryFunction > *)  comp 
Initialize the set.
The set uses the given comparison function, comp, for sorting. The set is initially empty.
comp  the comparison function used to maintain the sorting order 
 (id) initWithObjectInStream:  (OLObjectInStream *)  stream 
Initialize the object.
Each instance variable is read from stream and all other initialization is performed.
stream  the stream from which to read 
Reimplemented from < OLStreamable >.
 (id) initWithOLSet:  (OLSet *)  set 
Initialize the set.
The comparison function and all the elements are copied from set into this set.
set  the set to copy 
 (id) insert:  (id)  object 
Insert an object into the set.
An attempt is made to insert object into the set, and an instance of OLPair is returned indicating the state of the insertion. The first element in the returned pair is an instance of OLAssociativeIterator indicating the position of object in the set, and the second element of the returned pair is an object that responds to the message boolValue
. The message boolValue
will return YES if the insertion was successful, or NO if not.
object  the element to insert 
Reimplemented in OLMultiSet.
 (OLAssociativeIterator*) insertAt:  (OLAssociativeIterator *)  where  
value:  (id)  object  
Insert an object into the set.
The object is inserted and the position indicated by where is used as a hint about where in the set the object should be placed. There is no guarantee that the object will ultimately placed anywhere close to where. Note that the insertion may fail if the object is already in the set. An iterator is returned that points to object.
where  a hint as to where in the set the object should be located  
object  the object to insert 
Reimplemented in OLMultiSet.
 (void) insertFrom:  (OLForwardIterator *)  first  
to:  (OLForwardIterator *)  last  
Insert a range of objects into the set.
An attempt is made to insert all objects in the range [first, last)
, however there is no guarantee that any of the elements in the range will actually be inserted if they already exist in the set.
first  the first in the range of objects to insert  
last  one position beyond the last in the range of objects to insert 
Reimplemented in OLMultiSet.
 (BOOL) isEqual:  (id)  object 
Test whether another set is equal to this one.
Two sets are considered equal if they contain the same number of objects and the objects are in the same order and each object is equal to the corresponding object in the other set.
object  the object to test 
Reimplemented from < OLInserter >.
Reimplemented in OLMultiSet.
 (OLStreamableFunctor<OLBoolBinaryFunction>*) keyComp 
Return the function used to compare keys in the set.
 (OLAssociativeIterator*) lowerBound:  (id)  key 
Find the lower bound of a given key.
The lower bound is the first position in the set at which key can be inserted without disturbing the sorting order. An iterator pointing to the lower bound is returned.
key  the key for which to find the lower bound 
 (unsigned) maxSize 
Return the maxiumum number of objects that can be stored in a set.
This limit is theoretical, meaning that there is no guarantee that you can insert this many objects into any given set. The memory conditions of the runtime system play an important role.
 (OLReverseBidiIterator*) rbegin 
Return a reverse iterator pointing to the end of the sequence.
Advancing the returned iterator will move backwards through the sequence to the point indicated by the iterator returned by rend.
 (OLReverseBidiIterator*) rend 
Return a reverse iterator pointing to the beginning of the sequence.
This iterator indicates one position beyond the last position that may be referenced by a reverse iterator.
+ (id) set 
Create and return a new set.
An instance of OLLess is used to compare items for the purposes of sorting.
+ (id) setFrom:  (OLForwardIterator *)  first  
to:  (OLForwardIterator *)  last  
Create and return a new set.
The set is initialized with the contents of the range [first, last)
. An instance of OLLess is used to compare items for the purposes of sorting.
first  the first in the range of elements to insert  
last  one beyond the last in the range of elements to insert 
+ (id) setWithCompare:  (OLStreamableFunctor< OLBoolBinaryFunction > *)  comp 
Create and return a new set.
The set is empty and the comparison function comp is used to sort keys.
comp  the comparison function used to sort keys 
+ (id) setWithOLSet:  (OLSet *)  right 
Create and return a new set.
The set is initialized with the contents of right.
right  the set to copy 
 (unsigned) size 
Return the number of elements in the set.
 (void) swap:  (OLSet *)  right 
Swap this set with another one.
All elements in right will be placed into this set, and all elements in this set will be placed in right.
right  the set with which to swap this one 
 (OLAssociativeIterator*) upperBound:  (id)  key 
Find the upper bound of a given key.
The upper bound is the last position in the set at which key can be inserted without disturbing the sorting order. An iterator pointing to the upper bound is returned.
key  the key for which to find the upper bound 
 (OLStreamableFunctor<OLBoolBinaryFunction>*) valueComp 
Return the function used to compare values.
This returns the same function as the message keyComp.
 (void) writeSelfToStream:  (OLObjectOutStream *)  stream 
Write the object to a stream.
All instance variables are written to stream.
stream  the stream to which to write. 
Reimplemented from < OLStreamable >.
 (OLTree*) tree [protected] 
The underlying data structure.
