| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| public static interface | ASTUtil.FilterPredicate
Filters nodes out of a tree. |
| public abstract static class | ASTUtil.IncludePredicate
A predicate that uses inclusion, rather than exclusion semantics. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static void | |
| public static List | |
| public static AST | Returns: AST - A single node tree.The factory. astFactory, int The node type. type, String The node text. text)
Deprecated
silly
Creates a single node AST.
|
| private static ASTArray | |
| public static AST | Returns: AST - A new sub-tree of the form "(parent child1 child2)"The AST factory. factory, int The type of the parent node. parentType, String The text of the parent node. parentText, AST The first child. child1, AST The second child. child2)Creates a 'binary operator' subtree, given the information about the parent and the two child nodex. |
| public static AST | Returns: AST - A new sub-tree of the form "(parent child)"The AST factory. factory, int The type of the parent node. parentType, String The text of the parent node. parentText, AST The child. child)Creates a single parent of the specified child (i.e. a 'unary operator' subtree). |
| public static AST | Returns: The created AST node.The factory. astFactory, int The node type. type, String The node text. text, AST The previous sibling. prevSibling)Creates a single node AST as a sibling of the passed prevSibling, taking care to reorganize the tree correctly to account for this newly created node. |
| public static AST | |
| private static Integer | |
| public static AST | Returns: the previous sibling of the childthe parent node parent, AST the child to find the previous sibling of child)Find the previous sibling in the parent for the given child. |
| public static AST | Returns: The first node of the specified type, or null if not found.The parent parent, int The type to find. type)Finds the first node of the specified type in the chain of children. |
| public static Map | Returns: The generated map.The *TokenTypes interface (or implementor of said interface). tokenTypeInterface)Method to generate a map of token type names, keyed by their token type values. |
| public static String | Returns: The token type name, *or* the integer value if the name could not be found.The class which defines the constant owner, int The value of the constant. value)
Deprecated
Use #getTokenTypeName instead
Get the name of a constant defined on the given class which has the given value.
|
| public static String | Returns: The list representation of the tree.The tree. n)Returns the 'list' representation with some brackets around it for debugging. |
| public static AST | Returns: The last direct child of 'n'.The parent n)Returns the last direct child of 'n'. |
| private static AST | |
| public static String | |
| private static void | |
| public static String | Returns: The corresponding name.The *TokenTypes interface (or one of its implementors). tokenTypeInterface, int The token type value. tokenType)Intended to retrieve the name of an AST token type based on the token type interface. |
| public static boolean | |
| public static void | insertChild(AST
the parent parent, AST the new first child child)Inserts the child as the first child of the parent, all other children are shifted over to the 'right'. |
| public static AST | Returns: The return is the same as the node parameter passed in.The node to insert node, AST The previous node at the sibling position
where we want this node inserted. prevSibling)Inserts a node into a child subtree as a particularly positioned sibling taking care to properly reorganize the tree to account for this new addition. |
| public static boolean | Returns: True if child is contained in the parent's collection of children.The node against which to testto be checked for children. fixture, AST The node to be tested as being a subtree child of the parent. test)Determine if a given node (test) is contained anywhere in the subtree of another given node (fixture). |
| public static void | makeSiblingOfParent(AST
the parent parent, AST the child child)Makes the child node a sibling of the parent, reconnecting all siblings. |
| ASTUtil | back to summary |
|---|---|
| private ASTUtil()
Deprecated (tellclovertoignorethis) Disallow instantiation. | |
| appendSibling | back to summary |
|---|---|
| public static void appendSibling(AST n, AST s) | |
| collectChildren | back to summary |
|---|---|
| public static List | |
| create | back to summary |
|---|---|
| public static AST create(ASTFactory astFactory, int type, String text)
Deprecated silly Creates a single node AST. TODO : this is silly, remove it...
| |
| createAstArray | back to summary |
|---|---|
| private static ASTArray createAstArray(ASTFactory factory, int size, int parentType, String parentText, AST child1) | |
| createBinarySubtree | back to summary |
|---|---|
| public static AST createBinarySubtree(ASTFactory factory, int parentType, String parentText, AST child1, AST child2) Creates a 'binary operator' subtree, given the information about the parent and the two child nodex.
| |
| createParent | back to summary |
|---|---|
| public static AST createParent(ASTFactory factory, int parentType, String parentText, AST child) Creates a single parent of the specified child (i.e. a 'unary operator' subtree).
| |
| createSibling | back to summary |
|---|---|
| public static AST createSibling(ASTFactory astFactory, int type, String text, AST prevSibling) Creates a single node AST as a sibling of the passed prevSibling, taking care to reorganize the tree correctly to account for this newly created node.
| |
| createTree | back to summary |
|---|---|
| public static AST createTree(ASTFactory factory, AST[] nestedChildren) | |
| extractIntegerValue | back to summary |
|---|---|
| private static Integer extractIntegerValue(Field field) | |
| findPreviousSibling | back to summary |
|---|---|
| public static AST findPreviousSibling(AST parent, AST child) Find the previous sibling in the parent for the given child. | |
| findTypeInChildren | back to summary |
|---|---|
| public static AST findTypeInChildren(AST parent, int type) Finds the first node of the specified type in the chain of children. | |
| generateTokenNameCache | back to summary |
|---|---|
| public static Map Method to generate a map of token type names, keyed by their token type values. | |
| getConstantName | back to summary |
|---|---|
| public static String getConstantName(Class<T> owner, int value)
Deprecated Use #getTokenTypeName instead Get the name of a constant defined on the given class which has the given value. Note, if multiple constants have this value, the first will be returned which is known to be different on different JVM implementations. | |
| getDebugString | back to summary |
|---|---|
| public static String getDebugString(AST n) Returns the 'list' representation with some brackets around it for debugging. | |
| getLastChild | back to summary |
|---|---|
| public static AST getLastChild(AST n) Returns the last direct child of 'n'. | |
| getLastSibling | back to summary |
|---|---|
| private static AST getLastSibling(AST a) Returns the last sibling of 'a'. | |
| getPathText | back to summary |
|---|---|
| public static String getPathText(AST n) | |
| getPathText | back to summary |
|---|---|
| private static void getPathText(StringBuffer buf, AST n) | |
| getTokenTypeName | back to summary |
|---|---|
| public static String getTokenTypeName(Class<T> tokenTypeInterface, int tokenType) Intended to retrieve the name of an AST token type based on the token type interface. However, this method can be used to look up the name of any constant defined on a class/interface based on the constant value. Note that if multiple constants have this value, the first will be returned which is known to be different on different JVM implementations. | |
| hasExactlyOneChild | back to summary |
|---|---|
| public static boolean hasExactlyOneChild(AST n) | |
| insertChild | back to summary |
|---|---|
| public static void insertChild(AST parent, AST child) Inserts the child as the first child of the parent, all other children are shifted over to the 'right'. | |
| insertSibling | back to summary |
|---|---|
| public static AST insertSibling(AST node, AST prevSibling) Inserts a node into a child subtree as a particularly positioned sibling taking care to properly reorganize the tree to account for this new addition. | |
| isSubtreeChild | back to summary |
|---|---|
| public static boolean isSubtreeChild(AST fixture, AST test) Determine if a given node (test) is contained anywhere in the subtree of another given node (fixture). | |
| makeSiblingOfParent | back to summary |
|---|---|
| public static void makeSiblingOfParent(AST parent, AST child) Makes the child node a sibling of the parent, reconnecting all siblings. | |
| Modifier and Type | Field and Description |
|---|---|
| private final List | |
| private final ASTUtil. |
| Access | Constructor and Description |
|---|---|
| public |
| collectedNodes | back to summary |
|---|---|
| private final List<E> collectedNodes | |
| predicate | back to summary |
|---|---|
| private final ASTUtil. | |
| CollectingNodeVisitor | back to summary |
|---|---|
| public CollectingNodeVisitor(ASTUtil. | |
| collect | back to summary |
|---|---|
| public List | |
| getCollectedNodes | back to summary |
|---|---|
| public List | |
| visit | back to summary |
|---|---|
| public void visit(AST node) Implements org. | |
| Modifier and Type | Method and Description |
|---|---|
| public boolean |
| exclude | back to summary |
|---|---|
| public boolean exclude(AST n) Returns true if the node should be filtered out.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | exclude(AST
The node. node)Implements org. |
| public abstract boolean |
| IncludePredicate | back to summary |
|---|---|
| public IncludePredicate() | |
| exclude | back to summary |
|---|---|
| public final boolean exclude(AST node) Implements org. Doc from org. Returns true if the node should be filtered out.
| |
| include | back to summary |
|---|---|
| public abstract boolean include(AST node) | |