public abstract class BaseNode extends Object implements 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.
|
<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
|
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.
|
void |
removeChild(Node node)
Removes a child.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcopy, getEndPosition, getStartPosition, getTypepublic BaseNode()
public BaseNode(BaseNode node)
@Nonnull public List<Node> getChildren()
NodegetChildren in interface Nodepublic void addChild(Node node)
Nodepublic void removeChild(Node node)
NoderemoveChild in interface Nodenode - Adds a new child to this nodepublic Node getRootNode()
NodegetRootNode in interface Node@Nonnull public <T extends Node> List<T> findDescendantsWith(Class<T> nodeType)
NodefindDescendantsWith in interface NodeT - The type of the classnodeType - The class that the node should implement@Nullable public <T extends Node> T findAncestorWith(Class<T> nodeType)
NodefindAncestorWith in interface NodeT - The type of the classnodeType - The class that the node should implementpublic void replaceWith(Node newNode)
NodereplaceWith in interface NodenewNode - The new nodepublic void setChild(int idx,
Node newNode)
Nodepublic void addChild(int idx,
Node newNode)
Nodepublic void setParent(Node parent)
Nodepublic void setSource(Node source)
Nodepublic Node getSource()
NodeCopyright © 2016. All rights reserved.