1 10 11 package com.triactive.jdo.store; 12 13 import java.util.List ; 14 15 16 class BinaryExpression extends SQLExpression 17 { 18 public BinaryExpression(QueryStatement qs) 19 { 20 super(qs); 21 } 22 23 public BinaryExpression(QueryStatement qs, QueryStatement.QueryColumn qsc) 24 { 25 super(qs, qsc); 26 } 27 28 public BinaryExpression(String functionName, List args) 29 { 30 super(functionName, args); 31 } 32 33 public BinaryExpression(SQLExpression operand1, DyadicOperator op, SQLExpression operand2) 34 { 35 super(operand1, op, operand2); 36 } 37 38 public BooleanExpression eq(SQLExpression expr) 39 { 40 if (expr instanceof NullLiteral) 41 return expr.eq(this); 42 else if (expr instanceof BinaryExpression) 43 return new BooleanExpression(this, OP_EQ, expr); 44 else 45 return super.eq(expr); 46 } 47 48 public BooleanExpression noteq(SQLExpression expr) 49 { 50 if (expr instanceof NullLiteral) 51 return expr.noteq(this); 52 else if (expr instanceof BinaryExpression) 53 return new BooleanExpression(this, OP_NOTEQ, expr); 54 else 55 return super.noteq(expr); 56 } 57 58 public BooleanExpression lt(SQLExpression expr) 59 { 60 if (expr instanceof BinaryExpression) 61 return new BooleanExpression(this, OP_LT, expr); 62 else 63 return super.lt(expr); 64 } 65 66 public BooleanExpression lteq(SQLExpression expr) 67 { 68 if (expr instanceof BinaryExpression) 69 return new BooleanExpression(this, OP_LTEQ, expr); 70 else 71 return super.lteq(expr); 72 } 73 74 public BooleanExpression gt(SQLExpression expr) 75 { 76 if (expr instanceof BinaryExpression) 77 return new BooleanExpression(this, OP_GT, expr); 78 else 79 return super.gt(expr); 80 } 81 82 public BooleanExpression gteq(SQLExpression expr) 83 { 84 if (expr instanceof BinaryExpression) 85 return new BooleanExpression(this, OP_GTEQ, expr); 86 else 87 return super.gteq(expr); 88 } 89 90 public SQLExpression add(SQLExpression expr) 91 { 92 if (expr instanceof BinaryExpression) 93 return new BinaryExpression(this, OP_CONCAT, expr); 94 else 95 return super.add(expr); 96 } 97 98 public BooleanExpression in(SQLExpression expr) 99 { 100 return new BooleanExpression(this, OP_IN, expr); 101 } 102 } 103 | Popular Tags |