#import <ObjectiveLib/HashSet.h>
Inheritance diagram for OLHashSet:
Public Member Functions  
(OLHashIterator *)   begin 
Return an iterator pointing to the beginning of the sequence.  
(void)   clear 
Remove all elements.  
(int)   compare: 
Compare this hash set to another object.  
(id)   copyWithZone: 
Make a copy of this hash set allocating memory from the given zone.  
(unsigned)   count: 
Return the number of elements equal to value.  
(BOOL)   empty 
Test whether the set is empty.  
(void)   encodeWithCoder: 
Encode the map.  
(OLHashIterator *)   end 
Return an iterator pointing to one position beyond the end of the sequence.  
(OLPair *)   equalRange: 
Return a range whose elements are equal to value.  
(void)   erase: 
Remove the element designated by where.  
(void)   eraseFrom:to: 
Remove a range of elements.  
(unsigned)   eraseValue: 
Erase all instances of value.  
(OLHashIterator *)   find: 
Find an element.  
(id)   insert: 
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.  
(NSObject< OLBoolBinaryFunction > *)   keyEqual 
Return the function used to compare keys in the set.  
(unsigned)   maxSize 
Return the maxiumum number of objects that can be stored in a set.  
(unsigned)   size 
Return the number of elements in the set.  
(void)   swap: 
Swap this set with another one.  
(void)   writeSelfToStream: 
Write the object to a stream.  
Initializers and Deallocators  
(void)   dealloc 
Finalize the set and deallocate any allocated memory.  
(id)   init 
Initialize the set.  
(id)   initFrom:to: 
Initialize the set.  
(id)   initFrom:to:tableSize: 
Initialize the set.  
(id)   initFrom:to:tableSize:keyEqual: 
Initialize the set.  
(id)   initWithCoder: 
Initialize the set.  
(id)   initWithHashSet: 
Initialize the set.  
(id)   initWithObjectInStream: 
Initialize the object.  
(id)   initWithTableSize: 
Initialize the set.  
(id)   initWithTableSize:keyEqual: 
Initialize the set.  
Static Public Member Functions  
(id)  + hashSet 
Create and return a new hash set.  
(id)  + hashSetFrom:to: 
Create and return a new hash set.  
(id)  + hashSetWithHashSet: 
Create and return a new hash set.  
Protected Attributes  
OLHashTable *  table 
The hash table that provides the underlying data structure. 
The class provides very similar functionality to OLSet, but it uses a hash table as the underlying data structure. Like OLSet it is a container of unique objects, and attempting to insert an object that is already in the set will fail. However, there are important differences to OLSet due to the use of the hash table as the data structure. Searching for an object in a hash set is inherently very fast, which is the main reason to choose to use OLHashSet over OLSet. Another difference is that, unlike OLSet, items in a hash set do not appear in a predictable order. Of course, the items are not ordered randomly, but the order will depend on the result of the hash function used for elements in the hash set.
OLHashSet requires a function object to test elements for equality, as equal elements are grouped together. If no function is explicitly given, then OLEqualTo is used.
 (OLHashIterator*) begin 
Return an iterator pointing to the beginning of the sequence.
 (void) clear 
Remove all elements.
 (int) compare:  (id)  other 
Compare this hash set to another object.
If the other object is of type OLHashSet, 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) copyWithZone:  (NSZone *)  zone 
Make a copy of this hash set allocating memory from the given zone.
zone  the zone from which to allocate memory 
 (unsigned) count:  (id)  value 
Return the number of elements equal to value.
hash
.value  the value to search for in the set 
 (void) dealloc 
Finalize the set and deallocate any allocated memory.
 (BOOL) empty 
Test whether the set is empty.
 (void) encodeWithCoder:  (NSCoder *)  encoder 
Encode the map.
The map is saved to an archive using encoder. The map will be retrieved from the archive using the initializer initWithCoder:.
encoder  the coder which will save the bit set to the archive 
 (OLHashIterator*) end 
Return an iterator pointing to one position beyond the end of the sequence.
 (OLPair*) equalRange:  (id)  value 
Return a range whose elements are equal to value.
The returned pair contains two instances of OLHashIterator delimiting the range of elements.
hash
.value  the value for which to search 
 (void) erase:  (OLHashIterator *)  where 
