org.omegahat.Environment.Utils
Class OrderedTable
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--org.omegahat.Environment.Utils.OrderedTable
- All Implemented Interfaces:
- Activable, AssignableSubset, java.lang.Cloneable, Database, java.util.Map, java.io.Serializable, ShallowCopyable, Subsettable
- Direct Known Subclasses:
- BasicAllocator, BasicFactorLevelSet, ClassLocator, DataFrame, ObjectList, SearchPath, Signature
- public class OrderedTable
- extends java.util.Hashtable
- implements Subsettable, AssignableSubset, ShallowCopyable, Database
This is a simple class that acts both as a \JClass{Hashtable} and as
an ordered Vector, remembering the
order in which the elements were added, allowing
optional keys for entries.
- See Also:
- Serialized Form
| Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
|
Method Summary |
java.lang.Object |
add(java.lang.Object value)
|
java.lang.Object |
add(java.lang.Object value,
java.lang.Object key)
Add the specified object to the table indexed by the given key. |
void |
addListListener(ListListener l)
|
boolean |
assign(java.lang.String name,
java.lang.Object obj)
assigns obj to the database under name. |
java.lang.Object |
assignSubset(java.lang.Object index,
java.lang.Object value)
|
boolean |
attach(DatabaseCustomer e)
|
void |
clear()
remove all the objects from the database. |
OrderedTable |
copy()
|
OrderedTable |
copy(OrderedTable src)
|
boolean |
detach(DatabaseCustomer e)
|
java.lang.Object |
elementAt(int which)
|
boolean |
exists(java.lang.String name)
does the object exist in the database? |
java.lang.Object |
get(java.lang.String key)
returns the object in the database assigned under the name. |
java.lang.String |
getName()
Accessor for name field |
int |
getState()
Accessor for state field |
java.util.Enumeration |
keys()
|
java.util.Vector |
listeners()
|
java.util.Vector |
listeners(java.util.Vector v)
|
void |
notifyListeners(java.lang.Object obj,
java.lang.Object key,
int index,
int operation)
|
java.lang.String[] |
objects()
the array of object names. |
java.util.Vector |
ordered()
|
java.util.Vector |
orderedKeys()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
This is a simple extension to the inherited method
of Hashtable. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value,
boolean addToOrdered)
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value,
boolean addToOrdered,
boolean notify)
|
java.lang.Object |
remove(java.lang.Object key)
|
java.lang.Object |
remove(java.lang.String key)
remove the object from the database |
java.lang.Object |
removeElement(java.lang.Object value)
|
java.lang.Object |
removeElement(java.lang.Object value,
boolean notify)
|
java.lang.Object |
removeElementAt(int which)
|
java.lang.Object |
removeElementAt(int which,
boolean notify)
|
void |
removeListListener(ListListener l)
|
void |
setElementAt(java.lang.Object value,
int which)
|
java.lang.String |
setName(java.lang.String val)
Accessor for name field |
int |
setState(int value)
Accessor for setting state field |
java.lang.Object |
subset(int index)
|
java.lang.Object |
subset(List l,
boolean keepStructure)
|
java.lang.Object |
subset(java.lang.Object index,
boolean keepStructure)
|
| Methods inherited from class java.util.Hashtable |
clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, rehash, size, toString, values |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.omegahat.Environment.Databases.Database |
size |
orderedElements
protected java.util.Vector orderedElements
orderedKeys
protected java.util.Vector orderedKeys
listeners
protected java.util.Vector listeners
name
protected java.lang.String name
state
protected int state
OrderedTable
public OrderedTable()
OrderedTable
public OrderedTable(int size)
OrderedTable
public OrderedTable(int size,
float factor)
OrderedTable
public OrderedTable(OrderedTable src)
OrderedTable
public OrderedTable(java.util.Vector els)
ordered
public java.util.Vector ordered()
orderedKeys
public java.util.Vector orderedKeys()
listeners
public java.util.Vector listeners()
listeners
public java.util.Vector listeners(java.util.Vector v)
getName
public java.lang.String getName()
- Accessor for
name field
- Specified by:
getName in interface Database
setName
public java.lang.String setName(java.lang.String val)
- Accessor for
name field
- Specified by:
setName in interface Database
getState
public int getState()
- Accessor for
state field
- Specified by:
getState in interface Activable
setState
public int setState(int value)
- Accessor for setting
state field
- Specified by:
setState in interface Activable
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
- This is a simple extension to the inherited method
of Hashtable. It assigns the object @value
to the database using the key @key.
Additionally, it adds the element to
- Overrides:
put in class java.util.Hashtable
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value,
boolean addToOrdered)
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value,
boolean addToOrdered,
boolean notify)
remove
public java.lang.Object remove(java.lang.Object key)
- Overrides:
remove in class java.util.Hashtable
removeElementAt
public java.lang.Object removeElementAt(int which)
removeElementAt
public java.lang.Object removeElementAt(int which,
boolean notify)
removeElement
public java.lang.Object removeElement(java.lang.Object value)
removeElement
public java.lang.Object removeElement(java.lang.Object value,
boolean notify)
subset
public java.lang.Object subset(java.lang.Object index,
boolean keepStructure)
- Specified by:
subset in interface Subsettable
subset
public java.lang.Object subset(List l,
boolean keepStructure)
subset
public java.lang.Object subset(int index)
assignSubset
public java.lang.Object assignSubset(java.lang.Object index,
java.lang.Object value)
- Specified by:
assignSubset in interface AssignableSubset
setElementAt
public void setElementAt(java.lang.Object value,
int which)
keys
public java.util.Enumeration keys()
- Overrides:
keys in class java.util.Hashtable
clear
public void clear()
- Description copied from interface:
Database
- remove all the objects from the database.
- Specified by:
clear in interface Database- Overrides:
clear in class java.util.Hashtable
elementAt
public java.lang.Object elementAt(int which)
addListListener
public void addListListener(ListListener l)
removeListListener
public void removeListListener(ListListener l)
notifyListeners
public void notifyListeners(java.lang.Object obj,
java.lang.Object key,
int index,
int operation)
add
public java.lang.Object add(java.lang.Object value)
add
public java.lang.Object add(java.lang.Object value,
java.lang.Object key)
- Add the specified object to the table indexed by the given key.
Note the order.
- Parameters:
value - the object to be entered into the table.key - the index in the table by which- Returns:
- the value being inserted into the table.
copy
public OrderedTable copy()
copy
public OrderedTable copy(OrderedTable src)
objects
public java.lang.String[] objects()
- Description copied from interface:
Database
- the array of object names.
- Specified by:
objects in interface Database
assign
public boolean assign(java.lang.String name,
java.lang.Object obj)
throws java.lang.Exception
- Description copied from interface:
Database
- assigns
obj to the database under name.
- Specified by:
assign in interface Database
- Following copied from interface:
org.omegahat.Environment.Databases.Database
- Parameters:
obj - any object, including nullname - a string (preferably non-empty) to locate the object in
the database.
remove
public java.lang.Object remove(java.lang.String key)
- Description copied from interface:
Database
- remove the object from the database
- Specified by:
remove in interface Database
- Following copied from interface:
org.omegahat.Environment.Databases.Database
- Parameters:
name - any string, matching the one used in a previous
assignment.
exists
public boolean exists(java.lang.String name)
- Description copied from interface:
Database
- does the object exist in the database?
- Specified by:
exists in interface Database
get
public java.lang.Object get(java.lang.String key)
- Description copied from interface:
Database
- returns the object in the database assigned under the name.
or
null if none.
- Specified by:
get in interface Database
detach
public boolean detach(DatabaseCustomer e)
- Specified by:
detach in interface Database
attach
public boolean attach(DatabaseCustomer e)
- Specified by:
attach in interface Database