public class TreeNode extends Object implements Serializable
Constructor and Description |
---|
TreeNode(int id,
StructureElement content,
TreeNode father) |
Modifier and Type | Method and Description |
---|---|
List<TreeNode> |
getAllNodes()
Get recursively all Tree Nodes below the target node
|
TreeNode |
getAncestor(int generation)
Returns the
generation generation ancestor of this node
(for instance 1-generation ancestor is the father, 2-generation ancestor
is the grandfather, etc) |
int |
getBranchingFactor()
Returns the branching factor of the tree rooted by this node
|
ArrayList<TreeNode> |
getChildren()
Get the direct children of the target node
|
StructureElement |
getContent() |
List<TreeNode> |
getDescendants(int generation)
Returns all the
generation generations descendants of this node
(for instance 1-generation descendants are the children, the 2-generations
descendants are the grandchildren, etc) |
TreeNode |
getFather()
Get the father of the target node
|
int |
getHeight()
Returns the height of the tree rooted by this node (i.e.
|
Integer |
getId() |
List<TreeNode> |
getLeaves() |
Integer |
getMaxId()
Get the max id within all node under the target node
|
int |
getNoOfChildren() |
char[] |
getProduction()
Get the node production in the form of string.
|
char[] |
getProductionIgnoringLeaves()
Get the node production in the form of string.
|
TreeNode |
getRoot() |
String |
getTextualEnrichedFormat() |
boolean |
hasChildren() |
boolean |
isPreterminal()
Returns whether this has only leaf children (i.e., the child is terminal)
|
void |
setChildren(ArrayList<TreeNode> children)
Set the direct children of the target node
|
void |
setContent(StructureElement content) |
String |
toString() |
void |
updateProduction()
Notifies a modification in the label of the node, that
must reflect in an update of the production of this node and
in the one of its father (if it has)
|
public TreeNode(int id, StructureElement content, TreeNode father)
public StructureElement getContent()
public void setContent(StructureElement content)
public List<TreeNode> getAllNodes()
public ArrayList<TreeNode> getChildren()
public void setChildren(ArrayList<TreeNode> children)
public TreeNode getFather()
public Integer getId()
public Integer getMaxId()
public int getNoOfChildren()
public char[] getProduction()
public char[] getProductionIgnoringLeaves()
public void updateProduction()
public boolean hasChildren()
public String getTextualEnrichedFormat()
public TreeNode getAncestor(int generation)
generation
generation ancestor of this node
(for instance 1-generation ancestor is the father, 2-generation ancestor
is the grandfather, etc)generation
- the number of generationsgeneration
generation ancestor of this nodepublic List<TreeNode> getDescendants(int generation)
generation
generations descendants of this node
(for instance 1-generation descendants are the children, the 2-generations
descendants are the grandchildren, etc)generation
- the number of generationsgeneration
generations descendants of this nodepublic int getHeight()
public int getBranchingFactor()
public boolean isPreterminal()
public TreeNode getRoot()
Copyright © 2018 Semantic Analytics Group @ Uniroma2. All rights reserved.