View Javadoc

    1   package net.sourceforge.pmd.lang.ecmascript.ast;
    2
    3   import org.mozilla.javascript.ast.ArrayComprehension;
    4
    5   public class ASTArrayComprehension extends AbstractEcmascriptNode<ArrayComprehension> {
    6       public ASTArrayComprehension(ArrayComprehension arrayComprehension) {
    7   	super(arrayComprehension);
    8       }
    9
    10      /**
    11       * Accept the visitor.
    12       */
    13      public Object jjtAccept(EcmascriptParserVisitor visitor, Object data) {
    14  	return visitor.visit(this, data);
    15      }
    16
    17      public EcmascriptNode getResult() {
    18  	return (EcmascriptNode) jjtGetChild(0);
    19      }
    20
    21      public int getNumArrayComprehensionLoops() {
    22  	return node.getLoops().size();
    23      }
    24
    25      public ASTArrayComprehensionLoop getArrayComprehensionLoop(int index) {
    26  	return (ASTArrayComprehensionLoop) jjtGetChild(index + 1);
    27      }
    28
    29      public boolean hasFilter() {
    30  	return node.getFilter() != null;
    31      }
    32
    33      public EcmascriptNode getFilter() {
    34  	return (EcmascriptNode) jjtGetChild(jjtGetNumChildren() - 1);
    35      }
    36  }