Class Node
java.lang.Object
de.uka.ipd.sdq.tcfmoop.outputtree.Node
- Direct Known Subclasses:
Tree
Defines a Node of a tree.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
Node
(Node parent, String value, Node.NodeType type) Creates a new node -
Method Summary
Modifier and TypeMethodDescriptionaddChild
(String value, Node.NodeType type) Add a children node to the current node.void
attachSubtree
(Tree tree) Attach a sub tree to the current nodevoid
Clear the list of child nodes of the current node.Returns a list with the children of the node.Returns the parent node of the current node.getType()
Returns the type of the nodegetValue()
Returns the information saved in the current node.boolean
Returns whether the current node has any children nodesboolean
isRoot()
Returns whether the current node is a root of a tree.subTreeToString
(String treePrefix, int prefixOccurance) Builds a tree like String representation of the current node and its entire subtree by using a tree prefix to simulate tree levelstoString()
]void
updateValue
(String newValue) Update the information saved in the current node
-
Field Details
-
parent
-
type
-
-
Constructor Details
-
Node
Creates a new node- Parameters:
parent
- The parent of the current node.value
- The information that should be saved in the current nodetype
- the type of the node. Can later be used by the representation in the GUI
-
-
Method Details
-
hasChildren
public boolean hasChildren()Returns whether the current node has any children nodes- Returns:
- true if the node has children, false otherwise
-
getChildren
Returns a list with the children of the node. The list might be empty if the node does not have any children.- Returns:
- a list with all children.
-
isRoot
public boolean isRoot()Returns whether the current node is a root of a tree.- Returns:
- true if the node is root, false otherwise.
-
getParent
Returns the parent node of the current node. Null might be returned if the node is a root node- Returns:
- the parent of the current node or null
-
getValue
Returns the information saved in the current node.- Returns:
- the information saved in the current string
-
addChild
Add a children node to the current node.- Parameters:
value
- the information that will be stored in the child nodetype
- the type of the child node- Returns:
- the child node
-
clearChildren
public void clearChildren()Clear the list of child nodes of the current node. -
attachSubtree
Attach a sub tree to the current node- Parameters:
tree
- the sub tree to be attached
-
updateValue
Update the information saved in the current node- Parameters:
newValue
- the new information to be saved in the node
-
getType
Returns the type of the node- Returns:
- the type of the node
-
toString
] -
subTreeToString
Builds a tree like String representation of the current node and its entire subtree by using a tree prefix to simulate tree levels- Parameters:
treePrefix
- the prefix to useprefixOccurance
- occurrence of the prefix on level 0 (root level). Usually 0- Returns:
- the tree like String representation of the node and its subtree
-