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(ITERATOR_OL_GUARD)
00044 #define ITERATOR_OL_GUARD
00045
00046 #include <ObjectiveLib/Pair.h>
00047
00128 @interface OLIterator :
00129 #if defined(OL_NO_OPENSTEP)
00130 Object
00131 #else
00132 NSObject <NSCopying>
00133 #endif
00134 {
00135 }
00136
00149 + (void) advanceIterator: (OLIterator*)itor distance: (int)count;
00150
00164 + (unsigned) distanceFrom: (OLIterator*)first to: (OLIterator*)last;
00165
00174 - (id) assign: (id)object;
00175
00176 #if defined(OL_NO_OPENSTEP)
00177
00182 - (id) copy;
00183 #else
00184
00190 - (id) copyWithZone: (NSZone*)zone;
00191 #endif
00192
00198 - (id) dereference;
00199
00206 - (BOOL) isEqual: (id)object;
00207
00208 @end
00209
00218 @interface OLForwardIterator : OLIterator
00219 {
00220 }
00221
00228 - (id) advance;
00229
00230 @end
00231
00240 @interface OLBidirectionalIterator : OLForwardIterator
00241 {
00242 }
00243
00250 - (id) reverse;
00251
00252 @end
00253
00262 @interface OLRandomAccessIterator : OLBidirectionalIterator
00263 {
00264 }
00265
00273 - (id) advanceBy: (int)count;
00274
00286 - (int) difference: (OLRandomAccessIterator*)other;
00287
00288 @end
00289
00300 @interface OLReverseBidiIterator : OLBidirectionalIterator
00301 {
00302 @protected
00306 OLBidirectionalIterator* current;
00307 }
00308
00312
00313
00320 - (id) initWithIterator: (OLBidirectionalIterator*)itor;
00321
00325 #if defined(OL_NO_OPENSTEP)
00326 - (id) free;
00327 #else
00328 - (void) dealloc;
00329 #endif
00330
00331
00332
00339 - (id) advance;
00340
00341 - (id) assign: (id)object;
00342 #if defined(OL_NO_OPENSTEP)
00343 - (id) copy;
00344 #else
00345 - (id) copyWithZone: (NSZone*)zone;
00346 #endif
00347 - (id) dereference;
00348 - (BOOL) isEqual: (id)object;
00349
00356 - (id) reverse;
00357
00358 @end
00359
00370 @interface OLReverseRandomIterator : OLReverseBidiIterator
00371 {
00372 }
00373
00383 - (id) advanceBy: (int)count;
00384 #if defined(OL_NO_OPENSTEP)
00385 - (id) copy;
00386 #else
00387 - (id) copyWithZone: (NSZone*)zone;
00388 #endif
00389 - (BOOL) isEqual: (id)object;
00390
00391 @end
00392
00404 @protocol OLBackInserter
00405
00413 - (BOOL) isEqual: (id)object;
00414
00422 - (void) pushBack: (id)object;
00423
00424 @end
00425
00435 @interface OLBackInsertIterator : OLForwardIterator
00436 {
00437 @protected
00441 id<OLBackInserter> container;
00442 }
00443
00447
00458 - (id) initWithBackInserter: (id<OLBackInserter>)cnr;
00459
00460
00467 - (id) assign: (id)object;
00468 #if defined(OL_NO_OPENSTEP)
00469 - (id) copy;
00470 #else
00471 - (id) copyWithZone: (NSZone*)zone;
00472 #endif
00473 - (BOOL) isEqual: (id)object;
00474
00475 @end
00476
00488 @protocol OLFrontInserter
00489
00497 - (BOOL) isEqual: (id)object;
00498
00506 - (void) pushFront: (id)object;
00507
00508 @end
00509
00519 @interface OLFrontInsertIterator : OLForwardIterator
00520 {
00521 @protected
00525 id<OLFrontInserter> container;
00526 }
00527
00531
00542 - (id) initWithFrontInserter: (id<OLFrontInserter>)cnr;
00543
00544
00551 - (id) assign: (id)object;
00552 #if defined(OL_NO_OPENSTEP)
00553 - (id) copy;
00554 #else
00555 - (id) copyWithZone: (NSZone*)zone;
00556 #endif
00557 - (BOOL) isEqual: (id)object;
00558
00559 @end
00560
00571 @protocol OLInserter
00572
00580 - (OLIterator*) insertAt: (OLIterator*)where value: (id)object;
00581
00589 - (BOOL) isEqual: (id)object;
00590
00591 @end
00592
00603 @interface OLInsertIterator : OLForwardIterator
00604 {
00605 @protected
00609 id<OLInserter> container;
00610
00615 OLForwardIterator* iterator;
00616 }
00617
00621
00633 - (id) initWithInserter: (id<OLInserter>)cnr iterator: (OLForwardIterator*)itor;
00637 #if defined(OL_NO_OPENSTEP)
00638 - (id) free;
00639 #else
00640 - (void) dealloc;
00641 #endif
00642
00643
00651 - (id) assign: (id)object;
00652 #if defined(OL_NO_OPENSTEP)
00653 - (id) copy;
00654 #else
00655 - (id) copyWithZone: (NSZone*)zone;
00656 #endif
00657 - (BOOL) isEqual: (id)object;
00658
00659 @end
00660
00666 @class OLTreeNode;
00667
00679 @interface OLAssociativeIterator : OLBidirectionalIterator
00680 {
00681 @private
00687 OLTreeNode* node;
00688 }
00689
00690 - (id) advance;
00691 - (id) assign: (id)object;
00692 #if defined(OL_NO_OPENSTEP)
00693 - (id) copy;
00694 #else
00695 - (id) copyWithZone: (NSZone*)zone;
00696 #endif
00697 - (id) dereference;
00698 - (BOOL) isEqual: (id)object;
00699 - (id) reverse;
00700
00701 @end
00702
00714 @interface OLArrayIterator : OLRandomAccessIterator
00715 {
00716 @protected
00720 id* current;
00721 }
00722
00730 + (OLPair*) pairWithPointer: (id*)p1 andPointer: (id*)p2;
00731
00739 + (OLPair*) pairWithPointer: (id*)p distance: (unsigned)count;
00740
00744
00753 - (id) initWithPointer: (id*)ptr;
00754
00755
00756 - (id) advance;
00757 - (id) advanceBy: (int)count;
00758 - (id) assign: (id)object;
00759 #if defined(OL_NO_OPENSTEP)
00760 - (id) copy;
00761 #else
00762 - (id) copyWithZone: (NSZone*)zone;
00763 #endif
00764 - (id) dereference;
00765 - (int) difference: (OLRandomAccessIterator*)other;
00766 - (BOOL) isEqual: (id)object;
00767 - (id) reverse;
00768
00769 @end
00770
00774 struct _OLHashTableNode;
00775
00780 @class OLHashTable;
00781
00792 @interface OLHashIterator : OLForwardIterator
00793 {
00794 @private
00799 OLHashTable* table;
00800
00805 struct _OLHashTableNode* current;
00806 }
00807
00808 - (id) advance;
00809 - (id) assign: (id)object;
00810 #if defined(OL_NO_OPENSTEP)
00811 - (id) copy;
00812 #else
00813 - (id) copyWithZone: (NSZone*)zone;
00814 #endif
00815 - (id) dereference;
00816 - (BOOL) isEqual: (id)object;
00817
00818 @end
00819
00820 #endif