1 15 package org.josql.expressions; 16 17 import org.josql.Query; 18 import org.josql.QueryExecutionException; 19 import org.josql.QueryParseException; 20 21 30 public abstract class BinaryExpression extends Expression 31 { 32 33 protected Expression left = null; 34 protected Expression right = null; 35 36 45 public boolean hasFixedResult (Query q) 46 { 47 48 boolean fr = true; 49 50 if (this.right != null) 51 { 52 53 fr = this.right.hasFixedResult (q); 54 55 } 56 57 return this.left.hasFixedResult (q) && fr; 58 59 } 60 61 67 public Class getExpectedReturnType (Query q) 68 { 69 70 return Boolean .class; 71 72 } 73 74 82 public void init (Query q) 83 throws QueryParseException 84 { 85 86 this.left.init (q); 87 88 if (this.right != null) 90 { 91 92 this.right.init (q); 93 94 } 95 96 } 97 98 108 public Object getValue (Object o, 109 Query q) 110 throws QueryExecutionException 111 { 112 113 return Boolean.valueOf (this.isTrue (o, 114 q)); 115 116 } 117 118 123 public Expression getRight () 124 { 125 126 return this.right; 127 128 } 129 130 135 public Expression getLeft () 136 { 137 138 return this.left; 139 140 } 141 142 public void setLeft (Expression exp) 143 { 144 145 this.left = exp; 146 147 } 148 149 public void setRight (Expression exp) 150 { 151 152 this.right = exp; 153 154 } 155 156 } 157 | Popular Tags |