public class SimpleNodeUtil
extends java.lang.Object
Constructor and Description |
---|
SimpleNodeUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
dump(SimpleNode node,
java.lang.String prefix) |
static void |
dump(SimpleNode node,
java.lang.String prefix,
boolean showWhitespace) |
static SimpleNode |
findChild(SimpleNode parent,
java.lang.Class childType) |
static SimpleNode |
findChild(SimpleNode parent,
java.lang.Class childType,
int index) |
static SimpleNode[] |
findChildren(SimpleNode parent)
Returns all children of the node.
|
static SimpleNode[] |
findChildren(SimpleNode parent,
java.lang.Class childType) |
static Token |
findToken(SimpleNode node,
int tokenType) |
static java.util.List |
getChildren(SimpleNode node)
Returns a list of children, both nodes and tokens.
|
static java.util.List |
getChildren(SimpleNode node,
boolean getNodes,
boolean getTokens)
Returns a list of children, optionally nodes and tokens.
|
static java.util.List |
getChildrenSerially(SimpleNode node)
Returns a list of child tokens, non-hierarchically.
|
static java.util.List |
getChildrenSerially(SimpleNode node,
java.util.List list)
Returns a list of child tokens, non-hierarchically.
|
static Token |
getLeadingToken(SimpleNode node,
int tokenType)
Returns whether the node has a matching token, occurring prior to any
non-tokens (i.e., before any child nodes).
|
static java.util.List |
getLeadingTokens(SimpleNode node)
Returns the tokens preceding the first child of the node.
|
static int |
getLevel(SimpleNode node)
Returns a numeric "level" for the node.
|
protected static java.lang.String |
getLocation(Token t1,
Token t2) |
static SimpleNode |
getParent(SimpleNode node)
Returns the parent node.
|
static java.util.List |
getTokens(SimpleNode node)
Returns the tokens for a node.
|
static boolean |
hasChildren(SimpleNode node)
Returns whether the node has any children.
|
static boolean |
hasLeadingToken(SimpleNode node,
int tokenType)
Returns whether the node has a matching token, occurring prior to any
non-tokens (i.e., before any child nodes).
|
static void |
print(SimpleNode node) |
static void |
print(SimpleNode node,
java.lang.String prefix) |
static java.lang.String |
toString(SimpleNode node)
Returns the token images for the node.
|
public static java.lang.String toString(SimpleNode node)
public static boolean hasChildren(SimpleNode node)
public static SimpleNode getParent(SimpleNode node)
public static java.util.List getChildren(SimpleNode node)
public static java.util.List getChildren(SimpleNode node, boolean getNodes, boolean getTokens)
public static SimpleNode findChild(SimpleNode parent, java.lang.Class childType)
public static SimpleNode findChild(SimpleNode parent, java.lang.Class childType, int index)
public static java.util.List getChildrenSerially(SimpleNode node)
public static java.util.List getChildrenSerially(SimpleNode node, java.util.List list)
public static SimpleNode[] findChildren(SimpleNode parent, java.lang.Class childType)
public static SimpleNode[] findChildren(SimpleNode parent)
public static java.util.List getTokens(SimpleNode node)
public static Token findToken(SimpleNode node, int tokenType)
public static boolean hasLeadingToken(SimpleNode node, int tokenType)
public static Token getLeadingToken(SimpleNode node, int tokenType)
public static java.util.List getLeadingTokens(SimpleNode node)
public static void print(SimpleNode node)
public static void print(SimpleNode node, java.lang.String prefix)
public static void dump(SimpleNode node, java.lang.String prefix)
public static void dump(SimpleNode node, java.lang.String prefix, boolean showWhitespace)
protected static java.lang.String getLocation(Token t1, Token t2)
public static int getLevel(SimpleNode node)