Class AbstractJjtreeNode<N extends Node>
- java.lang.Object
-
- net.sourceforge.pmd.lang.ast.AbstractNode
-
- net.sourceforge.pmd.lang.ast.impl.javacc.AbstractJjtreeNode<N>
-
- All Implemented Interfaces:
Node
@Experimental public abstract class AbstractJjtreeNode<N extends Node> extends AbstractNode
Base class for node produced by JJTree. JJTree specific functionality present on the API ofNode
andAbstractNode
will be moved here for 7.0.0.This is experimental because it's expected to change for 7.0.0 in unforeseeable ways. Don't use it directly, use the node interfaces.
-
-
Field Summary
-
Fields inherited from class net.sourceforge.pmd.lang.ast.AbstractNode
beginColumn, beginLine, childIndex, children, endColumn, endLine, firstToken, id, lastToken, parent
-
-
Constructor Summary
Constructors Constructor Description AbstractJjtreeNode(int id)
AbstractJjtreeNode(int id, int theBeginLine, int theEndLine, int theBeginColumn, int theEndColumn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterable<? extends N>
children()
Returns an iterable enumerating the children of this node.N
getChild(int index)
Returns the child of this node at the given index.N
getParent()
Returns the parent of this node, or null if this is the root of the tree.-
Methods inherited from class net.sourceforge.pmd.lang.ast.AbstractNode
appendElement, findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, findDescendantsOfType, getAsDocument, getBeginColumn, getBeginLine, getDataFlowNode, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfAnyType, getFirstParentOfType, getImage, getIndexInParent, getNthParent, getNumChildren, getParentsOfType, getUserData, getUserMap, getXPathAttributesIterator, getXPathNodeName, hasDecendantOfAnyType, hasDescendantMatchingXPath, hasDescendantOfAnyType, hasDescendantOfType, hasImageEqualTo, isFindBoundary, isSingleLine, jjtAddChild, jjtClose, jjtGetChild, jjtGetChildIndex, jjtGetFirstToken, jjtGetId, jjtGetLastToken, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetChildIndex, jjtSetFirstToken, jjtSetLastToken, jjtSetParent, remove, removeChildAtIndex, setDataFlowNode, setImage, setUserData, testingOnlySetBeginColumn, testingOnlySetBeginLine, testingOnlySetEndColumn, testingOnlySetEndLine, toString
-
-
-
-
Method Detail
-
getChild
public N getChild(int index)
Description copied from interface:Node
Returns the child of this node at the given index.- Specified by:
getChild
in interfaceNode
- Overrides:
getChild
in classAbstractNode
-
getParent
public N getParent()
Description copied from interface:Node
Returns the parent of this node, or null if this is the root of the tree.This method should be preferred to
Node.jjtGetParent()
.- Specified by:
getParent
in interfaceNode
- Overrides:
getParent
in classAbstractNode
- Returns:
- The parent of this node
-
children
public Iterable<? extends N> 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.
- Specified by:
children
in interfaceNode
- Overrides:
children
in classAbstractNode
- Returns:
- A new iterable for the children of this node
-
-