DocumentNode
, TextNode
public abstract class TreeNode extends Object
Modifier and Type | Field | Description |
---|---|---|
static int |
COPIED |
COPIED => node was copied.
|
protected TreeDocument |
doc |
The corresponding document.
|
static int |
DOC_NODE |
DOC_NODE this is a DocumentNode.
|
static int |
GLUED |
GLUED => node was glued.
|
static int |
KIDSSWAPPED |
KIDSSWAPPED => the sequence of kids of this node were altered.
|
protected int |
level |
The level in the tree document.
|
protected int |
modified |
The current modification state.
|
static int |
MODIFIED |
MODIFIED => node was modified.
|
static int |
MOVED |
MOVED => node has moves.
|
protected String |
ownHash |
The hash of this single node
|
protected DocumentNode |
parent |
The parent node.
|
static int |
SUB_MODIFIED |
SUB_MODIFIED => the corresponding subtree was modified.
|
static int |
SUBTREEUNMAPPED |
SUBTREEUNMAPPED => the whole subtree is unmapped.
|
static int |
SWAPPEDKID |
SWAPPEDKID => this is a swapped kid.
|
static int |
TEXT_NODE |
TEXT_NODE this is a TextNode.
|
static String |
TEXT_TAG |
The node tag name for text nodes, as we will use it in XPath expressions.
|
protected int |
type |
The node type.
|
static int |
UNCHANGED |
UNCHANGED => node hasn't changes.
|
static int |
UNMAPPED |
UNMAPPED => node wasn't mapped.
|
protected String |
xPath |
The XPath of this node.
|
Constructor | Description |
---|---|
TreeNode(int type,
DocumentNode parent,
TreeDocument doc,
int level) |
Instantiates a new tree node.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addModification(int mod) |
Add a modification.
|
boolean |
contentDiffers(TreeNode tn) |
Check if content between two nodes differs.
|
abstract String |
dump(String prefix) |
Dump this node.
|
abstract boolean |
evaluate(ConnectionManager conMgmr) |
Evaluate the modifications of this node.
|
TreeDocument |
getDocument() |
Gets the corresponding document.
|
int |
getLevel() |
Returns the level of this node in its tree.
|
int |
getModification() |
Returns the modification state.
|
abstract void |
getNodeStats(HashMap<String,Integer> map) |
Gets the node statistics of the subtree rooted in this node: tagname =>
number nodes having this tag name.
|
abstract String |
getOwnHash() |
Gets the hash of this single node (w/o its subtree).
|
DocumentNode |
getParent() |
Gets the parent node.
|
abstract org.jdom2.Element |
getSubDoc(org.jdom2.Element parent) |
Attaches the subtree rooted in this node to the node parent.
|
abstract String |
getSubTreeHash() |
Gets the calculated hash of the subtree rooted in this node, in TextNodes
it equals the own hash.
|
abstract String |
getTagName() |
Gets the tag name.
|
int |
getType() |
Gets the node type.
|
abstract double |
getWeight() |
Gets the weight of this node.
|
String |
getXPath() |
Gets the XPath expression corresponding to this node.
|
boolean |
hasModification(int mod) |
Checks for a certain modification.
|
boolean |
isRoot() |
Checks if this is the root of the tree.
|
boolean |
networkDiffers(TreeNode tn,
ConnectionManager conMgmr,
Connection c) |
Checks if the network of two nodes differs.
|
void |
resetModifications() |
Resets all modifications.
|
protected abstract void |
reSetupStructureDown(TreeDocument doc,
int numChild) |
Re-setup the document structure downwards.
|
protected abstract void |
reSetupStructureUp() |
Re-setup the document structure upwards.
|
void |
rmModification(int mod) |
Remove a modification.
|
void |
setModification(int mod) |
Sets the modification.
|
public static final String TEXT_TAG
public static final int UNCHANGED
public static final int UNMAPPED
public static final int MOVED
public static final int MODIFIED
public static final int SUB_MODIFIED
public static final int COPIED
public static final int GLUED
public static final int KIDSSWAPPED
public static final int SWAPPEDKID
public static final int SUBTREEUNMAPPED
public static final int DOC_NODE
DocumentNode
,
Constant Field Valuespublic static final int TEXT_NODE
TextNode
,
Constant Field Valuesprotected int modified
protected int type
protected String xPath
protected DocumentNode parent
protected TreeDocument doc
protected int level
protected String ownHash
public TreeNode(int type, DocumentNode parent, TreeDocument doc, int level)
type
- the node typeparent
- the parent nodedoc
- the corresponding documentlevel
- the level in the treepublic int getLevel()
public int getModification()
public void rmModification(int mod)
mod
- the modificationpublic void addModification(int mod)
mod
- the modificationpublic void setModification(int mod)
mod
- the new modificationpublic boolean hasModification(int mod)
mod
- the modificationpublic int getType()
public DocumentNode getParent()
public String getXPath()
public boolean isRoot()
public void resetModifications()
public TreeDocument getDocument()
public boolean networkDiffers(TreeNode tn, ConnectionManager conMgmr, Connection c)
tn
- the node in another tree documentconMgmr
- the connection managerc
- the connectionpublic boolean contentDiffers(TreeNode tn)
tn
- the other node to comparepublic abstract String getTagName()
TreeNode.TEXT_TAG
.public abstract double getWeight()
public abstract String getOwnHash()
public abstract String getSubTreeHash()
public abstract boolean evaluate(ConnectionManager conMgmr)
conMgmr
- the connection managerpublic abstract String dump(String prefix)
prefix
- the prefix for a line (indention)public abstract org.jdom2.Element getSubDoc(org.jdom2.Element parent)
parent == null && this.getType () == TreeNode.TEXT_NODE
That means a text node cannot become root.parent
- the parent element which will root this node. If null, this node
will be root in the documentprotected abstract void reSetupStructureDown(TreeDocument doc, int numChild)
doc
- the document this node corresponds tonumChild
- the child number of this nodeprotected abstract void reSetupStructureUp()
Copyright © 2018 SEMS project @ University of Rostock. All rights reserved.