00001 00041 #ifndef _SORTEDARRAYLIST_H 00042 #define _SORTEDARRAYLIST_H 00043 00044 #include "sortedlist.h" 00045 #include "arraylist.h" 00046 00047 using std::ostream; 00048 00049 namespace container { 00050 00054 class SortedArrayList: public SortedList, public ArrayList { 00055 public: 00056 00057 const static Info * const TYPE_INFO; 00058 00059 SortedArrayList(); 00060 SortedArrayList(const SortedArrayList& pattern); 00061 virtual ~SortedArrayList(); 00062 00063 private: 00064 00065 /********************* SortedArrayList Methods (private) *********************/ 00066 00076 bool binarySearch(const Entity &key, int& index) const; 00077 00078 protected: 00079 00080 /********************* SortedList Methods (protected) *********************/ 00081 00082 virtual bool insertSorted_impl(Entity* entity); 00083 00084 /********************* List Methods (public) *********************/ 00085 00094 virtual void locateEntity(const Entity &key, int &index, Entity* &entity); 00095 00096 /********************* List Methods (protected) *********************/ 00097 00098 virtual bool add_impl(Entity* entity); 00099 00100 public: 00101 00102 /********************* Object Methods (public) *********************/ 00103 00104 virtual ostream& renderState(ostream& os) const; 00105 00106 virtual const Info* typeInfo() const; 00107 00108 virtual Object* clone(bool deepCopy = false) const; 00109 00110 }; 00111 00112 } // namespace container 00113 00114 #endif /* _SORTEDARRAYLIST_H */