00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef COH_WRAPPER_COLLECTIONS_HPP
00017 #define COH_WRAPPER_COLLECTIONS_HPP
00018
00019 #include "coherence/lang.ns"
00020
00021 #include "coherence/util/Collection.hpp"
00022 #include "coherence/util/Iterator.hpp"
00023 #include "coherence/util/List.hpp"
00024 #include "coherence/util/ListIterator.hpp"
00025 #include "coherence/util/Map.hpp"
00026 #include "coherence/util/Muterator.hpp"
00027 #include "coherence/util/Set.hpp"
00028
00029 #include <cstddef>
00030 #include <ostream>
00031
00032 COH_OPEN_NAMESPACE2(coherence,util)
00033
00034
00035
00036
00037
00038
00039
00040
00041 class COH_EXPORT WrapperCollections
00042 {
00043
00044
00045 public:
00046
00047
00048
00049
00050 class COH_EXPORT AbstractWrapperIterator
00051 : public abstract_spec<AbstractWrapperIterator,
00052 extends<Object>,
00053 implements<Muterator> >
00054 {
00055
00056
00057 protected:
00058
00059
00060
00061
00062
00063
00064
00065 AbstractWrapperIterator(Iterator::Handle hiterDelegate);
00066
00067
00068
00069
00070 AbstractWrapperIterator(const AbstractWrapperIterator& that);
00071
00072
00073
00074
00075 public:
00076
00077
00078
00079 virtual bool hasNext() const;
00080
00081
00082
00083
00084 virtual Object::Holder next();
00085
00086
00087
00088
00089 public:
00090
00091
00092
00093 virtual void remove();
00094
00095
00096
00097 public:
00098
00099
00100
00101 virtual void toStream(std::ostream& out) const;
00102
00103
00104
00105
00106 virtual size32_t hashCode() const;
00107
00108
00109
00110
00111 virtual bool equals(Object::View v) const;
00112
00113
00114
00115
00116 protected:
00117
00118
00119
00120
00121
00122
00123
00124
00125 virtual Iterator::Handle getDelegate();
00126
00127
00128
00129
00130
00131
00132 virtual Iterator::View getDelegate() const;
00133
00134
00135
00136 private:
00137
00138
00139
00140 FinalHolder<Iterator> f_ohDelegate;
00141 };
00142
00143
00144
00145
00146
00147
00148 class COH_EXPORT AbstractWrapperListIterator
00149 : public abstract_spec<AbstractWrapperListIterator,
00150 extends<AbstractWrapperIterator>,
00151 implements<ListMuterator> >
00152 {
00153
00154
00155 protected:
00156
00157
00158
00159
00160
00161
00162 AbstractWrapperListIterator(
00163 ListIterator::Handle hIterDelegate);
00164
00165
00166
00167
00168 AbstractWrapperListIterator(
00169 const AbstractWrapperListIterator& that);
00170
00171
00172
00173 public:
00174
00175
00176
00177 virtual bool hasPrevious() const;
00178
00179
00180
00181
00182 virtual Object::Holder previous();
00183
00184
00185
00186
00187 virtual size32_t nextIndex() const;
00188
00189
00190
00191
00192 virtual size32_t previousIndex() const;
00193
00194
00195
00196 public:
00197
00198
00199
00200 virtual void remove();
00201
00202
00203
00204 virtual void add(Object::Holder oh);
00205
00206
00207
00208
00209 virtual void set(Object::Holder oh);
00210
00211
00212
00213 public:
00214
00215
00216
00217 virtual bool hasNext() const;
00218
00219
00220
00221
00222 virtual Object::Holder next();
00223
00224
00225
00226
00227 protected:
00228
00229
00230
00231
00232
00233
00234
00235
00236 virtual ListIterator::Handle getListDelegate();
00237
00238
00239
00240
00241
00242
00243 virtual ListIterator::View getListDelegate() const;
00244
00245
00246
00247
00248 private:
00249
00250
00251
00252 FinalHolder<ListIterator> f_ohDelegate;
00253 };
00254
00255
00256
00257
00258
00259
00260 class COH_EXPORT AbstractWrapperCollection
00261 : public abstract_spec<AbstractWrapperCollection,
00262 extends<Object>,
00263 implements<Collection> >
00264 {
00265
00266
00267 protected:
00268
00269
00270
00271
00272
00273
00274 AbstractWrapperCollection(Collection::Holder ohCollDelegate);
00275
00276
00277
00278
00279 AbstractWrapperCollection(const AbstractWrapperCollection& that);
00280
00281
00282
00283 public:
00284
00285
00286
00287 virtual size32_t size() const;
00288
00289
00290
00291
00292 virtual bool isEmpty() const;
00293
00294
00295
00296
00297 virtual bool contains(Object::View v) const;
00298
00299
00300
00301
00302 virtual Iterator::Handle iterator() const;
00303
00304
00305
00306
00307 virtual Muterator::Handle iterator();
00308
00309
00310
00311
00312 virtual ObjectArray::Handle toArray(
00313 ObjectArray::Handle hao = NULL) const;
00314
00315
00316
00317
00318 virtual bool add(Object::Holder oh);
00319
00320
00321
00322
00323 virtual bool remove(Object::View v);
00324
00325
00326
00327
00328 virtual bool containsAll(Collection::View vc) const;
00329
00330
00331
00332
00333 virtual bool addAll(Collection::View vc);
00334
00335
00336
00337
00338 virtual bool removeAll(Collection::View vc);
00339
00340
00341
00342
00343 virtual bool retainAll(Collection::View vc);
00344
00345
00346
00347
00348 virtual void clear();
00349
00350
00351
00352 public:
00353
00354
00355
00356 virtual void toStream(std::ostream& out) const;
00357
00358
00359
00360
00361 virtual size32_t hashCode() const;
00362
00363
00364
00365
00366 virtual bool equals(Object::View v) const;
00367
00368
00369
00370
00371 virtual bool isImmutable() const;
00372
00373
00374
00375 protected:
00376
00377
00378
00379
00380
00381
00382
00383
00384 virtual Collection::Handle getDelegate();
00385
00386
00387
00388
00389
00390
00391 virtual Collection::View getDelegate() const;
00392
00393
00394
00395 private:
00396
00397
00398
00399 FinalHolder<Collection> f_ohDelegate;
00400 };
00401
00402
00403
00404
00405 class COH_EXPORT AbstractWrapperSet
00406 : public abstract_spec<AbstractWrapperSet,
00407 extends<Object>,
00408 implements<Set> >
00409 {
00410
00411
00412 protected:
00413
00414
00415
00416
00417
00418
00419 AbstractWrapperSet(Set::Holder ohSetDelegate);
00420
00421
00422
00423
00424 AbstractWrapperSet(const AbstractWrapperSet& that);
00425
00426
00427
00428 public:
00429
00430
00431
00432 virtual size32_t size() const;
00433
00434
00435
00436
00437 virtual bool isEmpty() const;
00438
00439
00440
00441
00442 virtual bool contains(Object::View v) const;
00443
00444
00445
00446
00447 virtual Iterator::Handle iterator() const;
00448
00449
00450
00451
00452 virtual Muterator::Handle iterator();
00453
00454
00455
00456
00457 virtual ObjectArray::Handle toArray(
00458 ObjectArray::Handle hao = NULL) const;
00459
00460
00461
00462
00463 virtual bool add(Object::Holder oh);
00464
00465
00466
00467
00468 virtual bool remove(Object::View v);
00469
00470
00471
00472
00473 virtual bool containsAll(Collection::View vc) const;
00474
00475
00476
00477
00478 virtual bool addAll(Collection::View vc);
00479
00480
00481
00482
00483 virtual bool removeAll(Collection::View vc);
00484
00485
00486
00487
00488 virtual bool retainAll(Collection::View vc);
00489
00490
00491
00492
00493 virtual void clear();
00494
00495
00496
00497 public:
00498
00499
00500
00501 virtual void toStream(std::ostream& out) const;
00502
00503
00504
00505
00506 virtual size32_t hashCode() const;
00507
00508
00509
00510
00511 virtual bool equals(Object::View v) const;
00512
00513
00514
00515
00516 virtual bool isImmutable() const;
00517
00518
00519
00520 protected:
00521
00522
00523
00524
00525
00526
00527
00528
00529 virtual Set::Handle getDelegate();
00530
00531
00532
00533
00534
00535
00536 virtual Set::View getDelegate() const;
00537
00538
00539
00540 private:
00541
00542
00543
00544 FinalHolder<Set> f_ohDelegate;
00545 };
00546
00547
00548
00549
00550
00551 class COH_EXPORT AbstractWrapperList
00552 : public abstract_spec<AbstractWrapperList,
00553 extends<Object>,
00554 implements<List> >
00555 {
00556
00557
00558 protected:
00559
00560
00561
00562
00563
00564
00565 AbstractWrapperList(List::Holder ohListDelegate);
00566
00567
00568
00569
00570 AbstractWrapperList(const AbstractWrapperList& that);
00571
00572
00573
00574
00575 public:
00576
00577
00578
00579 virtual bool add(size32_t i, Object::Holder oh);
00580
00581
00582
00583
00584 virtual bool addAll(size32_t i, Collection::View vc);
00585
00586
00587
00588
00589 virtual Object::Holder get(size32_t i) const;
00590
00591
00592
00593
00594 virtual Object::Holder get(size32_t i);
00595
00596
00597
00598
00599 virtual size32_t indexOf(Object::View v) const;
00600
00601
00602
00603
00604 virtual size32_t lastIndexOf(Object::View v) const;
00605
00606
00607
00608
00609 virtual ListIterator::Handle listIterator() const;
00610
00611
00612
00613
00614 virtual ListIterator::Handle listIterator(size32_t index) const;
00615
00616
00617
00618
00619 virtual ListMuterator::Handle listIterator();
00620
00621
00622
00623
00624 virtual ListMuterator::Handle listIterator(size32_t index);
00625
00626
00627
00628
00629 virtual Object::Holder remove(size32_t idx);
00630
00631
00632
00633
00634 virtual Object::Holder set(size32_t idx, Object::Holder oh);
00635
00636
00637
00638
00639 virtual List::Handle subList(size32_t fromIndex,
00640 size32_t toIndex);
00641
00642
00643
00644
00645 virtual List::View subList(size32_t fromIndex,
00646 size32_t toIndex) const;
00647
00648
00649
00650
00651 public:
00652
00653
00654
00655 virtual size32_t size() const;
00656
00657
00658
00659
00660 virtual bool isEmpty() const;
00661
00662
00663
00664
00665 virtual bool contains(Object::View v) const;
00666
00667
00668
00669
00670 virtual bool containsAll(Collection::View vCol) const;
00671
00672
00673
00674
00675 virtual Iterator::Handle iterator() const;
00676
00677
00678
00679
00680 virtual Muterator::Handle iterator();
00681
00682
00683
00684
00685 virtual ObjectArray::Handle toArray(
00686 ObjectArray::Handle hao = NULL) const;
00687
00688
00689
00690
00691 virtual bool add(Object::Holder oh);
00692
00693
00694
00695
00696 virtual bool addAll(Collection::View vCol);
00697
00698
00699
00700
00701 virtual bool remove(Object::View v);
00702
00703
00704
00705
00706 virtual bool removeAll(Collection::View vCol);
00707
00708
00709
00710
00711 virtual bool retainAll(Collection::View vCol);
00712
00713
00714
00715
00716 virtual void clear();
00717
00718
00719
00720
00721 public:
00722
00723
00724
00725 virtual void toStream(std::ostream& out) const;
00726
00727
00728
00729
00730 virtual size32_t hashCode() const;
00731
00732
00733
00734
00735 virtual bool equals(Object::View v) const;
00736
00737
00738
00739
00740 virtual bool isImmutable() const;
00741
00742
00743
00744
00745 protected:
00746
00747
00748
00749
00750
00751
00752
00753
00754 virtual List::Handle getDelegate();
00755
00756
00757
00758
00759
00760
00761 virtual List::View getDelegate() const;
00762
00763
00764
00765
00766 private:
00767
00768
00769
00770 FinalHolder<List> f_ohDelegate;
00771 };
00772
00773
00774
00775
00776 class COH_EXPORT AbstractWrapperMap
00777 : public abstract_spec<AbstractWrapperMap,
00778 extends<Object>,
00779 implements<Map> >
00780 {
00781
00782
00783 protected:
00784
00785
00786
00787
00788
00789
00790 AbstractWrapperMap(Map::Holder ohMapDelegate);
00791
00792
00793
00794
00795 AbstractWrapperMap(const AbstractWrapperMap& that);
00796
00797
00798
00799 public:
00800
00801
00802
00803 virtual size32_t size() const;
00804
00805
00806
00807
00808 virtual bool isEmpty() const;
00809
00810
00811
00812
00813 virtual bool containsKey(Object::View vKey) const;
00814
00815
00816
00817
00818 virtual bool containsValue(Object::View vValue) const;
00819
00820
00821
00822
00823 virtual Object::Holder get(Object::View vKey) const;
00824
00825
00826
00827
00828 virtual Object::Holder get(Object::View vKey);
00829
00830
00831
00832
00833 virtual Object::Holder put(Object::View vKey,
00834 Object::Holder ohValue);
00835
00836
00837
00838
00839 virtual Object::Holder remove(Object::View vKey);
00840
00841
00842
00843
00844 virtual void putAll(Map::View vMap);
00845
00846
00847
00848
00849 virtual void clear();
00850
00851
00852
00853
00854 virtual Set::View keySet() const;
00855
00856
00857
00858
00859 virtual Set::Handle keySet();
00860
00861
00862
00863
00864 virtual Collection::View values() const;
00865
00866
00867
00868
00869 virtual Collection::Handle values();
00870
00871
00872
00873
00874 virtual Set::View entrySet() const;
00875
00876
00877
00878
00879 virtual Set::Handle entrySet();
00880
00881
00882
00883 public:
00884
00885
00886
00887 virtual void toStream(std::ostream& out) const;
00888
00889
00890
00891
00892 virtual size32_t hashCode() const;
00893
00894
00895
00896
00897 virtual bool equals(Object::View v) const;
00898
00899
00900
00901
00902 virtual bool isImmutable() const;
00903
00904
00905
00906 protected:
00907
00908
00909
00910
00911
00912
00913
00914
00915 virtual Map::Handle getDelegate();
00916
00917
00918
00919
00920
00921
00922 virtual Map::View getDelegate() const;
00923
00924
00925
00926 private:
00927
00928
00929
00930 FinalHolder<Map> f_ohDelegate;
00931 };
00932
00933
00934
00935
00936 public:
00937
00938
00939
00940
00941 class COH_EXPORT AbstractWrapperEntry
00942 : public abstract_spec<AbstractWrapperEntry,
00943 extends<Object>,
00944 implements<Map::Entry> >
00945 {
00946
00947
00948 protected:
00949
00950
00951
00952
00953
00954
00955 AbstractWrapperEntry(Map::Entry::Holder ohEntryDelegate);
00956
00957
00958
00959
00960 AbstractWrapperEntry(const AbstractWrapperEntry& that);
00961
00962
00963
00964 public:
00965
00966
00967
00968 virtual Object::View getKey() const;
00969
00970
00971
00972
00973 virtual Object::Holder getValue() const;
00974
00975
00976
00977
00978 virtual Object::Holder getValue();
00979
00980
00981
00982
00983 virtual Object::Holder setValue(Object::Holder ohValue);
00984
00985
00986
00987 public:
00988
00989
00990
00991 virtual void toStream(std::ostream& out) const;
00992
00993
00994
00995
00996 virtual size32_t hashCode() const;
00997
00998
00999
01000
01001 virtual bool equals(Object::View v) const;
01002
01003
01004
01005
01006 virtual bool isImmutable() const;
01007
01008
01009
01010 protected:
01011
01012
01013
01014
01015
01016
01017
01018
01019 virtual Map::Entry::Handle getDelegate();
01020
01021
01022
01023
01024
01025
01026 virtual Map::Entry::View getDelegate() const;
01027
01028
01029
01030 private:
01031
01032
01033
01034 FinalHolder<Map::Entry> f_ohDelegate;
01035 };
01036 };
01037
01038 COH_CLOSE_NAMESPACE2
01039
01040 #endif // COH_WRAPPER_COLLECTIONS_HPP