|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.iplanet.jato.model.TreeModelBase
Partial implementation of the TreeModel
interface. Currently,
the algorithm for depth-first traversal is implemented in this class;
subclasses need only define the operations specific to their backing data
structures to allow iteration over the nodes of those structures. There is
no requirement to use this implementation; it exists purely for convenience.
Fields inherited from interface com.iplanet.jato.model.TreeModel |
BREADTH_FIRST_TRAVERSAL, DEPTH_FIRST_TRAVERSAL, NEXT_CHILD, NEXT_SIBLING, ROOT_NODE_LEVEL, UNDEFINED_NODE_LEVEL |
Constructor Summary | |
TreeModelBase()
Default constructor |
Method Summary | |
abstract void |
beforeRoot()
In addition to making the root node the next available node, this method should set the node level to UNDEFINED_NODE_LEVEL and call
setIterationComplete(false) if there are children available
to iterator over |
protected void |
clearCurrentNode()
Clears the currently cached node object, and sets the current node level to be undefined. |
protected void |
decrementNodeLevel()
Decrements the current node level by one level. |
abstract boolean |
firstChild()
/ public abstract boolean previousNode() throws ModelControlException; /** The implementation of this method should call
incrementNodeLevel() |
protected java.lang.Object |
getCurrentNode()
Gets the currently cached node object. |
abstract java.lang.String |
getNodeID()
Return a unique ID for the current node within the backing data structure. |
int |
getNodeLevel()
Return the current node level, meaning the an index indicating how far this node is removed from being the root of the tree. |
abstract java.lang.String |
getNodeName()
Return the logical name of the current node |
abstract java.lang.String |
getNodeType()
Return the logical type of the current node |
int |
getTraversalType()
Return the tree traversal type. |
protected void |
incrementNodeLevel()
Increments the current node level by one level. |
abstract boolean |
isChildNode()
Check if the current node is a child of a parent node |
boolean |
isIterationComplete()
Indicates whether the current iteration cycle has been completed |
abstract boolean |
isParentNode()
Check if the current node is a parent of other nodes |
boolean |
nextNode()
Subclasses need not override this method if they wish to use the standard node traversal implementation provided by this class |
boolean |
nextNode(int nextNode)
Subclasses need not override this method if they wish to use the standard node traversal implementation provided by this class |
abstract boolean |
nextSibling()
The implementation of this method should leave the node level unchanged |
abstract boolean |
parent()
The implementation of this method should call
decrementNodeLevel() |
abstract void |
root()
In addition to making the root node the current node, this method should set the node level to ROOT_NODE_LEVEL |
protected void |
setCurrentNode(java.lang.Object value)
Sets the currently cached node object. |
protected void |
setIterationComplete(boolean value)
Sets whether the current iteration cycle has been completed. |
protected void |
setNodeLevel(int value)
Sets the current node level. |
void |
setTraversalType(int value)
Sets the tree traversal type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.iplanet.jato.model.Model |
getName, getValue, getValues, setName, setValue, setValues |
Constructor Detail |
public TreeModelBase()
Method Detail |
public abstract java.lang.String getNodeName() throws ModelControlException
TreeModel
getNodeName
in interface TreeModel
public abstract java.lang.String getNodeType() throws ModelControlException
TreeModel
getNodeType
in interface TreeModel
public abstract java.lang.String getNodeID()
TreeModel
getNodeID
in interface TreeModel
public abstract boolean isParentNode()
TreeModel
isParentNode
in interface TreeModel
public abstract boolean isChildNode()
TreeModel
isChildNode
in interface TreeModel
public int getNodeLevel()
TreeModel
getNodeLevel
in interface TreeModel
protected void setNodeLevel(int value)
protected void incrementNodeLevel()
protected void decrementNodeLevel()
public int getTraversalType() throws ModelControlException
TreeModel
DEPTH_FIRST_TRAVERSAL
.getTraversalType
in interface TreeModel
public void setTraversalType(int value) throws ModelControlException
TreeModel
DEPTH_FIRST_TRAVERSAL
.setTraversalType
in interface TreeModel
public abstract void beforeRoot() throws ModelControlException
UNDEFINED_NODE_LEVEL
and call
setIterationComplete(false)
if there are children available
to iterator overbeforeRoot
in interface TreeModel
public abstract void root() throws ModelControlException
ROOT_NODE_LEVEL
root
in interface TreeModel
public boolean nextNode() throws ModelControlException
nextNode
in interface TreeModel
public boolean nextNode(int nextNode) throws ModelControlException
nextNode
in interface TreeModel
public abstract boolean firstChild() throws ModelControlException
incrementNodeLevel()
public abstract boolean parent() throws ModelControlException
decrementNodeLevel()
public abstract boolean nextSibling() throws ModelControlException
protected java.lang.Object getCurrentNode()
protected void setCurrentNode(java.lang.Object value)
protected void clearCurrentNode()
public boolean isIterationComplete()
protected void setIterationComplete(boolean value)
root()
must call this method with a value of false
to reset the flag before iteration begins.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |