![]() |
The Simons
|
00001 00002 // 00003 // SCL : Simons Component Library 00004 // 00006 // 00007 // Filename: Unordered.h 00008 // Contents: Unordered class 00009 // Author: Anthony J H Simons 00010 // Revised: 1 November 2005 00011 00012 // This software is distributed free in the hope that others will 00013 // find it useful. However, it comes WITHOUT ANY WARRANTY. No 00014 // liability can be accepted for software failure, merchantability 00015 // or fitness for a particular purpose. You can redistribute this 00016 // software in its original form, or in a modified form, provided 00017 // that this disclaimer is retained in the file banner. 00018 00019 #ifndef SCL_UNORDERED 00020 #define SCL_UNORDERED 00021 00022 #include "Collection.h" // Include the superclass type 00023 #include "UnorderedID.h" // Include the pointer type 00024 00039 class Unordered : public Collection { 00040 private: 00041 enum Constants { TABLE = 27 }; 00042 static Natural primes[TABLE]; 00043 protected: 00044 Natural nextCapacity(Natural) const; 00045 Unordered(const Unordered&); 00046 public: 00047 Unordered(); 00048 virtual ~Unordered(); 00049 virtual Natural hash() const; 00050 virtual Order compare(ObjectID) const; 00051 Order compare(UnorderedID) const; 00052 virtual Natural count(ObjectID) const; 00053 virtual ObjectID find(ObjectID) const; 00054 virtual Void remove(ObjectID); 00055 Void removeAll(CollectionID); 00056 virtual Void retainAll(CollectionID); 00057 }; 00058 00060 00063 inline UnorderedID::UnorderedID() {} 00064 00066 inline UnorderedID::~UnorderedID() {} 00067 00071 inline UnorderedID::UnorderedID(const Null* null) : 00072 CollectionID(null) {} 00073 00077 inline UnorderedID::UnorderedID(const Unordered* unordered) : 00078 CollectionID(unordered) {} 00079 00083 inline UnorderedID::UnorderedID(const UnorderedID& pointer) : 00084 CollectionID(pointer) {} 00085 00089 inline UnorderedID& UnorderedID::operator=(const Unordered* unordered) { 00090 assign(unordered); 00091 return *this; 00092 } 00093 00098 inline UnorderedID& UnorderedID::operator=(const UnorderedID& pointer) { 00099 assign(pointer); 00100 return *this; 00101 } 00102 00103 00104 #endif 00105