org.owasp.orizon.twilight.parser
Class Nodes

java.lang.Object
  extended by org.owasp.orizon.twilight.parser.Nodes

public abstract class Nodes
extends java.lang.Object

A set of static utility routines, mostly for working with Node objects. These methods were not added to the Node interface in order to keep it fairly easy for someone to write their own Node implementation.


Nested Class Summary
static class Nodes.Visitor
          An abstract base class for classes that implement the visitor pattern.
 
Constructor Summary
Nodes()
           
 
Method Summary
static
<T extends Node>
java.util.List<T>
childrenOfType(Node node, java.lang.Class<T> clazz)
           
static void copyLocationInfo(Node from, Node to)
           
static void dump(Node n, java.lang.String prefix)
           
static void expandSpecialTokens(Node n, boolean recursive)
          Expands (in place) a Node's children to include any comment tokens hanging off the regular tokens.
static
<T extends Node>
T
firstChildOfType(Node node, java.lang.Class<T> clazz)
           
static java.util.List<Token> getAllTokens(Node n, boolean includeCommentTokens, boolean recursive)
           
static
<T extends Node>
T
getFirstAncestorOfType(Node n, java.lang.Class<T> clazz)
           
static java.util.List<Token> getRealTokens(Node n)
           
static java.util.List<Token> getTokens(Node node)
           
static java.util.ListIterator<Node> iterator(Node node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Nodes

public Nodes()
Method Detail

firstChildOfType

public static <T extends Node> T firstChildOfType(Node node,
                                                  java.lang.Class<T> clazz)

childrenOfType

public static <T extends Node> java.util.List<T> childrenOfType(Node node,
                                                                java.lang.Class<T> clazz)

getTokens

public static java.util.List<Token> getTokens(Node node)

getRealTokens

public static java.util.List<Token> getRealTokens(Node n)

iterator

public static java.util.ListIterator<Node> iterator(Node node)

expandSpecialTokens

public static void expandSpecialTokens(Node n,
                                       boolean recursive)
Expands (in place) a Node's children to include any comment tokens hanging off the regular tokens.

Parameters:
n - the Node
recursive - whether to recurse into child nodes.

getAllTokens

public static java.util.List<Token> getAllTokens(Node n,
                                                 boolean includeCommentTokens,
                                                 boolean recursive)
Parameters:
n - The Node
includeCommentTokens - Whether to include comment tokens
recursive - Whether to recurse into child Nodes.
Returns:
a List containing all the tokens in a Node

copyLocationInfo

public static void copyLocationInfo(Node from,
                                    Node to)

dump

public static void dump(Node n,
                        java.lang.String prefix)

getFirstAncestorOfType

public static <T extends Node> T getFirstAncestorOfType(Node n,
                                                        java.lang.Class<T> clazz)