/** * Creates a <code>Reduction</code> from this token. Returns self if the * node is already a <code>Reduction</code>. */ public Reduction asReduction() { return new Reduction( this ); }
/** * Creates a <code>Reduction</code> from this token, adding the supplied * nodes as the second and third element, respectively. */ public Reduction asReduction( CSTNode second, CSTNode third ) { Reduction created = asReduction( second ); created.add( third ); return created; }
/** * Returns true if the node is a complete expression. */ public boolean isAnExpression() { if( isA(Types.COMPLEX_EXPRESSION) ) { return true; } return marked; }
/** * Returns true if the node is completely empty (no root, even). */ public boolean isEmpty() { return size() == 0; }
/** * Initializes the <code>Reduction</code> with the specified root. */ public Reduction( Token root ) { elements = new ArrayList(); set( 0, root ); }
/** * Returns the specified element, or null. */ public CSTNode get( int index ) { CSTNode element = null; if( index < size() ) { element = (CSTNode)elements.get( index ); } return element; }
/** * Initializes the <code>Reduction</code> with the specified root. */ public Reduction( Token root ) { elements = new ArrayList(); set( 0, root ); }
/** * Creates a <code>Reduction</code> from this token, adding the supplied * node as the second element. */ public Reduction asReduction( CSTNode second ) { Reduction created = asReduction(); created.add( second ); return created; }
/** * Returns the root of the node, the Token that indicates it's * type. Returns null if there is no root (usually only if the * node is a placeholder of some kind -- see isEmpty()). */ public Token getRoot() { if( size() > 0 ) { return (Token)elements.get(0); } else { return null; } }
/** * Creates a new <code>Reduction</code> with <code>Token.NULL</code> * as it's root. */ public static Reduction newContainer() { return new Reduction( Token.NULL ); }
/** * Returns true if the node is a complete expression. */ public boolean isAnExpression() { if( isA(Types.COMPLEX_EXPRESSION) ) { return true; } return marked; }
/** * Initializes the <code>Reduction</code> with the specified root. */ public Reduction( Token root ) { elements = new ArrayList(); set( 0, root ); }
/** * Creates a <code>Reduction</code> from this token, adding the supplied * nodes as the second, third, and fourth element, respectively. */ public Reduction asReduction( CSTNode second, CSTNode third, CSTNode fourth ) { Reduction created = asReduction( second, third ); created.add( fourth ); return created; }
/** * Returns true if the node is completely empty (no root, even). */ public boolean isEmpty() { return size() == 0; }
/** * Creates a new <code>Reduction</code> with <code>Token.NULL</code> * as it's root. */ public static Reduction newContainer() { return new Reduction( Token.NULL ); }
/** * Returns true if the node is a complete expression. */ public boolean isAnExpression() { if( isA(Types.COMPLEX_EXPRESSION) ) { return true; } return marked; }