|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.javatest.util.OrderedTwoWayTable
public class OrderedTwoWayTable
A map-like structure which has two side-by-side ordered sets of Objects in pairs. This is basically a map structure except that it is always ordered and has a less strict an idea of key and value. The terms key and value are still used to differentiate data from the two sets. The primary advantage to using this class is that you can do lookups either by key or value, in case where translation in both directions is necessary.
Constructor Summary | |
---|---|
OrderedTwoWayTable()
|
Method Summary | |
---|---|
protected int |
findIndex(java.util.Vector data,
java.lang.Object target)
Get the index of the target in the table. |
java.lang.Object |
getKeyAt(int index)
Get the key at the given index. |
int |
getKeyIndex(java.lang.Object key)
Get the position of the key within the table. |
int |
getSize()
Get the number of pairs in the table. |
java.lang.Object |
getValueAt(int index)
Get the value at the given index. |
int |
getValueIndex(java.lang.Object value)
Get the position of a value within the table. |
void |
put(java.lang.Object key,
java.lang.Object value)
Put an object in the table. |
void |
remove(int index)
Remove the object at a specified index. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OrderedTwoWayTable()
Method Detail |
---|
public void put(java.lang.Object key, java.lang.Object value)
key
- the key for this objectvalue
- the object to be stored in the tablepublic int getKeyIndex(java.lang.Object key)
key
- the key whose position is required
public int getValueIndex(java.lang.Object value)
value
- the value whose position is required
public java.lang.Object getValueAt(int index)
index
- the index of the required value
public java.lang.Object getKeyAt(int index)
index
- the index of the given key
public int getSize()
public void remove(int index)
index
- the index of the entry to be removed.protected int findIndex(java.util.Vector data, java.lang.Object target)
data
- the vector in which to searchtarget
- the object to search for
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |