|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.niffty.HeirarchyNode
A HeirarchyNode is used to manage the relationship between a parent and its child nodes in a heirarchy tree. Strict relationships are enforced. For example, you can't add an object as a child to a parent node if it already has a parent. All the methods are protected because it is expected that a class will extend this and proved access methods which deal with the correct type.
Constructor Summary | |
HeirarchyNode()
Creates new HeirarchyNode with a null parent. |
Method Summary | |
protected void |
addChild(HeirarchyNode child)
Add the child to the end of the child node list and set its parent to this node. |
protected HeirarchyNode |
getChild(int index)
Return the child node at the given index in the child node list. |
protected int |
getChildCount()
Return the number of nodes in the child node list. |
protected int |
getIndex()
Return the index if this node in the parent node list, or throws a HeirarchyException if there is no parent. |
protected HeirarchyNode |
getParentNode()
Return the parent in the heirarchy, or null if this is the top node. |
protected HeirarchyNode |
nextInHeirarchy()
Return the next HeirarchyNode after this one at the same level in the entire heirarchy. |
protected HeirarchyNode |
previousInHeirarchy()
Return the previous HeirarchyNode before this one at the same level in the entire heirarchy. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HeirarchyNode()
addChild(org.niffty.HeirarchyNode)
Method Detail |
protected void addChild(HeirarchyNode child)
child
- the node to add as a child to this node. The child's parent
must be null.
HeirarchyException
- if the child's parent is not null. This ensures
that the child does not have two parents.protected int getChildCount()
protected HeirarchyNode getChild(int index)
java.lang.ArrayIndexOutOfBoundsException
- if the index is negative or not
less than the number of nodes in the child node list.protected int getIndex()
HeirarchyException
- if there is no parentprotected HeirarchyNode getParentNode()
protected HeirarchyNode previousInHeirarchy()
protected HeirarchyNode nextInHeirarchy()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |