|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.alicebot.server.core.node.Nodemaster
public class Nodemaster
This non-trivial implementation of Nodemapper
uses a TreeMap
internally, but only
allocates it when the number of keys is two or more.
The Nodemaster
saves space when many of the
Nodemappers
have only one branch, as is
often the case in a real-world @{link Graphmaster Graphmaster}.
Field Summary | |
---|---|
protected int |
height
The minimum number of words needed to reach a leaf node from here. |
protected java.util.HashMap |
Hidden
|
protected java.lang.String |
key
|
protected Nodemapper |
parent
|
protected int |
size
|
protected java.lang.Object |
value
|
Constructor Summary | |
---|---|
Nodemaster()
|
Method Summary | |
---|---|
boolean |
containsKey(java.lang.String key)
Tells whether the Nodemapper contains the given key. |
java.lang.Object |
get(java.lang.String key)
Gets an object from the Nodemapper . |
int |
getHeight()
Returns the height of the Nodemapper . |
Nodemapper |
getParent()
Returns the parent of the Nodemapper |
java.util.Set |
keySet()
Returns the key set for the Nodemapper . |
java.lang.Object |
put(java.lang.String key,
java.lang.Object value)
Puts an object into the Nodemapper . |
void |
remove(java.lang.Object value)
Removes a node from the Nodemapper . |
void |
setParent(Nodemapper parent)
Sets the parent of the Nodemapper |
void |
setTop()
Sets the height of this Nodemapper
to "top", i.e. |
int |
size()
Returns the size of the Nodemapper |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int size
protected java.lang.String key
protected java.lang.Object value
protected java.util.HashMap Hidden
protected int height
Integer.MAX_VALUE
(zero).
protected Nodemapper parent
Constructor Detail |
---|
public Nodemaster()
Method Detail |
---|
public java.lang.Object put(java.lang.String key, java.lang.Object value)
Nodemapper
Nodemapper
.
put
in interface Nodemapper
key
- the key with which the object should be stored / will be retrievedvalue
- the object to be storedpublic void remove(java.lang.Object value)
Nodemapper
Nodemapper
.
remove
in interface Nodemapper
value
- the value to removepublic java.lang.Object get(java.lang.String key)
Nodemapper
Nodemapper
.
get
in interface Nodemapper
key
- the key to use in retrieving the object
public java.util.Set keySet()
Nodemapper
Nodemapper
.
keySet
in interface Nodemapper
public boolean containsKey(java.lang.String key)
Nodemapper
Nodemapper
contains the given key.
containsKey
in interface Nodemapper
key
- the key to look for
Nodemapper
contains the keypublic int size()
Nodemapper
Nodemapper
size
in interface Nodemapper
Nodemapper
public void setParent(Nodemapper parent)
Nodemapper
Nodemapper
setParent
in interface Nodemapper
parent
- the parent of the Nodemapper
public Nodemapper getParent()
Nodemapper
Nodemapper
getParent
in interface Nodemapper
Nodemapper
public int getHeight()
Nodemapper
Nodemapper
.
The height is the minimum number of words needed
to reach a leaf node from here.
getHeight
in interface Nodemapper
Nodemapper
public void setTop()
Nodemapper
Nodemapper
to "top", i.e. 0
(zero), causing
each ancestor n
to have a minimum height
of n
, unless the ancestor is the root node.
Not sure if this is correct.
setTop
in interface Nodemapper
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |