org.incava.java

Class SimpleNodeUtil

public class SimpleNodeUtil extends Object

Miscellaneous routines for the SimpleNode.
Method Summary
static voiddump(SimpleNode node, String prefix)
static voiddump(SimpleNode node, String prefix, boolean showWhitespace)
static SimpleNodefindChild(SimpleNode parent, Class childType)
static SimpleNodefindChild(SimpleNode parent, Class childType, int index)
static SimpleNode[]findChildren(SimpleNode parent, Class childType)
static SimpleNode[]findChildren(SimpleNode parent)
Returns all children of the node.
static TokenfindToken(SimpleNode node, int tokenType)
static ListgetChildren(SimpleNode node)
Returns a list of children, both nodes and tokens.
static ListgetChildren(SimpleNode node, boolean getNodes, boolean getTokens)
Returns a list of children, optionally nodes and tokens.
static ListgetChildrenSerially(SimpleNode node)
Returns a list of child tokens, non-hierarchically.
static ListgetChildrenSerially(SimpleNode node, List list)
Returns a list of child tokens, non-hierarchically.
static TokengetLeadingToken(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 ListgetLeadingTokens(SimpleNode node)
Returns the tokens preceding the first child of the node.
static intgetLevel(SimpleNode node)
Returns a numeric "level" for the node.
protected static StringgetLocation(Token t1, Token t2)
static SimpleNodegetParent(SimpleNode node)
Returns the parent node.
static ListgetTokens(SimpleNode node)
Returns the tokens for a node.
static booleanhasChildren(SimpleNode node)
Returns whether the node has any children.
static booleanhasLeadingToken(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 voidprint(SimpleNode node)
static voidprint(SimpleNode node, String prefix)
static StringtoString(SimpleNode node)
Returns the token images for the node.

Method Detail

dump

public static void dump(SimpleNode node, String prefix)

dump

public static void dump(SimpleNode node, String prefix, boolean showWhitespace)

findChild

public static SimpleNode findChild(SimpleNode parent, Class childType)

findChild

public static SimpleNode findChild(SimpleNode parent, Class childType, int index)

findChildren

public static SimpleNode[] findChildren(SimpleNode parent, Class childType)

findChildren

public static SimpleNode[] findChildren(SimpleNode parent)
Returns all children of the node.

findToken

public static Token findToken(SimpleNode node, int tokenType)

getChildren

public static List getChildren(SimpleNode node)
Returns a list of children, both nodes and tokens.

getChildren

public static List getChildren(SimpleNode node, boolean getNodes, boolean getTokens)
Returns a list of children, optionally nodes and tokens.

getChildrenSerially

public static List getChildrenSerially(SimpleNode node)
Returns a list of child tokens, non-hierarchically.

getChildrenSerially

public static List getChildrenSerially(SimpleNode node, List list)
Returns a list of child tokens, non-hierarchically.

getLeadingToken

public 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).

getLeadingTokens

public static List getLeadingTokens(SimpleNode node)
Returns the tokens preceding the first child of the node.

getLevel

public static int getLevel(SimpleNode node)
Returns a numeric "level" for the node. Zero is public or abstract, one is protected, two is package, and three is private.

getLocation

protected static String getLocation(Token t1, Token t2)

getParent

public static SimpleNode getParent(SimpleNode node)
Returns the parent node.

getTokens

public static List getTokens(SimpleNode node)
Returns the tokens for a node.

hasChildren

public static boolean hasChildren(SimpleNode node)
Returns whether the node has any children.

hasLeadingToken

public 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).

print

public static void print(SimpleNode node)

print

public static void print(SimpleNode node, String prefix)

toString

public static String toString(SimpleNode node)
Returns the token images for the node.