00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef COH_READ_ONLY_MULTI_LIST_HPP
00017 #define COH_READ_ONLY_MULTI_LIST_HPP
00018
00019 #include "coherence/lang.ns"
00020
00021 #include "coherence/util/AbstractList.hpp"
00022 #include "coherence/util/Collection.hpp"
00023 #include "coherence/util/Iterator.hpp"
00024 #include "coherence/util/List.hpp"
00025 #include "coherence/util/Set.hpp"
00026 #include "coherence/util/WrapperCollections.hpp"
00027
00028
00029 COH_OPEN_NAMESPACE2(coherence,util)
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 class COH_EXPORT ReadOnlyMultiList
00050 : public class_spec<ReadOnlyMultiList,
00051 extends<AbstractList>,
00052 implements<Set> >
00053 {
00054 friend class factory<ReadOnlyMultiList>;
00055
00056
00057
00058 public:
00059 typedef this_spec::Handle Handle;
00060 typedef this_spec::View View;
00061 typedef this_spec::Holder Holder;
00062
00063
00064
00065
00066 protected:
00067
00068
00069
00070
00071
00072
00073 ReadOnlyMultiList(ObjectArray::View vaao);
00074
00075 private:
00076
00077
00078
00079 ReadOnlyMultiList(const ReadOnlyMultiList&);
00080
00081
00082
00083
00084 public:
00085
00086
00087
00088
00089
00090 virtual List::Handle getList();
00091
00092
00093
00094
00095
00096
00097 virtual List::View getList() const;
00098
00099
00100
00101
00102
00103
00104 virtual Set::Handle getSet();
00105
00106
00107
00108
00109
00110
00111 virtual Set::View getSet() const;
00112
00113
00114
00115
00116 public:
00117
00118
00119
00120 virtual size32_t size() const;
00121
00122
00123
00124
00125 virtual Object::Holder get(size32_t i) const;
00126 using List::get;
00127
00128
00129
00130
00131 virtual Object::Holder set(size32_t i, Object::Holder oh);
00132
00133
00134
00135
00136 virtual bool add(size32_t i, Object::Holder oh);
00137 using Collection::add;
00138
00139
00140
00141
00142 virtual bool addAll(size32_t i, Collection::View vColl);
00143 using Collection::addAll;
00144
00145
00146
00147
00148 virtual Object::Holder remove(size32_t i);
00149 using Collection::remove;
00150
00151
00152
00153
00154 virtual size32_t indexOf(Object::View v) const;
00155
00156
00157
00158
00159 virtual size32_t lastIndexOf(Object::View v) const;
00160
00161
00162
00163
00164 virtual bool contains(Object::View v) const;
00165
00166
00167
00168
00169 virtual ObjectArray::Handle toArray(ObjectArray::Handle ha = NULL) const;
00170
00171
00172
00173
00174 virtual Iterator::Handle iterator() const;
00175 using Collection::iterator;
00176
00177
00178
00179
00180 virtual Muterator::Handle iterator();
00181 using List::iterator;
00182
00183
00184
00185
00186 virtual ListIterator::Handle listIterator(size32_t i = 0) const;
00187
00188
00189
00190
00191 virtual ListMuterator::Handle listIterator(size32_t i = 0);
00192
00193
00194
00195
00196 virtual List::View subList(size32_t iFrom, size32_t iTo) const;
00197
00198
00199
00200
00201 virtual List::Handle subList(size32_t iFrom, size32_t iTo);
00202
00203
00204
00205
00206 public:
00207
00208
00209
00210 virtual bool equals(Object::View v) const;
00211
00212
00213
00214
00215 public:
00216
00217
00218
00219
00220
00221
00222
00223 static size32_t calculateTotalLength(ObjectArray::View vaao);
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239 static ObjectArray::Handle flatten(ObjectArray::View vaaoFrom,
00240 size32_t cTotal, ObjectArray::Handle haoTo = NULL);
00241
00242 protected:
00243
00244
00245
00246 template<class T> static List::Holder subList(T, size32_t iFrom,
00247 size32_t iTo);
00248
00249
00250
00251
00252 protected:
00253
00254
00255
00256
00257 class COH_EXPORT ListView
00258 : public class_spec<ListView,
00259 extends<WrapperCollections::AbstractWrapperList> >
00260 {
00261 friend class factory<ListView>;
00262
00263
00264
00265 protected:
00266
00267
00268
00269 ListView(ReadOnlyMultiList::Holder ohList);
00270
00271
00272
00273
00274
00275
00276
00277 virtual bool equals(Object::View v) const;
00278
00279
00280
00281
00282 virtual size32_t hashCode() const;
00283 };
00284
00285
00286
00287
00288 protected:
00289
00290
00291
00292
00293 class COH_EXPORT SetView
00294 : public class_spec<SetView,
00295 extends<WrapperCollections::AbstractWrapperSet> >
00296 {
00297 friend class factory<SetView>;
00298
00299
00300
00301 protected:
00302
00303
00304
00305 SetView(ReadOnlyMultiList::Holder ohSet);
00306
00307
00308
00309
00310
00311
00312
00313 virtual bool equals(Object::View v) const;
00314
00315
00316
00317
00318 virtual size32_t hashCode() const;
00319 };
00320
00321
00322
00323
00324 private:
00325
00326
00327
00328 FinalView<ObjectArray> f_vaao;
00329
00330
00331
00332
00333
00334
00335 mutable FinalView<Set> f_vSet;
00336
00337
00338
00339
00340 const size32_t m_cTotal;
00341 };
00342
00343 COH_CLOSE_NAMESPACE2
00344
00345 #endif // COH_READ_ONLY_MULTI_LIST_HPP