ASTSwitchCase.java
01 /**
02  * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
03  */
04 package net.sourceforge.pmd.lang.ecmascript.ast;
05 
06 import org.mozilla.javascript.ast.SwitchCase;
07 
08 public class ASTSwitchCase extends AbstractEcmascriptNode<SwitchCase> {
09     public ASTSwitchCase(SwitchCase switchCase) {
10   super(switchCase);
11     }
12 
13     /**
14      * Accept the visitor.
15      */
16     public Object jjtAccept(EcmascriptParserVisitor visitor, Object data) {
17   return visitor.visit(this, data);
18     }
19 
20     public boolean isDefault() {
21   return node.isDefault();
22     }
23 
24     public EcmascriptNode getExpression() {
25   if (!isDefault()) {
26       return (EcmascriptNodejjtGetChild(0);
27   else {
28       return null;
29   }
30     }
31 
32     public int getNumStatements() {
33   // TODO Tell Rhino folks about null Statements, should be empty List?
34   return node.getStatements() != null ? node.getStatements().size() 0;
35     }
36 
37     public EcmascriptNode getStatement(int index) {
38   if (!isDefault()) {
39       index++;
40   }
41   return (EcmascriptNodejjtGetChild(index);
42     }
43 }