|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gshute.util.ListDictionary
A ListDictionary is an implementation of the Dictionary interface using an ArrayList implementation.
Field Summary | |
protected java.util.Comparator |
comparator
comparator is the comparator for keys in this dictionary. |
protected java.util.ArrayList |
entries
entries is the list of entries for this dictionary. |
protected Selector |
selector
selector is the keys selector for this dictionary. |
Constructor Summary | |
ListDictionary(java.util.Comparator c,
Selector s)
new ListDictionary(c, s) returns a dictionary that uses c as its key comparator and s as its key selector. |
Method Summary | |
void |
add(java.lang.Object dat)
dict.add(k, dat) adds an entry with data dat and key k to dict. |
protected int |
addIndex(java.lang.Object k)
addIndex(k) returns the index where an entry with key k should be added. |
void |
clear()
dict.clear() removes all entries from dict. |
java.lang.Object |
dataFor(java.lang.Object k)
dict.dataFor(k) returns the data for key k in dict. |
protected int |
geqIndex(java.lang.Object k)
geqIndex(k) returns the index of the first entry with key greater than or equal to k or entries.size() if there is no such entry. |
java.lang.Object |
getKey(java.lang.Object dat)
dict.getKey(dat) returns the key that dict uses for dat. |
boolean |
isKey(java.lang.Object k)
dict.isKey(k) returns true if there is an entry with key k in dict. |
java.util.Iterator |
iterator()
dict.iterator() returns an iterator for all of the entries in dict. |
java.util.Iterator |
iterator(java.lang.Object kLo)
dict.iterator(Object kLo) returns an iterator for the entries in dict whose key is at least kLo. |
java.util.Iterator |
iterator(java.lang.Object kLo,
java.lang.Object kHi)
dict.iterator(Object kLo, Object kHi) returns an iterator for the entries in dict whose key is at least kLo and less than kHi. |
void |
remove(java.lang.Object k)
dict.remove(k) removes the entry for key k from dict. |
protected int |
searchIndex(java.lang.Object k)
searchIndex(k) returns the index of the entry with key k or -1 if it does not exist. |
int |
size()
dict.size() returns the number of entries in dict. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.util.ArrayList entries
protected java.util.Comparator comparator
protected Selector selector
Constructor Detail |
public ListDictionary(java.util.Comparator c, Selector s)
Method Detail |
public boolean isKey(java.lang.Object k)
public java.lang.Object getKey(java.lang.Object dat)
public void add(java.lang.Object dat)
Precondition: dict.isKey(k) is false.
public java.lang.Object dataFor(java.lang.Object k)
Precondition: dict.isKey(k) is true.
public void remove(java.lang.Object k)
Precondition: dict.isKey(k) is true.
public int size()
public void clear()
public java.util.Iterator iterator()
public java.util.Iterator iterator(java.lang.Object kLo)
public java.util.Iterator iterator(java.lang.Object kLo, java.lang.Object kHi)
protected int addIndex(java.lang.Object k)
protected int searchIndex(java.lang.Object k)
protected int geqIndex(java.lang.Object k)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |