/** * 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; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof TriggerAction)) { return false; } TriggerAction other = (TriggerAction) obj; return block.equals(other.block); }
public boolean equals(Object obj) { // Quick same object test if(this == obj) { return true; } // Quick fail tests if(!(obj instanceof ReturnStatement)) { return false; } ReturnStatement other = (ReturnStatement) obj; return super.equals(other); }
public static final Block sample1() { Block block = new Block(); block.addStatement(TestAssignmentStatement.sample1()); block.addStatement(TestCommandStatement.sample1()); block.addStatement(TestRaiseErrorStatement.sample1()); block.addStatement(TestAssignmentStatement.sample1()); return block; }
public static final Block sample2() { Block block = new Block(); block.addStatement(TestAssignmentStatement.sample2()); block.addStatement(TestCommandStatement.sample2()); block.addStatement(TestRaiseErrorStatement.sample2()); block.addStatement(TestAssignmentStatement.sample2()); return block; }
public void testGetIfBlock() { IfStatement b1 = sample1(); assertTrue("Incorrect IfBlock on statement", b1.getIfBlock().equals(TestBlock.sample1())); //$NON-NLS-1$ }
public void testGetIfBlock() { WhileStatement b1 = sample1(); assertTrue("Incorrect Block on statement", b1.getBlock().equals(TestBlock.sample1())); //$NON-NLS-1$ }
public void testGetBlock() { LoopStatement b1 = sample1(); assertTrue("Incorrect Block on statement", b1.getBlock().equals(TestBlock.sample1())); //$NON-NLS-1$ }
public void testGetElseBlock() { IfStatement b1 = sample1(); assertTrue("Incorrect IfBlock on statement", b1.getElseBlock().equals(TestBlock.sample2())); //$NON-NLS-1$ }
public void testGetCursorName(){ LoopStatement b1 = sample1(); LoopStatement b2 = sample2(); assertEquals(b1.getCursorName(), b2.getCursorName()); }
public static final LoopStatement sample1() { Block block = TestBlock.sample1(); return new LoopStatement(block, query1(), "cursor"); //$NON-NLS-1$ }
public static final LoopStatement sample2() { Block block = TestBlock.sample2(); return new LoopStatement(block, query2(), "cursor"); //$NON-NLS-1$ }
public void testGetVariableType() { DeclareStatement s1 = sample1(); assertEquals("Incorrect variable type ", s1.getVariableType(), "String"); //$NON-NLS-1$ //$NON-NLS-2$ }
public static final CreateProcedureCommand sample3() { return new CreateProcedureCommand(TestBlock.sample1()); }
public void testClone() { DeclareStatement s1 = sample1(); DeclareStatement s2 = (DeclareStatement)s1.clone(); assertTrue(s1 != s2); assertEquals(s1, s2); } }
public static final CreateProcedureCommand sample2() { return new CreateProcedureCommand(TestBlock.sample2()); }
static Block asBlock(Statement stmt) { if (stmt == null) { return null; } if (stmt instanceof Block) { return (Block)stmt; } return new Block(stmt); }
/** * Add a <code>Statement</code> to this block. * @param statement The <code>Statement</code> to be added to the block */ public void addStatement(Statement statement) { addStatement(statement, false); }
public static final CreateProcedureCommand sample1() { return new CreateProcedureCommand(TestBlock.sample1()); }