1 package polyglot.ast; 2 3 import java.util.List; 4 5 /** 6 * A <code>Switch</code> is an immutable representation of a Java 7 * <code>switch</code> statement. Such a statement has an expression which 8 * is evaluated to determine where to branch to, an a list of labels 9 * and block statements which are conditionally evaluated. One of the 10 * labels, rather than having a constant expression, may be lablled 11 * default. 12 */ 13 public interface Switch extends CompoundStmt 14 { 15 /** The expression on which to switch. */ 16 Expr expr(); 17 18 /** Set the expression on which to switch. */ 19 Switch expr(Expr expr); 20 21 /** List of switch elements: case statements or blocks. 22 * @return A list of {@link polyglot.ast.SwitchElement SwitchElement}. 23 */ 24 List elements(); 25 26 /** Set the list of switch elements: case statements or blocks. 27 * @param elements A list of {@link polyglot.ast.SwitchElement SwitchElement}. 28 */ 29 Switch elements(List elements); 30 } 31