|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectDictionary<K,D>
K - The type of the keys.D - The type of the data.public abstract class Dictionary<K,D>
A dictionary provides some default implementations of methods that are
required for the Map-interface. Only Map.insert(Object, Object),
Map.delete(Object), and Map.iterator() have to be implemented
for subclasses of Dictionary, however, other methods may also be implemented
to improve efficiency.
| Constructor Summary | |
|---|---|
Dictionary()
|
|
| Method Summary | |
|---|---|
Array<K> |
array()
Converts this map into an array of all keys. |
abstract void |
delete(K k)
Removes the entry which stores the data for the key k. |
D |
find(K k)
Linear time implementation of Map.find(Object). |
abstract void |
insert(K k,
D d)
Associates the data d to the key k in this map. |
boolean |
iselement(K k)
Linear time implementation of Map.iselement(Object). |
boolean |
isempty()
Constant time implementation of Map.isempty() provided
that creation of an Iterator with iterator() costs only constant time. |
abstract Iterator<K,D> |
iterator()
Creates a new iterator over all associations between keys and data. |
void |
print()
Prints the map to stdout |
SimpleIterator<K> |
simpleiterator()
Creates a new iterator only over the keys. |
int |
size()
Linear time implementation of Map.size() |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Dictionary()
| Method Detail |
|---|
public abstract void insert(K k,
D d)
Map
insert in interface Map<K,D>k - The key to store.d - The data associated to the key k.public abstract void delete(K k)
Map
delete in interface Map<K,D>k - The key to delete with its associated data.public abstract Iterator<K,D> iterator()
Map
iterator in interface Map<K,D>Iterator over all keys with
associated data.public D find(K k)
Map.find(Object).
find in interface Map<K,D>k - The key under which the data is stored.
public boolean iselement(K k)
Map.iselement(Object).
iselement in interface Map<K,D>k - The key to look for.
public boolean isempty()
Map.isempty() provided
that creation of an Iterator with iterator() costs only constant time.
isempty in interface Map<K,D>public int size()
Map.size()
size in interface Map<K,D>public SimpleIterator<K> simpleiterator()
Map
simpleiterator in interface Map<K,D>SimpleIterator over all keys.public Array<K> array()
Map
array in interface Map<K,D>public void print()
Map
print in interface Map<K,D>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||