001: /**********************************************************************
002: Copyright (c) 2002 Kelly Grizzle (TJDO) and others. All rights reserved.
003: Licensed under the Apache License, Version 2.0 (the "License");
004: you may not use this file except in compliance with the License.
005: You may obtain a copy of the License at
006:
007: http://www.apache.org/licenses/LICENSE-2.0
008:
009: Unless required by applicable law or agreed to in writing, software
010: distributed under the License is distributed on an "AS IS" BASIS,
011: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012: See the License for the specific language governing permissions and
013: limitations under the License.
014:
015: Contributors:
016: 2003 Andy Jefferson - coding standards
017: ...
018: **********************************************************************/package org.jpox.store.expression;
019:
020: import org.jpox.store.mapping.JavaTypeMapping;
021:
022: /**
023: * Representation of a Byte expression in a Query.
024: *
025: * @version $Revision: 1.9 $
026: **/
027: public class ByteExpression extends NumericExpression {
028:
029: /**
030: * Constructor
031: * @param qs the QueryExpression
032: */
033: protected ByteExpression(QueryExpression qs) {
034: super (qs);
035: }
036:
037: /**
038: *
039: * @param qs the QueryExpression
040: * @param mapping the mapping associated to this expression
041: * @param te the TableExpression where this expression refers to
042: */
043: public ByteExpression(QueryExpression qs, JavaTypeMapping mapping,
044: LogicSetExpression te) {
045: super (qs, mapping, te);
046: }
047:
048: /**
049: * Perform a function <code>op</code> on <code>operand</code>
050: * @param op operator
051: * @param operand operand
052: */
053: public ByteExpression(MonadicOperator op, ScalarExpression operand) {
054: super (op, operand);
055: }
056:
057: /**
058: * Performs a function on two arguments.
059: * op(operand1,operand2)
060: * operand1 op operand2
061: * @param operand1 the first expression
062: * @param op the operator between operands
063: * @param operand2 the second expression
064: */
065: public ByteExpression(ScalarExpression operand1, DyadicOperator op,
066: ScalarExpression operand2) {
067: super (operand1, op, operand2);
068: }
069:
070: public BooleanExpression eq(ScalarExpression expr) {
071: if (expr instanceof NullLiteral) {
072: return expr.eq(this );
073: } else {
074: return super .eq(expr);
075: }
076: }
077:
078: public BooleanExpression noteq(ScalarExpression expr) {
079: if (expr instanceof NullLiteral) {
080: return expr.noteq(this );
081: } else {
082: return super .noteq(expr);
083: }
084: }
085:
086: public BooleanExpression lt(ScalarExpression expr) {
087: if (expr instanceof NullLiteral) {
088: return expr.lt(this );
089: } else {
090: return super .lt(expr);
091: }
092: }
093:
094: public BooleanExpression lteq(ScalarExpression expr) {
095: if (expr instanceof NullLiteral) {
096: return expr.lteq(this );
097: } else {
098: return super .lteq(expr);
099: }
100: }
101:
102: public BooleanExpression gt(ScalarExpression expr) {
103: if (expr instanceof NullLiteral) {
104: return expr.gt(this );
105: } else {
106: return super .gt(expr);
107: }
108: }
109:
110: public BooleanExpression gteq(ScalarExpression expr) {
111: if (expr instanceof NullLiteral) {
112: return expr.gteq(this);
113: } else {
114: return super.gteq(expr);
115: }
116: }
117: }
|