|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectinfo.monitorenter.cpdetector.util.collections.ITreeNode.DefaultTreeNode
info.monitorenter.cpdetector.util.collections.TreeNodeUniqueChildren
public class TreeNodeUniqueChildren
An ITreeNode implementation, that does
not allow equal m_children of one common parent node. Common elements in the
path from an arbitrary node (seen as the root) to different leaves will share
the same ITreeNode instances at runtime.
This behaviour may be used to create the smallest possible tree containing all given serialized paths.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface info.monitorenter.cpdetector.util.collections.ITreeNode |
|---|
ITreeNode.DefaultTreeNode |
| Field Summary |
|---|
| Fields inherited from class info.monitorenter.cpdetector.util.collections.ITreeNode.DefaultTreeNode |
|---|
m_children, m_userObject, marked |
| Fields inherited from interface info.monitorenter.cpdetector.util.collections.ITreeNode |
|---|
ROOT |
| Constructor Summary | |
|---|---|
TreeNodeUniqueChildren()
|
|
TreeNodeUniqueChildren(Object userObject)
|
|
TreeNodeUniqueChildren(Object userObject,
ITreeNode child)
|
|
TreeNodeUniqueChildren(Object userObject,
ITreeNode[] children)
|
|
| Method Summary | |
|---|---|
boolean |
addChildNode(ITreeNode node)
If the given argument is already a child node of this one (by the means of the equals method), it will replace the old node but gets the childs of the old node. |
static void |
main(String[] args)
Construction of a tree with the user Objects (java.lang.Integer) and use the toString() method. |
ITreeNode |
newInstance()
Generic operations in default implementations may need to allocate new instances but have to choose the right type to support the provided invariants. |
| Methods inherited from class info.monitorenter.cpdetector.util.collections.ITreeNode.DefaultTreeNode |
|---|
addChild, addChildNodes, addChildren, compareTo, contains, containsNode, equals, getAllChildren, getChildCount, getChilds, getParent, getPathFromRoot, getSubtreeCount, getUserObject, getUserObjectPathFromRoot, isLeaf, isMarked, isRoot, mark, remove, removeAllChildren, removeChild, setParent, setUserObject, toString, toStringInternal, unmark |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TreeNodeUniqueChildren()
public TreeNodeUniqueChildren(Object userObject)
userObject -
public TreeNodeUniqueChildren(Object userObject,
ITreeNode child)
userObject - child -
public TreeNodeUniqueChildren(Object userObject,
ITreeNode[] children)
userObject - children - | Method Detail |
|---|
public boolean addChildNode(ITreeNode node)
addChildNode in interface ITreeNodeaddChildNode in class ITreeNode.DefaultTreeNodenode - the node to add as child.
ITreeNode.addChildNode(ITreeNode)
public static void main(String[] args)
throws Exception
Construction of a tree with the user Objects (java.lang.Integer) and use the toString() method.
0
/|\
/ | \
1 2 1
/ \ |\
/ \ | \
4 5 6 7
/|\
/ | \
8 9 10
As only unique nodes are supported, the paths have to be flattended to:
0
/ \
/ \
1 2
/|\
/ | \
/ | |\
/ | | \
4 5 6 7
/|\
/ | \
8 9 10
Exceptionpublic ITreeNode newInstance()
ITreeNodeGeneric operations in default implementations may need to allocate new instances but have to choose the right type to support the provided invariants.
If you provide a subclass that has invariants you should overload this.
newInstance in interface ITreeNodenewInstance in class ITreeNode.DefaultTreeNode
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||