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) |
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() |
String |
getProduction()
Get the node production in the form of string.
|
String |
getProductionIgnoringLeaves()
Get the node production in the form of string.
|
TreeNode |
getRoot() |
String |
getTextualEnrichedFormat() |
boolean |
hasChildren() |
boolean |
isPreterminal()
Returns whether this node has at least a child that is a leaf (i.e.
|
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 TreeNode getFather()
public Integer getId()
public Integer getMaxId()
public int getNoOfChildren()
public String getProduction()
public String 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 boolean isPreterminal()
public TreeNode getRoot()
Copyright © 2015 Semantic Analytics Group @ Uniroma2. All rights reserved.