|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbyucc.edif.MultiTypeNameSpaceResolver
Implements a String name space that has the capability of switching between an ArrayList and a HashSet, depending on the size of the name space. The user can also specify which to use through the maximizeSpeed(), and minimizeSize() functions.
| Field Summary | |
private boolean |
_alwaysArrayList
True if an ArrayList is always to be used, false otherwise. |
private java.util.HashSet |
_hashnames
For the HashSet implementation of this name space. |
private java.util.ArrayList |
_listnames
For the ArrayList implementation of this name space. |
private java.util.Collection |
_names
For the HashSet implementation of this name space. |
private boolean |
_useArrayList
True if an ArrayList is currently being used, HashSet otherwise. |
| Constructor Summary | |
MultiTypeNameSpaceResolver()
Constructs a MultiTypeNameSpaceResolver Object and initializes _names to be an ArrayList. |
|
| Method Summary | |
boolean |
add(NamedPropertyObject name)
Adds a name if it doesn't clash with an existing name and return true. |
java.util.Collection |
getNames()
Returns a Collection of the data structure holding all the Objects in the name space. |
static void |
main(java.lang.String[] args)
A method used to test this class |
void |
maximizeSpeed()
Changes implementation from an arraylist to a hashset |
void |
minimizeSize()
Changes implementation from hashset to arraylist |
boolean |
nameClash(java.lang.String name)
Returns true if name does not clash with name space. |
java.lang.String |
returnUniqueName(java.lang.String name)
If the name is valid, return name. |
java.lang.String |
toString()
Returns a string representation of this object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private boolean _useArrayList
private boolean _alwaysArrayList
private java.util.ArrayList _listnames
private java.util.HashSet _hashnames
private java.util.Collection _names
| Constructor Detail |
public MultiTypeNameSpaceResolver()
| Method Detail |
public boolean add(NamedPropertyObject name)
name - Name to add to the name space.
public java.util.Collection getNames()
public void maximizeSpeed()
public void minimizeSize()
public boolean nameClash(java.lang.String name)
nameClash in interface NameSpaceResolvername - Name to check if it already exists in the name space.
public java.lang.String returnUniqueName(java.lang.String name)
returnUniqueName in interface NameSpaceResolvername - Name to modify, and make unique for this name space.
public java.lang.String toString()
toString in interface NameSpaceResolverpublic static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||