Package org.outerj.daisy.diff.html.dom
Class Node
java.lang.Object
org.outerj.daisy.diff.html.dom.Node
Represents any element in the DOM tree of a HTML file.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Node
copyTree()
void
getLastCommonParent
(Node other) Descent the ancestors list for both nodes stopping either at the first no-match case or when either of the lists is exhausted.abstract Node
getMinimalDeletedSet
(long id) This method returns a list of the ancestors that is ordered starting from the root by the depth.abstract Node
getRoot()
"equals" method should work differently for the case where the compared nodes are from the same tree, and in that case return true only if it's the same object This method returns the root of the tree (which should be common ancestor for every node in the tree).boolean
inPre()
boolean
boolean
void
changes the parent field of this node.protected void
void
setWhiteAfter
(boolean whiteAfter) void
setWhiteBefore
(boolean whiteBefore)
-
Field Details
-
parent
-
-
Constructor Details
-
Node
This constructor not only sets the parameter as the parent for the created node, but also appends the created node to the collection of the parent's children.- Parameters:
parent
- - the parent for the new node.
-
-
Method Details
-
getParent
- Returns:
- the parent itself (NOT a copy!)
-
getParentTree
This method returns a list of the ancestors that is ordered starting from the root by the depth. Index of an element in that list corresponds its depth (if depth of the root is 0)- Returns:
- ordered by depth list of the ancestors or an empty
List<TagNode>
if the parent is null.
-
getRoot
"equals" method should work differently for the case where the compared nodes are from the same tree, and in that case return true only if it's the same object This method returns the root of the tree (which should be common ancestor for every node in the tree). If the roots are the same object, then the nodes are in the same tree.- Returns:
- the "top" ancestor if this node has a parent,
or
the node itself if there is no parent, and this is aTagNode
or
null if there is no parents and this node isn't aTagNode
-
getMinimalDeletedSet
-
detectIgnorableWhiteSpace
public void detectIgnorableWhiteSpace() -
getLastCommonParent
Descent the ancestors list for both nodes stopping either at the first no-match case or when either of the lists is exhausted.- Parameters:
other
- - the node to check for common parent- Returns:
- result that contains last common parent, depth, index in the list of children of the common parent of an ancestor(or self) of this node that is immediate child of the common parent.
- Throws:
IllegalArgumentException
- if the parameter is null
-
setParent
changes the parent field of this node. Does NOT append/remove itself from the previous or the new parent children collection.- Parameters:
parent
- - new parent to assign
-
setRoot
-
copyTree
-
inPre
public boolean inPre()- Returns:
true
only if one of the ancestors is <pre> tag.false
otherwise (including case where this node is <pre> tag)
-
isWhiteBefore
public boolean isWhiteBefore() -
setWhiteBefore
public void setWhiteBefore(boolean whiteBefore) -
isWhiteAfter
public boolean isWhiteAfter() -
setWhiteAfter
public void setWhiteAfter(boolean whiteAfter) -
getLeftMostChild
-
getRightMostChild
-