13 ReverseComparator (
Comparator *reversed) { this->reversed = reversed; }
19 puts (
"--- testHashSet ---");
32 puts (
"--- testHashTable ---");
53 puts (
"--- testVector (1) ---");
71 puts (
"--- testVector (2) ---");
93 for (
int b = 0; b < 2; b++) {
95 printf (
"mustExist = %s\n", mustExist ?
"true" :
"false");
98 printf (
" '%s' -> %d\n", k.chars(), v.
bsearch (&k, mustExist));
101 String *k1 = it.getNext();
102 printf (
" '%s' -> %d\n", k1->
chars(), v.
bsearch (k1, mustExist));
105 strcpy (buf, k1->
chars());
106 strcat (buf,
"-var");
108 printf (
" '%s' -> %d\n", k2.
chars(), v.
bsearch (&k2, mustExist));
118 puts (
"--- testVector (3) ---");
124 printf (
" -> %d\n", v.
bsearch (&k,
false));
126 printf (
" -> %d\n", v.
bsearch (&k,
false));
128 printf (
" -> %d\n", v.
bsearch (&k,
false));
133 puts (
"--- testStackAsQueue ---");
137 for (
int i = 1; i <= 10; i++)
140 while (s.
size () > 0) {
147int main (
int argc,
char *argv[])
Typed version of container::untyped::HashSet.
Typed version of container::untyped::HashTable.
void put(K *key, V *value)
Typed version of container::untyped::Iterator.
Typed version of container::untyped::Stack.
void pushUnder(T *object)
Typed version of container::untyped::Vector.
void put(T *newElement, int newPos=-1)
int bsearch(T *key, bool mustExist, int start, int end, object::Comparator *comparator=&object::standardComparator)
void sort(object::Comparator *comparator=&object::standardComparator)
int insertSorted(T *newElement, object::Comparator *comparator=&object::standardComparator)
Used for other orders as the one defined by Comparable.
virtual int compare(Object *o1, Object *o2)=0
Compare two objects o1 and o2.
An object::Object wrapper for int's.
This is the base class for many other classes, which defines very common virtual methods.
const char * toString()
Use object::Object::intoStringBuffer to return a textual representation of the object.
An object::Object wrapper for strings (char*).
This namespace provides thin wrappers, implemented as C++ templates, to gain type-safety.
Here, some common classes (or interfaces) are defined, to standardize the access to other classes.
StandardComparator standardComparator