|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.gjt.universe.DBTable
This class is used to implement a searchable and enumerable table of objects that can be accessed and modified in a synchronized manner. Currently this is internally implemented using a hash table. However, future implementations may utilize a more sophisticated database mechanism which allows persistence of objects outside of virtual memory when not being directly accessed, thus allowing the game to operate more efficiently.
Field Summary | |
private java.util.Hashtable |
hiddenTable
|
private java.lang.Object |
undefinedObject
|
Constructor Summary | |
DBTable()
The designated constructor for instances of this class. |
Method Summary | |
void |
addElement(Index id,
java.lang.Object obj)
This method adds the given element to the table, under the given unique ID. |
java.util.Enumeration |
elements()
This method returns an enumeration of all of the elements in the table. |
java.lang.Object |
elementWithID(Index id)
This method returns the object with the given ID. |
java.lang.Object |
removeElementWithID(Index id)
This method removes the object with the given ID from the table. |
void |
setUndefinedObject(java.lang.Object newValue)
This method sets the object which should be returned by the elementWithID method when a search is made for a non-existent id. |
int |
size()
This method returns the number of elements currently stored in the table. |
java.lang.Object |
undefinedObject()
This method returns the object which should be returend by the elementWithID method when a search is made for a non-existent id. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.util.Hashtable hiddenTable
private java.lang.Object undefinedObject
Constructor Detail |
public DBTable()
Method Detail |
public final void addElement(Index id, java.lang.Object obj)
id
- The unique ID of the object.obj
- The object to be stored in the table.public final java.lang.Object removeElementWithID(Index id)
id
- The unique ID of the object to be removed.public final java.lang.Object elementWithID(Index id)
id
- The unique ID of the desired object.setUndefinedObject( Object newValue )
public final int size()
public final java.util.Enumeration elements()
public final void setUndefinedObject(java.lang.Object newValue)
elementWithID( Index anID )
public final java.lang.Object undefinedObject()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |