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(HASHMAP_OL_GUARD)
00044 #define HASHMAP_OL_GUARD
00045
00046 #include <ObjectiveLib/Iterator.h>
00047 #include <ObjectiveLib/Functional.h>
00048
00052 @class OLHashTableMap;
00053
00080 @interface OLHashMap :
00081 #if defined(OL_NO_OPENSTEP)
00082 Object <OLStreamable>
00083 #else
00084 NSObject <OLStreamable, NSCopying, NSCoding>
00085 #endif
00086 {
00087 @protected
00091 OLHashTableMap* table;
00092 }
00093
00102 + (id) hashMap;
00103
00119 + (id) hashMapFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00120
00131 + (id) hashMapWithHashMap: (OLHashMap*)right;
00132
00136
00142 - (id) init;
00143
00157 - (id) initFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00158
00176 - (id) initFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last tableSize: (unsigned)size;
00177
00196 #if defined(OL_NO_OPENSTEP)
00197 - (id) initFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last tableSize: (unsigned)size keyEqual: (Object<OLBoolBinaryFunction>*)eq;
00198 #else
00199 - (id) initFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last tableSize: (unsigned)size keyEqual: (NSObject<OLBoolBinaryFunction>*)eq;
00200 #endif
00201
00202 #if !defined(OL_NO_OPENSTEP)
00203
00213 - (id) initWithCoder: (NSCoder*)decoder;
00214 #endif
00215
00223 - (id) initWithHashMap: (OLHashMap*)right;
00224
00225 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00226
00237 - (id) initWithTableSize: (unsigned)size;
00238
00250 #if defined(OL_NO_OPENSTEP)
00251 - (id) initWithTableSize: (unsigned)size keyEqual: (Object<OLBoolBinaryFunction>*)eq;
00252 #else
00253 - (id) initWithTableSize: (unsigned)size keyEqual: (NSObject<OLBoolBinaryFunction>*)eq;
00254 #endif
00255
00259 #if defined(OL_NO_OPENSTEP)
00260 - (id) free;
00261 #else
00262 - (void) dealloc;
00263 #endif
00264
00265
00276 - (void) assignKey: (id)key value: (id)value;
00277
00288 - (OLHashIterator*) begin;
00289
00293 - (void) clear;
00294
00304 - (int) compare: (id)other;
00305
00306 #if defined(OL_NO_OPENSTEP)
00307
00312 - (id) copy;
00313 #else
00314
00320 - (id) copyWithZone: (NSZone*)zone;
00321 #endif
00322
00331 - (unsigned) count: (id)key;
00332
00338 - (BOOL) empty;
00339
00340 #if !defined(OL_NO_OPENSTEP)
00341
00347 - (void) encodeWithCoder: (NSCoder*)encoder;
00348 #endif
00349
00360 - (OLHashIterator*) end;
00361
00377 - (OLPair*) equalRange: (id)key;
00378
00386 - (void) erase: (OLHashIterator*)where;
00387
00397 - (void) eraseFrom: (OLHashIterator*)first to: (OLHashIterator*)last;
00398
00408 - (unsigned) eraseKey: (id)key;
00409
00427 - (OLHashIterator*) find: (id)key;
00428
00447 - (id) insert: (OLPair*)keyValue;
00448
00462 - (void) insertFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00463
00481 - (id) insertKey: (id)key value: (id)val;
00482
00493 - (BOOL) isEqual: (id)object;
00494
00501 #if defined(OL_NO_OPENSTEP)
00502 - (Object<OLBoolBinaryFunction>*) keyEqual;
00503 #else
00504 - (NSObject<OLBoolBinaryFunction>*) keyEqual;
00505 #endif
00506
00515 - (unsigned) maxSize;
00516
00522 - (unsigned) size;
00523
00530 - (void) swap: (OLHashMap*)right;
00531
00541 - (id) valueForKey: (id)key;
00542
00543 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00544
00545 @end
00546
00558 @interface OLHashMultiMap : OLHashMap
00559 {
00560 }
00561
00570 + (id) hashMultiMap;
00571
00588 + (id) hashMultiMapFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00589
00602 + (id) hashMultiMapWithHashMap: (OLHashMap*)right;
00603
00613 - (void) assignKey: (id)key value: (id)value;
00614
00631 - (id) insert: (OLPair*)keyValue;
00632 - (void) insertFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00633
00648 - (BOOL) isEqual: (id)object;
00649
00658 - (id) valueForKey: (id)key;
00659
00660 @end
00661
00662 #endif