@Deprecated protected Node parent
@Deprecated protected Node[] children
Deprecated.
@Deprecated protected int childIndex
@Deprecated protected int id
@Deprecated protected int beginLine
@Deprecated protected int endLine
@Deprecated protected int beginColumn
@Deprecated protected int endColumn
@Deprecated protected GenericToken firstToken
Deprecated.
@Deprecated protected GenericToken lastToken
Deprecated.
public AbstractNode(int id)
public AbstractNode(int id, int theBeginLine, int theEndLine, int theBeginColumn, int theEndColumn)
public Node getParent()Description copied from interface:
Node
Returns the parent of this node, or null if this is the
rootof the tree.
This method should be preferred to Node.jjtGetParent()
.
public int getIndexInParent()Description copied from interface:
Node
Returns the index of this node in its parent's children. If this node is a
root node, returns -1.
This method replaces Node.jjtGetChildIndex()
, whose name was JJTree-specific.
getIndexInParent
in interface Node
public Node getChild(int index)Description copied from interface:
Node
Returns the child of this node at the given index.
public int getNumChildren()Description copied from interface:
Node
Returns the number of children of this node.
getNumChildren
in interface Node
@Deprecated public boolean isSingleLine()
@Deprecated @InternalApi public void jjtOpen()
Deprecated.
Description copied from interface:Node
This method is called after the node has been made the current node. It indicates that child nodes can now be added to it.
@Deprecated @InternalApi public void jjtClose()
Deprecated.
Description copied from interface:Node
This method is called after all the child nodes have been added.
@Deprecated @InternalApi public void jjtSetParent(Node parent)
Deprecated.
Description copied from interface:Node
Sets the parent of this node.
jjtSetParent
in interface Node
parent
- The parent
@Deprecated public Node jjtGetParent()
Deprecated.
Description copied from interface:Node
Returns the parent of this node.
jjtGetParent
in interface Node
@Deprecated @InternalApi public void jjtAddChild(Node child, int index)
Deprecated.
Description copied from interface:Node
This method tells the node to add its argument to the node's list of children.
jjtAddChild
in interface Node
child
- The child to add
index
- The index to which the child will be added
@Deprecated @InternalApi public void jjtSetChildIndex(int index)
Deprecated.
Description copied from interface:Node
Sets the index of this node from the perspective of its parent. This means: this.getParent().getChild(index) == this.
jjtSetChildIndex
in interface Node
index
- the child index
@Deprecated public int jjtGetChildIndex()
Deprecated.
Description copied from interface:Node
Gets the index of this node in the children of its parent.
jjtGetChildIndex
in interface Node
@Deprecated public Node jjtGetChild(int index)
Deprecated.
Description copied from interface:Node
This method returns a child node. The children are numbered from zero, left to right.
jjtGetChild
in interface Node
index
- the child index. Must be nonnegative and less than Node.jjtGetNumChildren()
.
@Deprecated public int jjtGetNumChildren()
Deprecated.
Description copied from interface:Node
Returns the number of children the node has.
jjtGetNumChildren
in interface Node
@Deprecated public int jjtGetId()
public String getImage()Description copied from interface:
Node
Returns a string token, usually filled-in by the parser, which describes some textual characteristic of this node. This is usually an identifier, but you should check that using the Designer. On most nodes though, this method returns null
.
@Deprecated public void setImage(String image)
Deprecated.
public boolean hasImageEqualTo(String image)Description copied from interface:
Node
Returns true if this node's image is equal to the given string.
hasImageEqualTo
in interface Node
image
- The image to check
public int getBeginLine()
getBeginLine
in interface Node
@Deprecated @InternalApi public void testingOnlySetBeginLine(int i)
public int getBeginColumn()
getBeginColumn
in interface Node
@Deprecated @InternalApi public void testingOnlySetBeginColumn(int i)
public int getEndLine()
getEndLine
in interface Node
@Deprecated @InternalApi public void testingOnlySetEndLine(int i)
public int getEndColumn()
getEndColumn
in interface Node
@Deprecated @InternalApi public void testingOnlySetEndColumn(int i)
public DataFlowNode getDataFlowNode()
getDataFlowNode
in interface Node
public void setDataFlowNode(DataFlowNode dataFlowNode)
setDataFlowNode
in interface Node
public Node getNthParent(int n)Description copied from interface:
Node
Returns the n-th parent or null if there are less than n
ancestors.
getNthParent
in interface Node
n
- how many ancestors to iterate over.
public <T> T getFirstParentOfType(Class<T> parentType)Description copied from interface:
Node
Traverses up the tree to find the first parent instance of type parentType or one of its subclasses.
getFirstParentOfType
in interface Node
T
- The type you want to find
parentType
- Class literal of the type you want to find
public <T> List<T> getParentsOfType(Class<T> parentType)Description copied from interface:
Node
Traverses up the tree to find all of the parent instances of type parentType or one of its subclasses. The nodes are ordered deepest-first.
getParentsOfType
in interface Node
T
- The type you want to find
parentType
- Class literal of the type you want to find
@SafeVarargs @Deprecated public final <T> T getFirstParentOfAnyType(Class<? extends T>... parentTypes)
Deprecated.
Description copied from interface:Node
Gets the first parent that's an instance of any of the given types.
getFirstParentOfAnyType
in interface Node
T
- Most specific common type of the parameters
parentTypes
- Types to look for
public <T> List<T> findDescendantsOfType(Class<? extends T> targetType)Description copied from interface:
Node
Traverses down the tree to find all the descendant instances of type descendantType without crossing find boundaries.
findDescendantsOfType
in interface Node
targetType
- class which you want to find.
public <T> List<T> findDescendantsOfType(Class<T> targetType, boolean crossBoundaries)Description copied from interface:
Node
Traverses down the tree to find all the descendant instances of type descendantType.
findDescendantsOfType
in interface Node
targetType
- class which you want to find.
crossBoundaries
- if false
, recursion stops for nodes for which Node.isFindBoundary()
is true
@Deprecated public <T> void findDescendantsOfType(Class<T> targetType, List<T> results, boolean crossBoundaries)Description copied from interface:
Node
Traverses down the tree to find all the descendant instances of type descendantType.
findDescendantsOfType
in interface Node
targetType
- class which you want to find.
results
- list to store the matching descendants
crossBoundaries
- if false
, recursion stops for nodes for which Node.isFindBoundary()
is true
public <T> List<T> findChildrenOfType(Class<T> targetType)Description copied from interface:
Node
Traverses the children to find all the instances of type childType or one of its subclasses.
findChildrenOfType
in interface Node
targetType
- class which you want to find.
if traversal of the entire tree is needed.
public boolean isFindBoundary()Description copied from interface:
Node
Returns true if this node is considered a boundary by traversal methods. Traversal methods such as
Node.getFirstDescendantOfType(Class)
don't look past such boundaries by default, which is usually the expected thing to do. For example, in Java, lambdas and nested classes are considered find boundaries.
Note: This attribute is deprecated for XPath queries. It is not useful for XPath queries and will be removed with PMD 7.0.0.
isFindBoundary
in interface Node
@Deprecated public Document getAsDocument()
Deprecated.
Description copied from interface:Node
Get a DOM Document which contains Elements and Attributes representative of this Node and it's children. Essentially a DOM tree representation of the Node AST, thereby allowing tools which can operate upon DOM to also indirectly operate on the AST.
getAsDocument
in interface Node
protected void appendElement(Node parentNode)
public <T> T getFirstDescendantOfType(Class<T> descendantType)Description copied from interface:
Node
Traverses down the tree to find the first descendant instance of type descendantType without crossing find boundaries.
getFirstDescendantOfType
in interface Node
descendantType
- class which you want to find.
null
if none found.
public <T> T getFirstChildOfType(Class<T> childType)Description copied from interface:
Node
Traverses the children to find the first instance of type childType.
getFirstChildOfType
in interface Node
childType
- class which you want to find.
null
if none found.
if traversal of the entire tree is needed.
public final <T> boolean hasDescendantOfType(Class<T> type)Description copied from interface:
Node
Finds if this node contains a descendant of the given type without crossing find boundaries.
hasDescendantOfType
in interface Node
type
- the node type to search
true
if there is at least one descendant of the given type
@Deprecated public final boolean hasDecendantOfAnyType(Class<?>... types)
Returns true if this node has a descendant of any type among the provided types.
types
- Types to test
@Deprecated public final boolean hasDescendantOfAnyType(Class<?>... types)
Returns true if this node has a descendant of any type among the provided types.
types
- Types to test
public List<Node> findChildNodesWithXPath(String xpathString) throws org.jaxen.JaxenExceptionDescription copied from interface:
Node
Returns all the nodes matching the xpath expression.
findChildNodesWithXPath
in interface Node
xpathString
- the expression to check
org.jaxen.JaxenException
- if the xpath is incorrect or fails altogether
public boolean hasDescendantMatchingXPath(String xpathString)Description copied from interface:
Node
Checks whether at least one descendant matches the xpath expression.
hasDescendantMatchingXPath
in interface Node
xpathString
- the expression to check
@Deprecated public Object getUserData()
Deprecated.
Description copied from interface:Node
Get the user data associated with this node. By default there is no data, unless it has been set via
Node.setUserData(Object)
.
getUserData
in interface Node
@Deprecated public void setUserData(Object userData)
Deprecated.
Description copied from interface:Node
Set the user data associated with this node.
PMD itself will never set user data onto a node. Nor should any Rule implementation, as the AST nodes are shared between concurrently executing Rules (i.e. it is not thread-safe).
This API is most useful for external applications looking to leverage PMD's robust support for AST structures, in which case application specific annotations on the AST nodes can be quite useful.
setUserData
in interface Node
userData
- The data to set on this node.
public DataMap<DataMap.DataKey<?,?>> getUserMap()Description copied from interface:
Node
getUserMap
in interface Node
@Deprecated public GenericToken jjtGetFirstToken()
@Deprecated public void jjtSetFirstToken(GenericToken token)
@Deprecated public GenericToken jjtGetLastToken()
@Deprecated public void jjtSetLastToken(GenericToken token)
public Iterable<? extends Node> children()Description copied from interface:
Node
Returns an iterable enumerating the children of this node. Use it with a foreach loop:
for (Node child : node.children()) {
// process child
}
This method's return type will be changed to NodeStream in PMD 7, which is a more powerful kind of iterable. The change will be source compatible.
@Deprecated @InternalApi public void remove()Description copied from interface:
Node
Remove the current node from its parent.
@Deprecated @InternalApi public void removeChildAtIndex(int childIndex)Description copied from interface:
Node
This method tells the node to remove the child node at the given index from the node's list of children, if any; if not, no changes are done.
removeChildAtIndex
in interface Node
childIndex
- The index of the child to be removed
public String getXPathNodeName()
Gets the name of the node that is used to match it with XPath queries.
This default implementation adds compatibility with the previous way to get the xpath node name, which used Object.toString()
.
Please override it. It will be removed in version 7.0.0.
getXPathNodeName
in interface Node
@Deprecated public String toString()
public Iterator<Attribute> getXPathAttributesIterator()Description copied from interface:
Node
Returns an iterator enumerating all the attributes that are available from XPath for this node.
getXPathAttributesIterator
in interface Node
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4