00001
00002
00003
00004
00005
00006
00007
00008 #ifndef _SK_UTIL_COLLECTION_
00009 #define _SK_UTIL_COLLECTION_
00010
00011 #include <sk/util/Object.h>
00012 #include <sk/util/Holder.hxx>
00013 #include <sk/util/Selector.h>
00014 #include <sk/util/Processor.h>
00015
00016 namespace sk {
00017 namespace util {
00018 template<class T>
00019 class Collection
00020 : public virtual sk::util::Object
00021 {
00022 public:
00023 virtual T& get(const Selector<T>& selector) const = 0;
00024 virtual void forEach(const Processor<T>& procesor) const = 0;
00025 virtual bool find(sk::util::Holder<T>& holder, const Selector<T>& selector) const = 0;
00026
00028 virtual bool isEmpty() const = 0;
00029
00031 virtual int size() const = 0;
00032
00034 virtual bool contains(const T& object) const = 0;
00035
00038 virtual bool contains(const Selector<T>& selector) const = 0;
00039
00042 virtual bool containsAll(const Collection<T>& other) const = 0;
00043
00046 virtual bool add(T& object) = 0;
00047
00050 virtual bool add(T* object) = 0;
00051
00054 virtual bool addAll(const Collection<T>& other) = 0;
00055
00058 virtual bool moveAll(Collection<T>& other) = 0;
00059
00061 virtual void clear() = 0;
00062
00065 virtual bool remove(const T& object) = 0;
00066
00069 virtual bool remove(const Selector<T>& selector) = 0;
00070
00071 virtual T* cutoff(const T& object) = 0;
00072 virtual T* cutoff(const Selector<T>& selector) = 0;
00073 virtual T* release(const T& object) = 0;
00074 virtual T* release(const Selector<T>& selector) = 0;
00075
00078 virtual bool removeAll(const Collection<T>& other) = 0;
00079
00082 virtual bool removeAll(const Selector<T>& selector) = 0;
00083
00086 virtual bool retainAll(const Collection<T>& other) = 0;
00087
00090 virtual bool retainAll(const Selector<T>& selector) = 0;
00091 };
00092 }
00093 }
00094
00095 #endif