|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ObjectConsecutiveMap
public class ConsecutiveMap
Implements a simple mapping, from object keys to integers. Each new key is assigned a consecutive number, starting at zero.
| Field Summary | |
|---|---|
private Vector |
inOrder
Vector of all unique keys, in order of addition |
private HashMap |
map
Mapping used to keep the unique set of keys |
| Constructor Summary | |
|---|---|
ConsecutiveMap()
|
|
| Method Summary | |
|---|---|
int |
get(Object key)
Retrieve the namecode for the given key. |
Object[] |
getArray()
Retrieve an array of all the keys, ordered by consecutive number. |
boolean |
has(Object key)
Check if the given key is present in the map yet. |
int |
put(Object key)
If the key is already present in the map, return its assigned number. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private HashMap map
private Vector inOrder
| Constructor Detail |
|---|
public ConsecutiveMap()
| Method Detail |
|---|
public int put(Object key)
key - The key to look up
public int get(Object key)
public boolean has(Object key)
public Object[] getArray()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||