|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ccg.util.LookupOrdered
public class LookupOrdered
A LookupKeyed class which maintains key order.
This class implements the LookupKeyed interface
and provides some additional functionality. Its key additions are:
getKeys() method maintains the original order of keys.
LookupKeyed,
LookupINI| Constructor Summary | |
|---|---|
LookupOrdered()
Initializes object to an empty LookupKeyed table. |
|
| Method Summary | |
|---|---|
void |
add(Object key,
Object data)
Add a new key/value pair to the lookup table. |
Object |
clone()
Makes a fairly light weight clone of the object. |
Object |
get(Object key)
Fetch the value associated with a "key" Try to lookup the Object which is associated with the key. |
Enumeration |
getKeys()
Get enumeration of all of the keys in the lookup table. |
String |
getString(Object key)
Fetch a String "value" associated with a "key". |
void |
print(PrintWriter pw)
Print the contents like a Java Properties file. |
void |
remove(Object key)
Removes a object from the table based on key value. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LookupOrdered()
LookupKeyed table.
After constructing the object in this fashion, you will want to
use one of the add methods to add
key/value pairs to the lookup table.
add(java.lang.Object, java.lang.Object)| Method Detail |
|---|
public Object clone()
This method constructs a lightweight clone of the object. The relationship between the "cloned" object and the original object will be as follows:
clone in class ObjectLookupOrdered object.
public void add(Object key,
Object data)
lookup table.
This method adds/replaces a key/value pair. The getKeys()
method will return the list of keys in the order they are
originally added.
key - The "key" to store the data with. If null (which is allowed),
then the object will remain unchanged.data - The "value" to associate with the key. It can be null.LookupOrdered(),
print(java.io.PrintWriter)public Object get(Object key)
get in interface Lookupget in interface LookupKeyedkey - Key to use to look up object with (if you pass null, you will
get null back).
LookupCreatepublic void remove(Object key)
key - Key to use to look up object with (if you pass null, we don't
do anything).get(Object)public String getString(Object key)
getString in interface LookupgetString in interface LookupKeyedkey - Key to use to look up object with (if you pass null, you will
get null back).
Lookup table all support the Object.toString() method
without Exception.LookupCreatepublic Enumeration getKeys()
getKeys in interface LookupKeyedEnumeration list of all keys in the Lookup table.public void print(PrintWriter pw)
Properties file.
This method prints the contents of the lookup
table in the form expected by the Properties class. In addition, the order the elements are
printed should be the same as the way they were added.
pw - Where to print the lookup table in ASCII form.add(java.lang.Object, java.lang.Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||