1 18 package org.apache.geronimo.interop.generator; 19 20 import java.util.Vector ; 21 22 public class JIfElseIfElseStatement extends JStatement { 23 private JIfStatement ifStatement; 24 private Vector elseifStatements; 25 private JElseStatement elseStatement; 26 27 public JIfElseIfElseStatement(JExpression if_expr) { 28 ifStatement = new JIfStatement(if_expr); 29 elseifStatements = new Vector (); 30 elseStatement = new JElseStatement(); 31 } 32 33 public void addIfStatement(JStatement s) { 34 ifStatement.addStatement(s); 35 } 36 37 public JIfStatement getIfStatement() { 38 return ifStatement; 39 } 40 41 public Vector getIfStatements() { 42 return ifStatement.getStatements(); 43 } 44 45 public void addElseStatement(JStatement s) { 46 elseStatement.addStatement(s); 47 } 48 49 public JElseStatement getElseStatement() { 50 return elseStatement; 51 } 52 53 public Vector getElseStatements() { 54 return elseStatement.getStatements(); 55 } 56 57 public JElseIfStatement getElseIf(JExpression e) { 58 JElseIfStatement rc = null; 59 int index = elseifStatements.indexOf(e); 60 61 if (index >= 0) { 62 rc = (JElseIfStatement) elseifStatements.get(index); 63 } 64 65 return rc; 66 } 67 68 public JElseIfStatement newElseIf(JExpression e) { 69 JElseIfStatement rc = getElseIf(e); 70 71 if (rc == null) { 72 rc = new JElseIfStatement(e); 73 elseifStatements.add(rc); 74 } 75 76 return rc; 77 } 78 79 public void addCatchStatement(JExpression e, JStatement s) { 80 JElseIfStatement eis = getElseIf(e); 81 82 if (eis == null) { 83 eis = newElseIf(e); 84 } 85 86 eis.addStatement(s); 87 } 88 89 public Vector getElseIfs() { 90 return elseifStatements; 91 } 92 } 93 | Popular Tags |