/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { Block otherBlock = this.whileBlock.clone(); Criteria otherCrit = (Criteria) this.condition.clone(); WhileStatement ws = new WhileStatement(otherCrit, otherBlock); ws.setLabel(label); return ws; }
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { Block otherBlock = this.whileBlock.clone(); Criteria otherCrit = (Criteria) this.condition.clone(); WhileStatement ws = new WhileStatement(otherCrit, otherBlock); ws.setLabel(label); return ws; }
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { Block otherBlock = this.whileBlock.clone(); Criteria otherCrit = (Criteria) this.condition.clone(); WhileStatement ws = new WhileStatement(otherCrit, otherBlock); ws.setLabel(label); return ws; }
final public WhileStatement whileStatement(ParseInfo info) throws ParseException { WhileStatement whileStmt = null; Criteria criteria = null; Statement stmt = null; jj_consume_token(WHILE); jj_consume_token(LPAREN); criteria = criteria(info); jj_consume_token(RPAREN); stmt = statement(info); whileStmt = new WhileStatement(criteria, asBlock(stmt)); {if (true) return whileStmt;} throw new Error("Missing return statement in function"); }
final public WhileStatement whileStatement(ParseInfo info) throws ParseException { WhileStatement whileStmt = null; Criteria criteria = null; Statement stmt = null; jj_consume_token(WHILE); jj_consume_token(LPAREN); criteria = criteria(info); jj_consume_token(RPAREN); stmt = statement(info); whileStmt = new WhileStatement(criteria, asBlock(stmt)); {if (true) return whileStmt;} throw new Error("Missing return statement in function"); }
final public WhileStatement whileStatement(ParseInfo info) throws ParseException { WhileStatement whileStmt = null; Criteria criteria = null; Statement stmt = null; jj_consume_token(WHILE); jj_consume_token(LPAREN); criteria = criteria(info); jj_consume_token(RPAREN); stmt = statement(info); whileStmt = new WhileStatement(criteria, asBlock(stmt)); {if (true) return whileStmt;} throw new Error("Missing return statement in function"); }
public static final WhileStatement sample1() { Block block = TestBlock.sample1(); Criteria criteria = TestSetCriteria.sample1(); return new WhileStatement(criteria, block); }
public static final WhileStatement sample2() { Block block = TestBlock.sample2(); Criteria criteria = TestSetCriteria.sample2(); return new WhileStatement(criteria, block); }
@Test public void testWhileStatement() throws Exception { ElementSymbol x = new ElementSymbol("x", false); //$NON-NLS-1$ Function f = new Function("+", new Expression[] { x, new Constant(new Integer(1)) }); //$NON-NLS-1$ Statement assignmentStmt = new AssignmentStatement(x, f); Block block = new Block(); block.addStatement(assignmentStmt); Criteria crit = new CompareCriteria(x, CompareCriteria.LT, new Constant(new Integer(100))); WhileStatement whileStmt = new WhileStatement(crit, block); helpStmtTest("WHILE (x < 100) BEGIN x=x+1; END", //$NON-NLS-1$ "WHILE(x < 100)"+"\n"+ "BEGIN"+"\n"+"x = (x + 1);" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ +"\n"+"END", whileStmt); //$NON-NLS-1$ //$NON-NLS-2$ }
@Test public void testWhileStatement1() throws Exception { ElementSymbol x = new ElementSymbol("x", false); //$NON-NLS-1$ Function f = new Function("+", new Expression[] { x, new Constant(new Integer(1)) }); //$NON-NLS-1$ Statement assignmentStmt = new AssignmentStatement(x, f); Block block = new Block(); block.setAtomic(true); block.setLabel("1y"); block.addStatement(assignmentStmt); BranchingStatement bs = new BranchingStatement(BranchingMode.CONTINUE); bs.setLabel("1y"); block.addStatement(bs); Criteria crit = new CompareCriteria(x, CompareCriteria.LT, new Constant(new Integer(100))); WhileStatement whileStmt = new WhileStatement(crit, block); helpStmtTest("WHILE (x < 100) \"1y\": BEGIN ATOMIC x=x+1; CONTINUE \"1y\"; END", //$NON-NLS-1$ "WHILE(x < 100)"+"\n"+ "\"1y\" : BEGIN ATOMIC"+"\n"+"x = (x + 1);\nCONTINUE \"1y\";" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ +"\n"+"END", whileStmt); //$NON-NLS-1$ //$NON-NLS-2$ }