Interface DetailAST

All Known Implementing Classes:
DetailAstImpl

public interface DetailAST
A 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 Details

    • getChildCount

      int getChildCount()
      Returns the number of child nodes one level below this node. That is is does not recurse down the tree.
      Returns:
      the number of child nodes
    • getChildCount

      int getChildCount(int type)
      Returns the number of direct child tokens that have the specified type.
      Parameters:
      type - the token type to match
      Returns:
      the number of matching token
    • getParent

      DetailAST getParent()
      Returns the parent token.
      Returns:
      the parent token
    • getText

      String getText()
      Gets the text of this AST.
      Returns:
      the text.
    • getType

      int getType()
      Gets the type of this AST.
      Returns:
      the type.
    • getLineNo

      int getLineNo()
      Gets line number.
      Returns:
      the line number
    • getColumnNo

      int getColumnNo()
      Gets column number.
      Returns:
      the column number
    • getLastChild

      DetailAST getLastChild()
      Gets the last child node.
      Returns:
      the last child node
    • branchContains

      boolean branchContains(int type)
      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.
    • getPreviousSibling

      DetailAST getPreviousSibling()
      Returns the previous sibling or null if no such sibling exists.
      Returns:
      the previous sibling or null if no such sibling exists.
    • findFirstToken

      DetailAST findFirstToken(int type)
      Returns 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
    • getNextSibling

      DetailAST getNextSibling()
      Get the next sibling in line after this one.
      Returns:
      the next sibling or null if none.
    • getFirstChild

      DetailAST getFirstChild()
      Get the first child of this AST.
      Returns:
      the first child or null if none.
    • getNumberOfChildren

      @Deprecated int getNumberOfChildren()
      Deprecated.
      This method will be removed in a future release. Use getChildCount() instead.
      Get number of children of this AST.
      Returns:
      the number of children.
    • hasChildren

      boolean hasChildren()
      Returns whether this AST has any children.
      Returns:
      true if this AST has any children.