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(QUEUE_OL_GUARD)
00044 #define QUEUE_OL_GUARD
00045
00046 #include <ObjectiveLib/Functional.h>
00047 #include <ObjectiveLib/Iterator.h>
00048
00049 @class OLDeque;
00050 @class OLVector;
00051
00068 @interface OLQueue :
00069 #if defined(OL_NO_OPENSTEP)
00070 Object <OLStreamable>
00071 #else
00072 NSObject <OLStreamable, NSCopying, NSCoding>
00073 #endif
00074 {
00075 @protected
00079 OLDeque* deque;
00080 }
00081
00090 + (id) queue;
00091
00102 + (id) queueWithQueue: (OLQueue*)right;
00103
00107
00113 - (id) init;
00114
00115 #if !defined(OL_NO_OPENSTEP)
00116
00126 - (id) initWithCoder: (NSCoder*)decoder;
00127 #endif
00128
00129 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00130
00138 - (id) initWithQueue: (OLQueue*)queue;
00139
00143 #if defined(OL_NO_OPENSTEP)
00144 - (id) free;
00145 #else
00146 - (void) dealloc;
00147 #endif
00148
00149
00157 - (id) back;
00158
00168 - (int) compare: (id)other;
00169
00170 #if defined(OL_NO_OPENSTEP)
00171
00176 - (id) copy;
00177 #else
00178
00184 - (id) copyWithZone: (NSZone*)zone;
00185 #endif
00186
00192 - (BOOL) empty;
00193
00194 #if !defined(OL_NO_OPENSTEP)
00195
00201 - (void) encodeWithCoder: (NSCoder*)encoder;
00202 #endif
00203
00212 - (id) front;
00213
00222 - (BOOL) isEqual: (id)object;
00223
00230 - (void) pop;
00231
00238 - (void) push: (id)object;
00239
00245 - (unsigned) size;
00246
00247 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00248
00249 @end
00250
00276 @interface OLPriorityQueue :
00277 #if defined(OL_NO_OPENSTEP)
00278 Object <OLStreamable>
00279 #else
00280 NSObject <OLStreamable, NSCopying, NSCoding>
00281 #endif
00282 {
00283 @protected
00287 OLVector* vector;
00288
00292 OLStreamableFunctor<OLBoolBinaryFunction>* predicate;
00293 }
00294
00304 + (id) priorityQueue;
00305
00318 + (id) priorityQueueFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00319
00333 + (id) priorityQueueFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last predicate: (OLStreamableFunctor<OLBoolBinaryFunction>*)pred;
00334
00345 + (id) priorityQueueWithPredicate: (OLStreamableFunctor<OLBoolBinaryFunction>*)pred;
00346
00357 + (id) priorityQueueWithPriorityQueue: (OLPriorityQueue*)right;
00358
00362
00368 - (id) init;
00369
00379 - (id) initFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00380
00397 - (id) initFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last predicate: (OLStreamableFunctor<OLBoolBinaryFunction>*)pred;
00398
00399 #if !defined(OL_NO_OPENSTEP)
00400
00410 - (id) initWithCoder: (NSCoder*)decoder;
00411 #endif
00412
00413 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00414
00422 - (id) initWithPredicate: (OLStreamableFunctor<OLBoolBinaryFunction>*)pred;
00423
00431 - (id) initWithPriorityQueue: (OLPriorityQueue*)right;
00432
00436 #if defined(OL_NO_OPENSTEP)
00437 - (id) free;
00438 #else
00439 - (void) dealloc;
00440 #endif
00441
00442
00452 - (int) compare: (id)other;
00453
00454 #if defined(OL_NO_OPENSTEP)
00455
00460 - (id) copy;
00461 #else
00462
00468 - (id) copyWithZone: (NSZone*)zone;
00469 #endif
00470
00476 - (BOOL) empty;
00477
00478 #if !defined(OL_NO_OPENSTEP)
00479
00485 - (void) encodeWithCoder: (NSCoder*)encoder;
00486 #endif
00487
00496 - (BOOL) isEqual: (id)object;
00497
00504 - (void) pop;
00505
00512 - (void) push: (id)object;
00513
00519 - (unsigned) size;
00520
00527 - (id) top;
00528
00529 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00530
00531 @end
00532
00533 #endif