/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public BranchingStatement clone() { BranchingStatement clone = new BranchingStatement(); clone.mode = mode; clone.label = label; return clone; }
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public BranchingStatement clone() { BranchingStatement clone = new BranchingStatement(); clone.mode = mode; clone.label = label; return clone; }
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public BranchingStatement clone() { BranchingStatement clone = new BranchingStatement(); clone.mode = mode; clone.label = label; return clone; }
public static final BranchingStatement sample1() { return new BranchingStatement(); }
public static final BranchingStatement sample2() { return new BranchingStatement(); }
public void testNonEquivalence(){ BranchingStatement s1 = sample1(); int equals = -1; UnitTestUtil.helpTestEquivalence(equals, s1, new BranchingStatement(BranchingMode.CONTINUE)); } }
@Test public void testBreakStatement() throws Exception { Statement breakStmt = new BranchingStatement(); helpStmtTest("break;", "BREAK;", breakStmt); //$NON-NLS-1$ //$NON-NLS-2$ }
@Test public void testContinueStatement() throws Exception { BranchingStatement contStmt = new BranchingStatement(BranchingMode.CONTINUE); helpStmtTest("continue;", "CONTINUE;", contStmt); //$NON-NLS-1$ //$NON-NLS-2$ }
@Test public void testContinueStatement1() throws Exception { BranchingStatement contStmt = new BranchingStatement(BranchingMode.CONTINUE); contStmt.setLabel("x"); helpStmtTest("continue x;", "CONTINUE x;", contStmt); //$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$ }
final public BranchingStatement branchingStatement(ParseInfo info) throws ParseException { BranchingStatement breakStmt = new BranchingStatement(); Token mode = null; String label = null;
final public BranchingStatement branchingStatement(ParseInfo info) throws ParseException { BranchingStatement breakStmt = new BranchingStatement(); Token mode = null; String label = null;
final public BranchingStatement branchingStatement(ParseInfo info) throws ParseException { BranchingStatement breakStmt = new BranchingStatement(); Token mode = null; String label = null;
Statement continueStmt = new BranchingStatement(BranchingMode.CONTINUE); ifBlock.addStatement(continueStmt); Criteria crit = new CompareCriteria(x, CompareCriteria.GT,