Package alps.java.api.util
Klasse TreeNode<T>
java.lang.Object
alps.java.api.util.TreeNode<T>
- Typparameter:
T
-
- Alle implementierten Schnittstellen:
ITreeNode<T>
Class that represents a tree node
-
Feldübersicht
-
Konstruktorübersicht
KonstruktorBeschreibungTreeNode()
Constructor that creates an empty tree nodeConstructor creating a TreeNode with content, a parent and a childConstructor creating a TreeNode with contentConstructor creating a TreeNode with content, a parent and a child -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
Adds a child to the list of child nodesboolean
containsContent
(T content, ITreeNode<T> node) "out"-methodgetChild
(int index) Returns the child nodesReturns the content of the nodeint
Returns the height of the longest path to a leaf starting from this node.Returns the parent nodegetRoot()
Returns the root node of the current tree nodeboolean
isSubClassOf
(ITreeNode<T> parent) The default value of direct is falseboolean
isSubClassOf
(ITreeNode<T> parent, boolean direct) Checks whether the given node is sublcass of a specified nodevoid
setChildNodes
(List<ITreeNode<T>> childNodes) Overrides the current child nodes with a list of new child nodesvoid
setContent
(T content) Sets the content of the nodevoid
setParentNode
(ITreeNode<T> parent) Sets the parent nodetoString()
-
Felddetails
-
parentNode
-
childNodes
-
-
-
Konstruktordetails
-
TreeNode
public TreeNode()Constructor that creates an empty tree node -
TreeNode
Constructor creating a TreeNode with content- Parameter:
content
- A string that is contained in the tree node
-
TreeNode
Constructor creating a TreeNode with content, a parent and a child- Parameter:
content
- A string that is contained in the tree nodeparent
- A node that is parent of this nodechildNodes
- A node that is a child of this node
-
TreeNode
Constructor creating a TreeNode with content, a parent and a child- Parameter:
childNodes
- the child nodes
-
-
Methodendetails
-
setParentNode
Beschreibung aus Schnittstelle kopiert:ITreeNode
Sets the parent node- Angegeben von:
setParentNode
in SchnittstelleITreeNode<T>
- Parameter:
parent
- the parent node
-
setChildNodes
Beschreibung aus Schnittstelle kopiert:ITreeNode
Overrides the current child nodes with a list of new child nodes- Angegeben von:
setChildNodes
in SchnittstelleITreeNode<T>
- Parameter:
childNodes
- the new child nodes
-
addChild
Beschreibung aus Schnittstelle kopiert:ITreeNode
Adds a child to the list of child nodes -
getParentNode
Beschreibung aus Schnittstelle kopiert:ITreeNode
Returns the parent node- Angegeben von:
getParentNode
in SchnittstelleITreeNode<T>
- Gibt zurück:
- the parent node
-
getChildNodes
Beschreibung aus Schnittstelle kopiert:ITreeNode
Returns the child nodes- Angegeben von:
getChildNodes
in SchnittstelleITreeNode<T>
- Gibt zurück:
- the child nodes
-
getContent
Beschreibung aus Schnittstelle kopiert:ITreeNode
Returns the content of the node- Angegeben von:
getContent
in SchnittstelleITreeNode<T>
- Gibt zurück:
- the content of the node
-
toString
-
containsContent
"out"-method- Angegeben von:
containsContent
in SchnittstelleITreeNode<T>
- Parameter:
content
- the String that will be checked as referencenode
-- Gibt zurück:
-
setContent
Beschreibung aus Schnittstelle kopiert:ITreeNode
Sets the content of the node- Angegeben von:
setContent
in SchnittstelleITreeNode<T>
- Parameter:
content
- the content
-
isSubClassOf
Beschreibung aus Schnittstelle kopiert:ITreeNode
Checks whether the given node is sublcass of a specified node- Angegeben von:
isSubClassOf
in SchnittstelleITreeNode<T>
- Parameter:
parent
- the other node the given instance might be subclass ofdirect
- if true is passed, this method only returns true if the current instance is a direct sublass of the parent class- Gibt zurück:
- true if it is a subclass of the specified parent, false if not
-
isSubClassOf
The default value of direct is false- Angegeben von:
isSubClassOf
in SchnittstelleITreeNode<T>
- Parameter:
parent
- the other node the given instance might be subclass of- Gibt zurück:
-
getChild
-
getRoot
Beschreibung aus Schnittstelle kopiert:ITreeNode
Returns the root node of the current tree node -
getHeigthToLastLeaf
public int getHeigthToLastLeaf()Beschreibung aus Schnittstelle kopiert:ITreeNode
Returns the height of the longest path to a leaf starting from this node. If this node is already a leaf, it returns 0- Angegeben von:
getHeigthToLastLeaf
in SchnittstelleITreeNode<T>
- Gibt zurück:
-