public interface Node
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(int idx,
Node newNode)
Adds a child at a specified index.
|
void |
addChild(Node node)
Adds a new child.
|
void |
annotate(NodeAnnotation annotation)
Adds an annotation to this node
|
Collection<NodeAnnotation> |
annotations()
Returns all the annotations of this node
|
Node |
copy()
Creates a new copy of this node
|
<T extends Node> |
findAncestorWith(Class<T> nodeType)
Returns the nearest ancestor node that is instance of the specified class
|
<T extends Node> |
findDescendantsWith(Class<T> nodeType)
Returns the list of descendants nodes that are instances of the specified class
|
Node |
get(String selector)
Returns the child node that matches the desired selector or
null if there is no match |
List<Node> |
getChildren()
All the children
|
Position |
getEndPosition()
The end position of this node
|
Node |
getParent()
The parent of this node
|
Node |
getRootNode()
The ancestor that does not has any parent.
|
Node |
getSource()
Return the source of this node.
|
Position |
getStartPosition()
The start position of this node
|
NodeType |
getType()
Returns the type of this node
|
void |
removeChild(Node node)
Removes a child.
|
void |
removeChildren()
Removes all the children of this given node.
|
void |
replaceTree(Node newSubTree)
Replace this subtree with the given one.
|
void |
replaceWith(Node newNode)
Replace this node in the tree with a new specialized node.
|
void |
setChild(int idx,
Node newNode)
Sets a child at a specified index.
|
void |
setParent(Node parent)
Sets the parent node to this node.
|
void |
setSource(Node source)
The source of this node.
|
@Nonnull Position getStartPosition()
@Nonnull Position getEndPosition()
Node getRootNode()
void addChild(Node node)
node - Adds a new child to this nodevoid removeChild(Node node)
node - Adds a new child to this nodevoid setParent(Node parent)
parent - The new parent nodevoid setSource(Node source)
source - The original node.@Nonnull <T extends Node> List<T> findDescendantsWith(Class<T> nodeType)
T - The type of the classnodeType - The class that the node should implement@Nullable <T extends Node> T findAncestorWith(Class<T> nodeType)
T - The type of the classnodeType - The class that the node should implement@Nullable Node get(String selector)
null if there is no matchvoid replaceWith(Node newNode)
newNode - The new nodevoid setChild(int idx,
Node newNode)
idx - The indexnewNode - The new childvoid addChild(int idx,
Node newNode)
idx - The indexnewNode - The new childNodeType getType()
void removeChildren()
void annotate(NodeAnnotation annotation)
annotation - The annotationCollection<NodeAnnotation> annotations()
void replaceTree(Node newSubTree)
newSubTree - The new subtreeCopyright © 2017. All rights reserved.