|
OpMath | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--com.opmath.util.datastruct.OrderedHashtable
A functional extension to java.util.Hashtable.
OrderedHashtable is a utility class, providing specialized Hashtable semantics.
The class extends Hashtable so as to to retain the order in which entries were added to the
table. The OrderedHashtable's data storage is provided by a java.util.Hashtable.
Thus, OrderedHashtable retains the efficiency of its superclass.
OrderedHashtable also provides for normalization of its keys. All methods which use
a key preprocess their key value using the protected method normalized(Object). In the case of
OrderedHashtable, normalized(Object) is a null method - the key argument is returned
'as is'. However, any subclass of OrderedHashtable is free to specialise
normalized(Object) in any way.
Copyright: (c) 2002 The Open Math Company Limited
The Terms of Distribution of this software are stipulated in the javadoc Overview for this project.
| Constructor Summary | |
OrderedHashtable()
Constructs a new OrderedHashtable instance. |
|
OrderedHashtable(ComparableList newKeys)
Constructs a new OrderedHashtable instance. |
|
OrderedHashtable(String[] newStrKeys)
Constructs a new OrderedHashtable instance. |
|
| Method Summary | |
boolean |
containsKey(Object key)
Tests whether the key is known to the receiving container. |
Enumeration |
elements()
returns an enumeration of the values in this OrderedHashtable instance. |
Object |
get(Object key)
|
Enumeration |
keys()
Returns an enumeration of the keys in this OrderedHashtable instance. |
protected Object |
normalized(Object key)
The skeleton normalization method. |
Object |
put(Object key,
Object value)
Maps the specified key to the specified value in this OrderedHashtable. |
void |
putAll(Map t)
Copies all of the mappings from the specified Map to this OrderedHashtable These mappings
will replace any mappings that this OrderedHashtable had for any of the keys currently
in the specified Map. |
Object |
remove(Object key)
Removes the key (and its corresponding value) from this OrderedHashtable . |
String |
toString()
Returns a new String, detailing the contents of this OrderedHashtable instance. |
| Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsValue, entrySet, equals, hashCode, isEmpty, keySet, rehash, size, values |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public OrderedHashtable()
OrderedHashtable instance. Its entries will be added later.
public OrderedHashtable(ComparableList newKeys)
OrderedHashtable instance. Its entries are identified by keys contained
in the ComparableList.
NOTE: Multiple instances of the same key are discarded.
newKeys - the ComparableList supplying the keys.public OrderedHashtable(String[] newStrKeys)
OrderedHashtable instance. The entries are identified by keys contained
in the String array.
NOTE: Multiple instances of the same key are discarded.
newStrKeys - the String[] supplying the keys.| Method Detail |
protected Object normalized(Object key)
OrderedHashtable.
key - the Object key to be normalized.
public Enumeration keys()
OrderedHashtable instance. Use the
Enumeration methods on the returned object to fetch the keys sequentially.
keys in class HashtableEnumeration of the values in this hashtable.Enumerationpublic Enumeration elements()
OrderedHashtable instance. Use the
Enumeration methods on the returned object to fetch the elements sequentially.
elements in class HashtableEnumeration of the values in this hashtable.Enumeration
public Object put(Object key,
Object value)
throws NullPointerException
OrderedHashtable. Neither the key
nor the value can be null. The value can be retrieved by calling the get method with a key that is
equal to the original key.
put in interface Mapput in class Hashtablekey - the OrderedHashtable key.value - the value.
OrderedHashtable,
or null if it did not have one.
NullPointerException - An exception thrown if
the key or value is null.public Object get(Object key)
get in interface Mapget in class Hashtablepublic void putAll(Map t)
OrderedHashtable These mappings
will replace any mappings that this OrderedHashtable had for any of the keys currently
in the specified Map.
putAll in interface MapputAll in class Hashtablet - the mapping of new key-value pairs.
public Object remove(Object key)
throws NullPointerException
OrderedHashtable .
remove(Object) does nothing if the key is not in the OrderedHashtable instance.
remove in interface Mapremove in class Hashtablekey - the OrderedHashtable key.
OrderedHashtable,
or null if the key did not have a mapping.
NullPointerException - An exception thrown if
the key or value is null.public boolean containsKey(Object key)
Prior to the test, the key is normalized according to the normalized(Object) method.
In the case of OrderedHashtable, the normalized(Object) method does
nothing. However, subclasses of OrderedHashtable may have other
normalized(Object) methods.
containsKey in interface MapcontainsKey in class HashtableString.public String toString()
String, detailing the contents of this OrderedHashtable instance.
toString in class HashtableString.
|
OpMath | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||