|
Jalopy 1.0b10 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.hunsicker.jalopy.language.JavaNodeHelper
Some common helpers for dealing with the nodes of a Java AST.
Method Summary | |
static AST |
advanceToFirstNonParen(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 String |
getDottedName(AST tree)
Builds the dotted name string representation of the object contained within the JavaNode. |
static AST |
getFirstChainLink(AST node)
Determines the first chain link in the given chain. |
static AST |
getFirstChild(AST node,
int type)
Return the first occurrence of the child node with the given type, if any. |
static JavaNode |
getLastChild(AST node)
DOCUMENT ME! |
static boolean |
isAbstractMethod(AST node)
Determines whether the given node represents an abstract method. |
static boolean |
isAnonymousInnerClass(AST node)
Determines wether the given node represents an anonymous inner class or interface. |
static boolean |
isBlockNext(AST node)
Determines whether the given node will be followed by a block. |
static boolean |
isChained(AST node)
Determines whether the given node is part of a chain. |
static boolean |
isEmptyBlock(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(AST node)
Determines whether the given node represents an inner class or interface. |
static boolean |
isLocalVariable(AST node)
Determines wether the given node represents a local variable. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static boolean isAbstractMethod(AST node)
node
- a METHOD_DEF node.true
if the given node represents an abstract method.IllegalArgumentException
- if node.getType() !=
METHOD_DEF
public static boolean isAnonymousInnerClass(AST node)
node
- a CLASS_DEF or INTERFACE_DEF node.true
if the given node represents an anonymous inner class.IllegalArgumentException
- if node.getType() != CLASS_DEF ||
INTERFACE_DEF
public static boolean isBlockNext(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(AST node)
node
- the first child of a chain.true
if the given node is part of a chain.public static String getDottedName(AST tree)
tree
- the JavaNode containing the entire hierarchy of the object.public static boolean isEmptyBlock(AST node)
node
- SLIST or OBJBLOCK.true
if the given node is empty, i.e. contains no siblings.IllegalArgumentException
- if the given node is not of type SLIST, CASESLIST
or OBJBLOCK.public static AST getFirstChainLink(AST node)
node
- the last chain link in the node chain.isChained(de.hunsicker.antlr.collections.AST)
public static AST getFirstChild(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(AST node)
node
- a CLASS_DEF or INTERFACE_DEF node.true
if the node represents an inner class or interface.IllegalArgumentException
- if node.getType() != CLASS_DEF ||
INTERFACE_DEF
public static JavaNode getLastChild(AST node)
node
- DOCUMENT ME!public static boolean isLocalVariable(AST node)
node
- a VARIABLE_DEF node.true
if the given node represents a local variable.IllegalArgumentException
- if node.getType() !=
JavaTokenTypes.VARIABLE_DEF
.public static AST advanceToFirstNonParen(AST lparen)
lparen
- the first LPAREN child of an expression node.null
if no such node
exists.NullPointerException
- if lparen == null
IllegalArgumentException
- if lparen.getType() !=
JavaTokenTypes.LPAREN
|
Jalopy 1.0b10 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |