|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gshute.util.ListTable
A ListTable is an implementation of the Table interface using an ArrayList implementation.
Inner classes inherited from class gshute.util.Table |
Table.Entry |
Field Summary | |
protected java.util.Comparator |
comparator
comparator is the comparator for keys in this table. |
protected java.util.ArrayList |
entries
entries is the list of entries for this table. |
Constructor Summary | |
ListTable(java.util.Comparator c)
new ListTable(c) returns a table that uses c as its key comparator. |
Method Summary | |
void |
add(java.lang.Object k,
java.lang.Object dat)
tbl.add(k, dat) adds an entry with data dat and key k to tbl. |
protected int |
addIndex(java.lang.Object k)
addIndex(k) returns the index where an entry with key k should be added. |
void |
clear()
tbl.clear() removes all entries from tbl. |
java.lang.Object |
data(java.lang.Object k)
tbl.data(k) returns the data for key k in tbl. |
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. |
boolean |
isKey(java.lang.Object k)
tbl.isKey(k) returns true if there is an entry with key k in tbl. |
java.util.Iterator |
iterator()
tbl.iterator() returns an iterator for all of the entries in tbl. |
java.util.Iterator |
iterator(java.lang.Object kLo)
tbl.iterator(Object kLo) returns an iterator for the entries in tbl whose key is at least kLo. |
java.util.Iterator |
iterator(java.lang.Object kLo,
java.lang.Object kHi)
tbl.iterator(Object kLo, Object kHi) returns an iterator for the entries in tbl whose key is at least kLo and less than kHi. |
void |
remove(java.lang.Object k)
tbl.remove(k) removes the entry for key k from tbl. |
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()
tbl.size() returns the number of entries in tbl. |
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
Constructor Detail |
public ListTable(java.util.Comparator c)
Method Detail |
public boolean isKey(java.lang.Object k)
isKey
in interface Table
public void add(java.lang.Object k, java.lang.Object dat)
Precondition: tbl.isKey(k) is false.
add
in interface Table
public java.lang.Object data(java.lang.Object k)
Precondition: tbl.isKey(k) is true.
data
in interface Table
public void remove(java.lang.Object k)
Precondition: tbl.isKey(k) is true.
remove
in interface Table
public int size()
size
in interface Table
public void clear()
clear
in interface Table
public java.util.Iterator iterator()
iterator
in interface Table
public java.util.Iterator iterator(java.lang.Object kLo)
iterator
in interface Table
public java.util.Iterator iterator(java.lang.Object kLo, java.lang.Object kHi)
iterator
in interface Table
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 |