Package com.puppycrawl.tools.checkstyle
Class DetailAstImpl
- java.lang.Object
-
- antlr.BaseAST
-
- antlr.CommonAST
-
- antlr.CommonASTWithHiddenTokens
-
- com.puppycrawl.tools.checkstyle.DetailAstImpl
-
- All Implemented Interfaces:
antlr.collections.AST,DetailAST,java.io.Serializable
public final class DetailAstImpl extends antlr.CommonASTWithHiddenTokens implements DetailAST
The implementation ofDetailAST. This should only be directly used to create custom AST nodes.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DetailAstImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChild(antlr.collections.AST ast)voidaddNextSibling(DetailAST ast)Add next sibling.voidaddPreviousSibling(DetailAST ast)Add previous sibling.booleanbranchContains(int type)Checks if this branch of the parse tree contains a token of the provided type.DetailASTfindFirstToken(int type)Returns the first child token that makes a specified type.intgetChildCount()Returns 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.intgetColumnNo()Gets column number.DetailAstImplgetFirstChild()Get the first child of this AST.DetailASTgetLastChild()Gets the last child node.intgetLineNo()Gets line number.DetailAstImplgetNextSibling()Get the next sibling in line after this one.DetailASTgetParent()Returns the parent token.DetailASTgetPreviousSibling()Returns the previous sibling or null if no such sibling exists.booleanhasChildren()Returns whether this AST has any children.voidinitialize(antlr.collections.AST ast)voidinitialize(antlr.Token tok)voidsetColumnNo(int columnNo)Set column number.voidsetFirstChild(antlr.collections.AST ast)voidsetLineNo(int lineNo)Set line number.voidsetNextSibling(antlr.collections.AST ast)java.lang.StringtoString()-
Methods inherited from class antlr.BaseAST
decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getColumn, getLine, getNumberOfChildren, getTokenNames, removeChildren, setVerboseStringConversion, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.puppycrawl.tools.checkstyle.api.DetailAST
getNumberOfChildren, getText, getType
-
-
-
-
Method Detail
-
initialize
public void initialize(antlr.Token tok)
- Specified by:
initializein interfaceantlr.collections.AST- Overrides:
initializein classantlr.CommonASTWithHiddenTokens
-
initialize
public void initialize(antlr.collections.AST ast)
- Specified by:
initializein interfaceantlr.collections.AST- Overrides:
initializein classantlr.CommonASTWithHiddenTokens
-
setFirstChild
public void setFirstChild(antlr.collections.AST ast)
- Specified by:
setFirstChildin interfaceantlr.collections.AST- Overrides:
setFirstChildin classantlr.BaseAST
-
setNextSibling
public void setNextSibling(antlr.collections.AST ast)
- Specified by:
setNextSiblingin interfaceantlr.collections.AST- Overrides:
setNextSiblingin classantlr.BaseAST
-
addPreviousSibling
public void addPreviousSibling(DetailAST ast)
Add previous sibling.- Parameters:
ast- DetailAST object.
-
addNextSibling
public void addNextSibling(DetailAST ast)
Add next sibling.- Parameters:
ast- DetailAST object.
-
addChild
public void addChild(antlr.collections.AST ast)
- Specified by:
addChildin interfaceantlr.collections.AST- Overrides:
addChildin classantlr.BaseAST
-
getChildCount
public int getChildCount()
Description copied from interface:DetailASTReturns the number of child nodes one level below this node. That is is does not recurse down the tree.- Specified by:
getChildCountin interfaceDetailAST- Returns:
- the number of child nodes
-
getChildCount
public int getChildCount(int type)
Description copied from interface:DetailASTReturns the number of direct child tokens that have the specified type.- Specified by:
getChildCountin interfaceDetailAST- Parameters:
type- the token type to match- Returns:
- the number of matching token
-
getParent
public DetailAST getParent()
Description copied from interface:DetailASTReturns the parent token.
-
getLineNo
public int getLineNo()
Description copied from interface:DetailASTGets line number.
-
setLineNo
public void setLineNo(int lineNo)
Set line number.- Parameters:
lineNo- line number.
-
getColumnNo
public int getColumnNo()
Description copied from interface:DetailASTGets column number.- Specified by:
getColumnNoin interfaceDetailAST- Returns:
- the column number
-
setColumnNo
public void setColumnNo(int columnNo)
Set column number.- Parameters:
columnNo- column number.
-
getLastChild
public DetailAST getLastChild()
Description copied from interface:DetailASTGets the last child node.- Specified by:
getLastChildin interfaceDetailAST- Returns:
- the last child node
-
branchContains
public boolean branchContains(int type)
Description copied from interface:DetailASTChecks if this branch of the parse tree contains a token of the provided type.- Specified by:
branchContainsin interfaceDetailAST- Parameters:
type- a TokenType- Returns:
- true if and only if this branch (including this node)
contains a token of type
type.
-
getPreviousSibling
public DetailAST getPreviousSibling()
Description copied from interface:DetailASTReturns the previous sibling or null if no such sibling exists.- Specified by:
getPreviousSiblingin interfaceDetailAST- Returns:
- the previous sibling or null if no such sibling exists.
-
findFirstToken
public DetailAST findFirstToken(int type)
Description copied from interface:DetailASTReturns the first child token that makes a specified type.- Specified by:
findFirstTokenin interfaceDetailAST- Parameters:
type- the token type to match- Returns:
- the matching token, or null if no match
-
toString
public java.lang.String toString()
- Specified by:
toStringin interfaceantlr.collections.AST- Overrides:
toStringin classantlr.BaseAST
-
getNextSibling
public DetailAstImpl getNextSibling()
Description copied from interface:DetailASTGet the next sibling in line after this one.- Specified by:
getNextSiblingin interfaceantlr.collections.AST- Specified by:
getNextSiblingin interfaceDetailAST- Overrides:
getNextSiblingin classantlr.BaseAST- Returns:
- the next sibling or null if none.
-
getFirstChild
public DetailAstImpl getFirstChild()
Description copied from interface:DetailASTGet the first child of this AST.- Specified by:
getFirstChildin interfaceantlr.collections.AST- Specified by:
getFirstChildin interfaceDetailAST- Overrides:
getFirstChildin classantlr.BaseAST- Returns:
- the first child or null if none.
-
hasChildren
public boolean hasChildren()
Description copied from interface:DetailASTReturns whether this AST has any children.- Specified by:
hasChildrenin interfaceDetailAST- Returns:
trueif this AST has any children.
-
-