public class TreeNodeUniqueChildren extends ITreeNode.DefaultTreeNode
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.
ITreeNode.DefaultTreeNodem_children, m_userObject, marked| 构造器和说明 |
|---|
TreeNodeUniqueChildren() |
TreeNodeUniqueChildren(Object userObject) |
TreeNodeUniqueChildren(Object userObject,
ITreeNode child) |
TreeNodeUniqueChildren(Object userObject,
ITreeNode[] children) |
| 限定符和类型 | 方法和说明 |
|---|---|
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.
|
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, unmarkpublic TreeNodeUniqueChildren()
public TreeNodeUniqueChildren(Object userObject)
userObject - public TreeNodeUniqueChildren(Object userObject, ITreeNode child)
userObject - child - public boolean addChildNode(ITreeNode node)
addChildNode 在接口中 ITreeNodeaddChildNode 在类中 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 在接口中 ITreeNodenewInstance 在类中 ITreeNode.DefaultTreeNodeCopyright © 2016. All rights reserved.