Class Node
- java.lang.Object
-
- de.uka.ipd.sdq.tcfmoop.outputtree.Node
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Node.NodeType
-
Field Summary
Fields Modifier and Type Field Description protected Node
parent
Node.NodeType
type
-
Constructor Summary
Constructors Modifier Constructor Description protected
Node(Node parent, String value, Node.NodeType type)
Creates a new node
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Node
addChild(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
clearChildren()
Clear the list of child nodes of the current node.List<Node>
getChildren()
Returns a list with the children of the node.Node
getParent()
Returns the parent node of the current node.Node.NodeType
getType()
Returns the type of the nodeString
getValue()
Returns the information saved in the current node.boolean
hasChildren()
Returns whether the current node has any children nodesboolean
isRoot()
Returns whether the current node is a root of a tree.String
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 levelsString
toString()
]void
updateValue(String newValue)
Update the information saved in the current node
-
-
-
Field Detail
-
parent
protected Node parent
-
type
public Node.NodeType type
-
-
Constructor Detail
-
Node
protected Node(Node parent, String value, Node.NodeType type)
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 Detail
-
hasChildren
public boolean hasChildren()
Returns whether the current node has any children nodes- Returns:
- true if the node has children, false otherwise
-
getChildren
public List<Node> 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
public Node 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
public String getValue()
Returns the information saved in the current node.- Returns:
- the information saved in the current string
-
addChild
public Node addChild(String value, Node.NodeType type)
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
public void attachSubtree(Tree tree)
Attach a sub tree to the current node- Parameters:
tree
- the sub tree to be attached
-
updateValue
public void updateValue(String newValue)
Update the information saved in the current node- Parameters:
newValue
- the new information to be saved in the node
-
getType
public Node.NodeType getType()
Returns the type of the node- Returns:
- the type of the node
-
subTreeToString
public String 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 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
-
-