public class TreeRepresentation extends Object implements Representation
Modifier and Type | Field and Description |
---|---|
protected List<TreeNode> |
orderedNodeSetByLabel
The complete set of tree nodes ordered alphabetically by label.
|
protected List<TreeNode> |
orderedNodeSetByProduction
The complete set of tree nodes ordered alphabetically by production
string.
|
protected List<TreeNode> |
orderedNodeSetByProductionIgnoringLeaves
The of non terminal tree nodes ordered alphabetically by production
string.
|
protected TreeNode |
root
The root node of the tree
|
Constructor and Description |
---|
TreeRepresentation() |
TreeRepresentation(TreeNode root)
Build a tree representation from a TreeNode
|
Modifier and Type | Method and Description |
---|---|
TreeRepresentation |
clone() |
boolean |
equals(Object representation) |
List<TreeNode> |
getAllNodes() |
List<TreeNode> |
getLeaves()
Returns all the leaves, i.e.
|
Integer |
getMaxId()
Get the max id within all nodes
|
List<TreeNode> |
getNodesWithContentType(Class<? extends StructureElement> clazz)
Returns all the nodes whose content has type
clazz |
List<TreeNode> |
getOrderedNodeSetByLabel() |
List<TreeNode> |
getOrderedNodeSetByProduction() |
List<TreeNode> |
getOrderedNodeSetByProductionIgnoringLeaves() |
List<TreeNode> |
getPreLeafNodes(int generationHops)
Returns all the nodes that have at least a
generationHops -generation descendant being a leaf
(for instance using generationHops =1 will produce a list of all the fathers of the leaves,
generationHops =2 will produce a list of all the grandfathers of the leaves, etc) |
TreeNode |
getRoot() |
String |
getTextFromData()
Returns a textual representation of the data stored in this
representation
|
String |
getTextualEnrichedTree() |
int |
hashCode() |
void |
setDataFromText(String representationDescription)
Initializes a Representation using its textual description provided in
representationDescription |
String |
toString() |
void |
updateOrderedNodeLists() |
protected TreeNode root
protected List<TreeNode> orderedNodeSetByLabel
protected List<TreeNode> orderedNodeSetByProduction
public TreeRepresentation()
public TreeRepresentation(TreeNode root)
root
- Root of the Treepublic TreeRepresentation clone()
public void updateOrderedNodeLists()
public Integer getMaxId()
public List<TreeNode> getOrderedNodeSetByLabel()
public List<TreeNode> getOrderedNodeSetByProduction()
public List<TreeNode> getOrderedNodeSetByProductionIgnoringLeaves()
public TreeNode getRoot()
public String getTextFromData()
Representation
getTextFromData
in interface Representation
public void setDataFromText(String representationDescription) throws Exception
Representation
representationDescription
setDataFromText
in interface Representation
representationDescription
- the textual description of the representation to be
initializedException
public String getTextualEnrichedTree()
public List<TreeNode> getNodesWithContentType(Class<? extends StructureElement> clazz)
clazz
clazz
- the type of the contentclazz
public List<TreeNode> getLeaves()
public List<TreeNode> getPreLeafNodes(int generationHops)
generationHops
-generation descendant being a leaf
(for instance using generationHops
=1 will produce a list of all the fathers of the leaves,
generationHops
=2 will produce a list of all the grandfathers of the leaves, etc)generationHops
- the number of generations from the leavesgenerationHops
-generation descendant being a leafCopyright © 2015 Semantic Analytics Group @ Uniroma2. All rights reserved.