00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #if !defined(HASHSET_OL_GUARD)
00044 #define HASHSET_OL_GUARD
00045
00046 #include <ObjectiveLib/Iterator.h>
00047 #include <ObjectiveLib/Functional.h>
00048
00053 @class OLHashTable;
00054
00081 @interface OLHashSet :
00082 #if defined(OL_NO_OPENSTEP)
00083 Object <OLStreamable>
00084 #else
00085 NSObject <OLStreamable, NSCopying, NSCoding>
00086 #endif
00087 {
00088 @protected
00092 OLHashTable* table;
00093 }
00094
00103 + (id) hashSet;
00104
00118 + (id) hashSetFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00119
00130 + (id) hashSetWithHashSet: (OLHashSet*)right;
00131
00135
00141 - (id) init;
00142
00154 - (id) initFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00155
00171 - (id) initFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last tableSize: (unsigned)size;
00172
00189 #if defined(OL_NO_OPENSTEP)
00190 - (id) initFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last tableSize: (unsigned)size keyEqual: (Object<OLBoolBinaryFunction>*)eq;
00191 #else
00192 - (id) initFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last tableSize: (unsigned)size keyEqual: (NSObject<OLBoolBinaryFunction>*)eq;
00193 #endif
00194
00195 #if !defined(OL_NO_OPENSTEP)
00196
00206 - (id) initWithCoder: (NSCoder*)decoder;
00207 #endif
00208
00216 - (id) initWithHashSet: (OLHashSet*)right;
00217
00218 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00219
00230 - (id) initWithTableSize: (unsigned)size;
00231
00243 #if defined(OL_NO_OPENSTEP)
00244 - (id) initWithTableSize: (unsigned)size keyEqual: (Object<OLBoolBinaryFunction>*)eq;
00245 #else
00246 - (id) initWithTableSize: (unsigned)size keyEqual: (NSObject<OLBoolBinaryFunction>*)eq;
00247 #endif
00248
00252 #if defined(OL_NO_OPENSTEP)
00253 - (id) free;
00254 #else
00255 - (void) dealloc;
00256 #endif
00257
00258
00267 - (OLHashIterator*) begin;
00268
00272 - (void) clear;
00273
00283 - (int) compare: (id)other;
00284
00285 #if defined(OL_NO_OPENSTEP)
00286
00291 - (id) copy;
00292 #else
00293
00299 - (id) copyWithZone: (NSZone*)zone;
00300 #endif
00301
00310 - (unsigned) count: (id)value;
00311
00317 - (BOOL) empty;
00318
00319 #if !defined(OL_NO_OPENSTEP)
00320
00326 - (void) encodeWithCoder: (NSCoder*)encoder;
00327 #endif
00328
00337 - (OLHashIterator*) end;
00338
00352 - (OLPair*) equalRange: (id)value;
00353
00361 - (void) erase: (OLHashIterator*)where;
00362
00372 - (void) eraseFrom: (OLHashIterator*)first to: (OLHashIterator*)last;
00373
00383 - (unsigned) eraseValue: (id)value;
00384
00399 - (OLHashIterator*) find: (id)object;
00400
00418 - (id) insert: (id)object;
00419
00431 - (void) insertFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00432
00441 - (BOOL) isEqual: (id)object;
00442
00448 #if defined(OL_NO_OPENSTEP)
00449 - (Object<OLBoolBinaryFunction>*) keyEqual;
00450 #else
00451 - (NSObject<OLBoolBinaryFunction>*) keyEqual;
00452 #endif
00453
00462 - (unsigned) maxSize;
00463
00469 - (unsigned) size;
00470
00477 - (void) swap: (OLHashSet*)right;
00478
00479 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00480
00481 @end
00482
00493 @interface OLHashMultiSet : OLHashSet
00494 {
00495 }
00496
00505 + (id) hashMultiSet;
00506
00520 + (id) hashMultiSetFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00521
00534 + (id) hashMultiSetWithHashSet: (OLHashSet*)right;
00535
00549 - (id) insert: (id)object;
00550 - (void) insertFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00551
00552 - (BOOL) isEqual: (id)object;
00553
00554 @end
00555
00556 #endif