Remove the element designated by where.
where  an iterator designating the element to remove 
 (void) eraseFrom:  (OLHashIterator *)  first  
to:  (OLHashIterator *)  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) eraseValue:  (id)  value 
Erase all instances of value.
The set is searched for value, all instances are removed from the set and the number removed is returned.
hash
.value  the value to remove from the set 
 (OLHashIterator*) find:  (id)  object 
Find an element.
The element object 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.
hash
.object  the value for which to search 
+ (id) hashSet 
Create and return a new hash set.
+ (id) hashSetFrom:  (OLForwardIterator *)  first  
to:  (OLForwardIterator *)  last  
Create and return a new hash set.
The hash set is initialized with the contents of the range [first, last)
.
[first, last)
must respond to the message hash
.first  the first in the range of elements to insert  
last  one beyond the last in the range of elements to insert 
+ (id) hashSetWithHashSet:  (OLHashSet *)  right 
Create and return a new hash set.
The hash set is initialized with the contents of right.
right  the hash set to copy 
 (id) init 
Initialize the set.
The set is empty and uses OLEqualTo to test for equality.
 (id) initFrom:  (OLForwardIterator *)  first  
to:  (OLForwardIterator *)  last  
Initialize the set.
The set uses the comparison function OLEqualTo to test for equality, and inserts all elements in the range [first, last)
.
[first, last)
must respond to the message hash
.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  
tableSize:  (unsigned)  size  
Initialize the set.
The set uses the comparison function OLEqualTo to test for equality, and inserts all elements in the range [first, last)
. The parameter size is used as a hint for the desired hash table size. The table size will grow as needed, so it is not crucial that this parameter carry any particular meaning. However, providing a size can reduce the number of memory allocations required to build the table.
[first, last)
must respond to the message hash
.first  the first in the range of elements to insert  
last  one beyond the last in the range of elements to insert  
size  a hint as to the desired hash table size 
 (id) initFrom:  (OLForwardIterator *)  first  
to:  (OLForwardIterator *)  last  
tableSize:  (unsigned)  size  
keyEqual:  (NSObject< OLBoolBinaryFunction > *)  eq  
Initialize the set.
The set uses the comparison function eq to test for equality, and inserts all elements in the range [first, last)
. The parameter size is used as a hint for the desired hash table size. The table size will grow as needed, so it is not crucial that this parameter carry any particular meaning. However, providing a size can reduce the number of memory allocations required to build the table.
[first, last)
must respond to the message hash
.first  the first in the range of elements to insert  
last  one beyond the last in the range of elements to insert  
size  a hint as to the desired hash table size  
eq  the function object used to test elements for equality 
 (id) initWithCoder:  (NSCoder *)  decoder 
Initialize the set.
This initializer creates a new set from an archive and returns it.
decoder  the coder which will decode the archived set 
 (id) initWithHashSet:  (OLHashSet *)  right 
Initialize the set.
The set copies the comparison function and all elements from right.
right  the hash set to copy 
 (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) initWithTableSize:  (unsigned)  size 
Initialize the set.
The set is initially empty and uses OLEqualTo to test elements for equality. The parameter size is a hint as to the desired capacity for the hash table. The table will grow as needed, so it isn't strictly necessary to specify a table size, but providing a valid hint can reduce the number of memory allocations performed.
size  a hint as to the desired hash table size 
 (id) initWithTableSize:  (unsigned)  size  
keyEqual:  (NSObject< OLBoolBinaryFunction > *)  eq  
Initialize the set.
The set is initially empty and uses eq to test elements for equality. The parameter size is a hint as to the desired capacity for the hash table. The table will grow as needed, so it isn't strictly necessary to specify a table size, but providing a valid hint can reduce the number of memory allocations performed.
size  a hint as to the desired hash table size  
eq  the function object used to test elements for equality 
 (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 OLHashIterator 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.
hash
.object  the element to insert 
Reimplemented in OLHashMultiSet.
 (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, last)
must respond to the message hash
.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 OLHashMultiSet.
 (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 in OLHashMultiSet.
 (NSObject<OLBoolBinaryFunction>*) keyEqual 
Return the function used to compare keys in the set.
 (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.
 (unsigned) size 
Return the number of elements in the set.
 (void) swap:  (OLHashSet *)  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 
 (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 >.
 (OLHashTable*) table [protected] 
The hash table that provides the underlying data structure.
