/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { if (getExpression() == null) { return new DeclareStatement(this.getVariable().clone(), this.varType); } return new DeclareStatement(this.getVariable().clone(), this.varType, (Expression)getExpression().clone()); }
/** * Compare two DeclareStatements for equality. They will only evaluate to equal if * they are IDENTICAL: variable and the its type are equal. * @param obj Other object * @return True if equal */ public boolean equals(Object obj) { // Quick same object test if(this == obj) { return true; } // Quick fail tests if(obj == null || !(obj instanceof DeclareStatement) || !super.equals(obj)) { return false; } DeclareStatement other = (DeclareStatement) obj; return EquivalenceUtil.areEqual(getVariableType(), other.getVariableType()); }
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { if (getValue() == null) { return new DeclareStatement(this.getVariable().clone(), this.varType); } return new DeclareStatement(this.getVariable().clone(), this.varType, (Expression)getValue().clone()); }
public void visit(DeclareStatement obj) { preVisitVisitor(obj); visitNode(obj.getVariable()); visitNode(obj.getExpression()); postVisitVisitor(obj); } public void visit(Delete obj) {
@Test public void testStatement() throws Exception { ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$ String type = new String("short"); //$NON-NLS-1$ DeclareStatement declStmt = new DeclareStatement(a, type); Statement stmt = declStmt; helpStmtTest("DECLARE short a;", "DECLARE short a;", //$NON-NLS-1$ //$NON-NLS-2$ stmt); }
private void collectDeclareVariable(DeclareStatement obj, GroupSymbol variables, TempMetadataAdapter metadata, GroupContext externalGroups) throws QueryResolverException, TeiidComponentException { ElementSymbol variable = obj.getVariable(); String typeName = obj.getVariableType(); GroupSymbol gs = variable.getGroupSymbol(); if(gs == null) {
public void testGetVariable() { DeclareStatement s1 = sample1(); assertEquals("Incorrect variable ", s1.getVariable(), new ElementSymbol("a")); //$NON-NLS-1$ //$NON-NLS-2$ }
public void testClone() { DeclareStatement s1 = sample1(); DeclareStatement s2 = (DeclareStatement)s1.clone(); assertTrue(s1 != s2); assertEquals(s1, s2); } }
public static final DeclareStatement sample1() { return new DeclareStatement(new ElementSymbol("a"), "String"); //$NON-NLS-1$ //$NON-NLS-2$ }
private void collectDeclareVariable(DeclareStatement obj, GroupSymbol variables, TempMetadataAdapter metadata, GroupContext externalGroups) throws QueryResolverException, TeiidComponentException { ElementSymbol variable = obj.getVariable(); String typeName = obj.getVariableType(); GroupSymbol gs = variable.getGroupSymbol(); if(gs == null) {
public void visit(DeclareStatement obj) { preVisitVisitor(obj); visitNode(obj.getVariable()); visitNode(obj.getExpression()); postVisitVisitor(obj); } public void visit(Delete obj) {
public static final DeclareStatement sample2() { return new DeclareStatement(new ElementSymbol("b"), "Integer"); //$NON-NLS-1$ //$NON-NLS-2$ }
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { if (getExpression() == null) { return new DeclareStatement(this.getVariable().clone(), this.varType); } return new DeclareStatement(this.getVariable().clone(), this.varType, (Expression)getExpression().clone()); }
private void collectDeclareVariable(DeclareStatement obj, GroupSymbol variables, TempMetadataAdapter metadata, GroupContext externalGroups) throws QueryResolverException, TeiidComponentException { ElementSymbol variable = obj.getVariable(); String typeName = obj.getVariableType(); GroupSymbol gs = variable.getGroupSymbol(); if(gs == null) {
/** * Compare two DeclareStatements for equality. They will only evaluate to equal if * they are IDENTICAL: variable and the its type are equal. * @param obj Other object * @return True if equal */ public boolean equals(Object obj) { // Quick same object test if(this == obj) { return true; } // Quick fail tests if(obj == null || !(obj instanceof DeclareStatement) || !super.equals(obj)) { return false; } DeclareStatement other = (DeclareStatement) obj; return EquivalenceUtil.areEqual(getVariableType(), other.getVariableType()); }
public void visit(DeclareStatement obj) { preVisitVisitor(obj); visitNode(obj.getVariable()); visitNode(obj.getExpression()); postVisitVisitor(obj); } public void visit(Delete obj) {
@Test public void testDeclareStatement() throws Exception { ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$ String type = new String("short"); //$NON-NLS-1$ DeclareStatement stmt = new DeclareStatement(a, type); helpStmtTest("DECLARE short a;","DECLARE short a;", stmt); //$NON-NLS-1$ //$NON-NLS-2$ }
/** * Compare two DeclareStatements for equality. They will only evaluate to equal if * they are IDENTICAL: variable and the its type are equal. * @param obj Other object * @return True if equal */ public boolean equals(Object obj) { // Quick same object test if(this == obj) { return true; } // Quick fail tests if(obj == null || !(obj instanceof DeclareStatement) || !super.equals(obj)) { return false; } DeclareStatement other = (DeclareStatement) obj; return EquivalenceUtil.areEqual(getVariableType(), other.getVariableType()); }
@Test public void testBlock() throws Exception { ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$ String type = new String("short"); //$NON-NLS-1$ DeclareStatement declStmt = new DeclareStatement(a, type); Statement stmt = declStmt; Block block = new Block(stmt); helpBlockTest("BEGIN DECLARE short a; END", "BEGIN"+"\n"+"DECLARE short a;"+"\n"+"END", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ block); }
/** * Get hashcode for TableAssignmentStatement. WARNING: This hash code relies on the hash codes of the * statements present in the block. If statements are added to the block or if * statements on the block change the hash code will change. Hash code is only valid * after the block has been completely constructed. * @return Hash code */ public int hashCode() { // This hash code relies on the variable and its value for this statement // and criteria clauses, not on the from, order by, or option clauses int myHash = super.hashCode(); myHash = HashCodeUtil.hashCode(myHash, this.getVariableType()); return myHash; }