Interface DetailAST
- All Known Implementing Classes:
- DetailAstImpl
public interface DetailAST
An interface of Checkstyle's AST nodes for traversing trees generated from the
 Java code. The main purpose of this interface is to abstract away ANTLR
 specific classes from API package so other libraries won't require it.
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionbooleanbranchContains(int type) Deprecated.Usage of this method is no longer accepted.findFirstToken(int type) Returns the first child token that makes a specified type.intReturns the number of child nodes one level below this node.intgetChildCount(int type) Returns the number of direct child tokens that have the specified type.intGets column number.Get the first child of this AST.Gets the last child node.intGets line number.Get the next sibling in line after this one.intDeprecated.This method will be removed in a future release.Returns the parent token.Returns the previous sibling or null if no such sibling exists.getText()Gets the text of this AST.intgetType()Gets the type of this AST.booleanReturns whether this AST has any children.
- 
Method Details- 
getChildCountint getChildCount()Returns the number of child nodes one level below this node. That is, does not recurse down the tree.- Returns:
- the number of child nodes
 
- 
getChildCountReturns the number of direct child tokens that have the specified type.- Parameters:
- type- the token type to match
- Returns:
- the number of matching token
 
- 
getParentReturns the parent token.- Returns:
- the parent token
 
- 
getTextGets the text of this AST.- Returns:
- the text.
 
- 
getTypeint getType()Gets the type of this AST.- Returns:
- the type.
 
- 
getLineNoint getLineNo()Gets line number.- Returns:
- the line number
 
- 
getColumnNoint getColumnNo()Gets column number.- Returns:
- the column number
 
- 
getLastChildGets the last child node.- Returns:
- the last child node
 
- 
branchContainsDeprecated.Usage of this method is no longer accepted. We encourage traversal of subtrees to be written per the needs of each check to avoid unintended side effects.Checks if this branch of the parse tree contains a token of the provided type.- Parameters:
- type- a TokenType
- Returns:
- true if and only if this branch (including this node)
     contains a token of type type.
 
- 
getPreviousSiblingReturns the previous sibling or null if no such sibling exists.- Returns:
- the previous sibling or null if no such sibling exists.
 
- 
findFirstTokenReturns the first child token that makes a specified type.- Parameters:
- type- the token type to match
- Returns:
- the matching token, or null if no match
 
- 
getNextSiblingGet the next sibling in line after this one.- Returns:
- the next sibling or null if none.
 
- 
getFirstChildGet the first child of this AST.- Returns:
- the first child or null if none.
 
- 
getNumberOfChildrenDeprecated.This method will be removed in a future release. UsegetChildCount()instead.Get number of children of this AST.- Returns:
- the number of children.
 
- 
hasChildrenboolean hasChildren()Returns whether this AST has any children.- Returns:
- trueif this AST has any children.
 
 
-