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
,Serializable
The implementation of
DetailAST
. This should only be directly used to
create custom AST nodes.- See Also:
-
Field Summary
Fields inherited from class antlr.CommonASTWithHiddenTokens
hiddenAfter, hiddenBefore
Fields inherited from class antlr.BaseAST
down, right
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChild
(antlr.collections.AST ast) void
addNextSibling
(DetailAST ast) Add next sibling.void
Add previous sibling.boolean
branchContains
(int type) Checks if this branch of the parse tree contains a token of the provided type.findFirstToken
(int type) Returns the first child token that makes a specified type.int
Returns the number of child nodes one level below this node.int
getChildCount
(int type) Returns the number of direct child tokens that have the specified type.int
Gets column number.Get the first child of this AST.Gets the last child node.int
Gets line number.Get the next sibling in line after this one.Returns the parent token.Returns the previous sibling or null if no such sibling exists.boolean
Returns whether this AST has any children.void
initialize
(antlr.collections.AST ast) void
initialize
(antlr.Token tok) void
setColumnNo
(int columnNo) Set column number.void
setFirstChild
(antlr.collections.AST ast) void
setLineNo
(int lineNo) Set line number.void
setNextSibling
(antlr.collections.AST ast) toString()
Methods inherited from class antlr.CommonASTWithHiddenTokens
getHiddenAfter, getHiddenBefore
Methods inherited from class antlr.CommonAST
getText, getType, initialize, setText, setType
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
-
Constructor Details
-
DetailAstImpl
public DetailAstImpl()
-
-
Method Details
-
initialize
public void initialize(antlr.Token tok) - Specified by:
initialize
in interfaceantlr.collections.AST
- Overrides:
initialize
in classantlr.CommonASTWithHiddenTokens
-
initialize
public void initialize(antlr.collections.AST ast) - Specified by:
initialize
in interfaceantlr.collections.AST
- Overrides:
initialize
in classantlr.CommonASTWithHiddenTokens
-
setFirstChild
public void setFirstChild(antlr.collections.AST ast) - Specified by:
setFirstChild
in interfaceantlr.collections.AST
- Overrides:
setFirstChild
in classantlr.BaseAST
-
setNextSibling
public void setNextSibling(antlr.collections.AST ast) - Specified by:
setNextSibling
in interfaceantlr.collections.AST
- Overrides:
setNextSibling
in classantlr.BaseAST
-
addPreviousSibling
Add previous sibling.- Parameters:
ast
- DetailAST object.
-
addNextSibling
Add next sibling.- Parameters:
ast
- DetailAST object.
-
addChild
public void addChild(antlr.collections.AST ast) - Specified by:
addChild
in interfaceantlr.collections.AST
- Overrides:
addChild
in classantlr.BaseAST
-
getChildCount
public int getChildCount()Description copied from interface:DetailAST
Returns the number of child nodes one level below this node. That is is does not recurse down the tree.- Specified by:
getChildCount
in interfaceDetailAST
- Returns:
- the number of child nodes
-
getChildCount
public int getChildCount(int type) Description copied from interface:DetailAST
Returns the number of direct child tokens that have the specified type.- Specified by:
getChildCount
in interfaceDetailAST
- Parameters:
type
- the token type to match- Returns:
- the number of matching token
-
getParent
Description copied from interface:DetailAST
Returns the parent token. -
getLineNo
public int getLineNo()Description copied from interface:DetailAST
Gets line number. -
setLineNo
public void setLineNo(int lineNo) Set line number.- Parameters:
lineNo
- line number.
-
getColumnNo
public int getColumnNo()Description copied from interface:DetailAST
Gets column number.- Specified by:
getColumnNo
in interfaceDetailAST
- Returns:
- the column number
-
setColumnNo
public void setColumnNo(int columnNo) Set column number.- Parameters:
columnNo
- column number.
-
getLastChild
Description copied from interface:DetailAST
Gets the last child node.- Specified by:
getLastChild
in interfaceDetailAST
- Returns:
- the last child node
-
branchContains
public boolean branchContains(int type) Description copied from interface:DetailAST
Checks if this branch of the parse tree contains a token of the provided type.- Specified by:
branchContains
in interfaceDetailAST
- Parameters:
type
- a TokenType- Returns:
- true if and only if this branch (including this node)
contains a token of type
type
.
-
getPreviousSibling
Description copied from interface:DetailAST
Returns the previous sibling or null if no such sibling exists.- Specified by:
getPreviousSibling
in interfaceDetailAST
- Returns:
- the previous sibling or null if no such sibling exists.
-
findFirstToken
Description copied from interface:DetailAST
Returns the first child token that makes a specified type.- Specified by:
findFirstToken
in interfaceDetailAST
- Parameters:
type
- the token type to match- Returns:
- the matching token, or null if no match
-
toString
- Specified by:
toString
in interfaceantlr.collections.AST
- Overrides:
toString
in classantlr.BaseAST
-
getNextSibling
Description copied from interface:DetailAST
Get the next sibling in line after this one.- Specified by:
getNextSibling
in interfaceantlr.collections.AST
- Specified by:
getNextSibling
in interfaceDetailAST
- Overrides:
getNextSibling
in classantlr.BaseAST
- Returns:
- the next sibling or null if none.
-
getFirstChild
Description copied from interface:DetailAST
Get the first child of this AST.- Specified by:
getFirstChild
in interfaceantlr.collections.AST
- Specified by:
getFirstChild
in interfaceDetailAST
- Overrides:
getFirstChild
in classantlr.BaseAST
- Returns:
- the first child or null if none.
-
hasChildren
public boolean hasChildren()Description copied from interface:DetailAST
Returns whether this AST has any children.- Specified by:
hasChildren
in interfaceDetailAST
- Returns:
true
if this AST has any children.
-