public final class JavaNodeHelper
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static de.hunsicker.antlr.collections.AST |
advanceToFirstNonParen(de.hunsicker.antlr.collections.AST lparen)
Advance to the first non-LPAREN node for the rare case where both operands are
enclosed by several parenthesis groups, e.g.
|
static java.lang.String |
getDottedName(de.hunsicker.antlr.collections.AST tree)
Builds the dotted name string representation of the object contained within the
JavaNode.
|
static de.hunsicker.antlr.collections.AST |
getFirstChainLink(de.hunsicker.antlr.collections.AST node)
Determines the first chain link in the given chain.
|
static de.hunsicker.antlr.collections.AST |
getFirstChild(de.hunsicker.antlr.collections.AST node,
int type)
Return the first occurrence of the child node with the given type, if any.
|
static JavaNode |
getLastChild(de.hunsicker.antlr.collections.AST node)
DOCUMENT ME!
|
static boolean |
isAbstractMethod(de.hunsicker.antlr.collections.AST node)
Determines whether the given node represents an abstract method.
|
static boolean |
isAnonymousInnerClass(de.hunsicker.antlr.collections.AST node)
Determines wether the given node represents an anonymous inner class or interface.
|
static boolean |
isBlockNext(de.hunsicker.antlr.collections.AST node)
Determines whether the given node will be followed by a block.
|
static boolean |
isChained(de.hunsicker.antlr.collections.AST node)
Determines whether the given node is part of a chain.
|
static boolean |
isEmptyBlock(de.hunsicker.antlr.collections.AST node)
Determines whether the given node, which represents a block, is empty.
|
static boolean |
isFreestandingBlock(JavaNode node)
Determines whether the given node represents a freestanding block.
|
static boolean |
isInnerClass(de.hunsicker.antlr.collections.AST node)
Determines whether the given node represents an inner class or interface.
|
static boolean |
isLocalVariable(de.hunsicker.antlr.collections.AST node)
Determines wether the given node represents a local variable.
|
public static boolean isAbstractMethod(de.hunsicker.antlr.collections.AST node)
node
- a METHOD_DEF node.true
if the given node represents an abstract method.java.lang.IllegalArgumentException
- if node.getType() !=
METHOD_DEF
public static boolean isAnonymousInnerClass(de.hunsicker.antlr.collections.AST node)
node
- a CLASS_DEF or INTERFACE_DEF node.true
if the given node represents an anonymous inner class.java.lang.IllegalArgumentException
- if node.getType() != CLASS_DEF ||
INTERFACE_DEF
public static boolean isBlockNext(de.hunsicker.antlr.collections.AST node)
node
- a node.true
if the following node marks the start of a block. Note
that if node == null
this method always returns
false
.public static boolean isChained(de.hunsicker.antlr.collections.AST node)
node
- the first child of a chain.true
if the given node is part of a chain.public static java.lang.String getDottedName(de.hunsicker.antlr.collections.AST tree)
tree
- the JavaNode containing the entire hierarchy of the object.public static boolean isEmptyBlock(de.hunsicker.antlr.collections.AST node)
node
- SLIST or OBJBLOCK.true
if the given node is empty, i.e. contains no siblings.java.lang.IllegalArgumentException
- if the given node is not of type SLIST, CASESLIST
or OBJBLOCK.public static de.hunsicker.antlr.collections.AST getFirstChainLink(de.hunsicker.antlr.collections.AST node)
node
- the last chain link in the node chain.isChained(de.hunsicker.antlr.collections.AST)
public static de.hunsicker.antlr.collections.AST getFirstChild(de.hunsicker.antlr.collections.AST node, int type)
node
- node to search.type
- type to search for.null
if no
child node with the given type exists.public static boolean isFreestandingBlock(JavaNode node)
node
- a node representing a block.true
if node represents a freestanding block.public static boolean isInnerClass(de.hunsicker.antlr.collections.AST node)
node
- a CLASS_DEF or INTERFACE_DEF node.true
if the node represents an inner class or interface.java.lang.IllegalArgumentException
- if node.getType() != CLASS_DEF ||
INTERFACE_DEF
public static JavaNode getLastChild(de.hunsicker.antlr.collections.AST node)
node
- DOCUMENT ME!public static boolean isLocalVariable(de.hunsicker.antlr.collections.AST node)
node
- a VARIABLE_DEF node.true
if the given node represents a local variable.java.lang.IllegalArgumentException
- if node.getType() !=
JavaTokenTypes.VARIABLE_DEF
.public static de.hunsicker.antlr.collections.AST advanceToFirstNonParen(de.hunsicker.antlr.collections.AST lparen)
lparen
- the first LPAREN child of an expression node.null
if no such node
exists.java.lang.NullPointerException
- if lparen == null
java.lang.IllegalArgumentException
- if lparen.getType() !=
JavaTokenTypes.LPAREN
Submit a bug or feature.
For further information and documentation, visit the official Jalopy website.
This page generated: March 30 2013