public class TextNode extends TreeNode
Constructor and Description |
---|
TextNode(String text,
DocumentNode parent,
TreeDocument doc,
int numChild,
Weighter w,
int level)
Instantiates a new text node.
|
TextNode(TextNode toCopy,
DocumentNode parent,
int numChild)
Copies a text node.
|
Modifier and Type | Method and Description |
---|---|
String |
dump(String prefix)
Dump this node.
|
boolean |
evaluate(ConnectionManager conMgmr)
Evaluate the modifications of this node.
|
void |
getNodeStats(HashMap<String,Integer> map)
Gets the node statistics of the subtree rooted in this node: tagname =>
number nodes having this tag name.
|
String |
getOwnHash()
Gets the hash of this single node (w/o its subtree).
|
org.jdom2.Element |
getSubDoc(org.jdom2.Element parent)
Attaches the subtree rooted in this node to the node parent.
|
String |
getSubTreeHash()
Gets the calculated hash of the subtree rooted in this node, in TextNodes
it equals the own hash.
|
String |
getTagName()
Gets the tag name.
|
String |
getText()
Gets the text content of this node.
|
double |
getTextDistance(TextNode cmp)
Gets the distance between the texts of two nodes.
|
double |
getWeight()
Gets the weight of this node.
|
protected void |
reSetupStructureDown(TreeDocument doc,
int numChild)
Re-setup the document structure downwards.
|
protected void |
reSetupStructureUp()
Re-setup the document structure upwards.
|
void |
setText(String newText)
Sets the text content of this node.
|
String |
toString() |
addModification, contentDiffers, getDocument, getLevel, getModification, getParent, getType, getXPath, hasModification, isRoot, networkDiffers, resetModifications, rmModification, setModification
public TextNode(TextNode toCopy, DocumentNode parent, int numChild)
toCopy
- the node to copyparent
- the new parent or null if this is going to be rootnumChild
- the number of that child among its siblingspublic TextNode(String text, DocumentNode parent, TreeDocument doc, int numChild, Weighter w, int level)
text
- the text stored in this nodeparent
- the parent node in the treedoc
- the documentnumChild
- the number of that child among its siblingsw
- the weighterlevel
- the level in the treepublic String getText()
public void setText(String newText)
newText
- the text to be stored in this nodepublic boolean evaluate(ConnectionManager conMgmr)
TreeNode
public String dump(String prefix)
TreeNode
public org.jdom2.Element getSubDoc(org.jdom2.Element parent)
TreeNode
parent == null && this.getType () == TreeNode.TEXT_NODE
That means a text node cannot become root.protected void reSetupStructureDown(TreeDocument doc, int numChild)
TreeNode
reSetupStructureDown
in class TreeNode
doc
- the document this node corresponds tonumChild
- the child number of this nodeprotected void reSetupStructureUp()
TreeNode
reSetupStructureUp
in class TreeNode
public void getNodeStats(HashMap<String,Integer> map)
TreeNode
getNodeStats
in class TreeNode
map
- the map to write our statistics topublic double getWeight()
TreeNode
public String getOwnHash()
TreeNode
getOwnHash
in class TreeNode
public String getSubTreeHash()
TreeNode
getSubTreeHash
in class TreeNode
public String getTagName()
TreeNode
TreeNode.TEXT_TAG
.getTagName
in class TreeNode
public double getTextDistance(TextNode cmp)
cmp
- the node to compareCopyright © 2019 SEMS project @ University of Rostock. All rights reserved.