gishur.core
Class StdTreeItem

java.lang.Object
  |
  +--gishur.core.BasicTreeItem
        |
        +--gishur.core.StdTreeItem
All Implemented Interfaces:
java.lang.Cloneable, Cloneable, ControlledCloneable, KeyValueHolder, java.io.Serializable, TreeItem
Direct Known Subclasses:
SweepTreeItem

public class StdTreeItem
extends BasicTreeItem

Standard TreeItem for trees. The node is based upon BasicTreeItem, but additionally stores a key and a value.

Version:
1.0
Author:
Thomas Wolf
See Also:
Serialized Form

Fields inherited from interface gishur.core.TreeItem
CLEAR_CONNECTIONS, CONNECT, CONNECT_PARENT, LAST_CHILD, LEFT, PARENT, REMOVE, RIGHT, SET_BALANCE, SET_MAX_RANK, SET_OWNER, UNKNOWN
 
Fields inherited from interface gishur.core.KeyValueHolder
SET_KEY, SET_VALUE
 
Fields inherited from interface gishur.core.ControlledCloneable
DEEP, FLAT
 
Constructor Summary
StdTreeItem(int maxrank)
          Standard constructor.
StdTreeItem(int maxrank, java.lang.Object key, java.lang.Object value)
          Constructor initializing key and value. {
 
Method Summary
 java.lang.Object key()
          Returns the key.
 boolean setKey(java.lang.Object key)
          Sets key as the new key.
 boolean setValue(java.lang.Object object)
          Tries to store object in this StdTreeItem.
 java.lang.String toString()
          Overrides java.lang.Object.toString().
 java.lang.Object value()
          Returns the stored value-object.
 
Methods inherited from class gishur.core.BasicTreeItem
answerConnect, balance, child, clearConnections, clone, clone, connect, cut, equals, getOwningTree, isInner, isLeaf, isRoot, level, maxRank, nextChildPos, parent, pos, prevChildPos, rank, remove, requestTreeAccess, setBalance, setMaxRank, setOwningTree, sibling
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StdTreeItem

public StdTreeItem(int maxrank)
Standard constructor. Key and value will be set to null.
Parameters:
maxrank - the maximal rank of this node, i.e. the maximal number of child-nodes

StdTreeItem

public StdTreeItem(int maxrank,
                   java.lang.Object key,
                   java.lang.Object value)
Constructor initializing key and value. BasicTree.requestAccess(int, java.lang.Object, java.lang.Object) will not be called for initialization!
Parameters:
maxrank - maximal rank, i.e. the maximal number of child-nodes
key - new key-object
value - the value-object to store in this StdTreeItem
Method Detail

toString

public java.lang.String toString()
Overrides java.lang.Object.toString().
Overrides:
toString in class BasicTreeItem

key

public java.lang.Object key()
Returns the key.
Overrides:
key in class BasicTreeItem
Returns:
this StdTreeItem's key-object.

setKey

public boolean setKey(java.lang.Object key)
Sets key as the new key.
Overrides:
setKey in class BasicTreeItem
Parameters:
key - new key-object for this StdTreeItem
Returns:
true if the Owner allowed the action and it was performed successfully, false otherwise

value

public java.lang.Object value()
Returns the stored value-object.
Overrides:
value in class BasicTreeItem
Returns:
stored value

setValue

public boolean setValue(java.lang.Object object)
Tries to store object in this StdTreeItem.
Overrides:
setValue in class BasicTreeItem
Parameters:
object - the object to store
Returns:
true if the Owner allowed the action and it was performed successfully, false otherwise