org.josql.expressions
Class BetweenExpression

java.lang.Object
  extended by org.josql.expressions.Expression
      extended by org.josql.expressions.BinaryExpression
          extended by org.josql.expressions.BetweenExpression

public class BetweenExpression
extends BinaryExpression

Represents a "BETWEEN x AND y" expression.


Field Summary
 
Fields inherited from class org.josql.expressions.BinaryExpression
left, right
 
Constructor Summary
BetweenExpression()
           
 
Method Summary
 Expression getEnd()
          Get the end expression.
 Expression getStart()
          Get the start expression.
 void init(Query q)
          Inits the expression.
 boolean isNot()
           
 boolean isTrue(Object o, Query q)
          Return whether this expression evaluates to true.
 void setEnd(ValueExpression e)
           
 void setNot(boolean v)
           
 void setStart(ValueExpression s)
           
 String toString()
          Returns a string version of this expression.
 
Methods inherited from class org.josql.expressions.BinaryExpression
getExpectedReturnType, getLeft, getRight, getValue, hasFixedResult, setLeft, setRight
 
Methods inherited from class org.josql.expressions.Expression
isBracketed, setBracketed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BetweenExpression

public BetweenExpression()
Method Detail

init

public void init(Query q)
          throws QueryParseException
Inits the expression.

Overrides:
init in class BinaryExpression
Parameters:
q - The Query object.
Throws:
QueryParseException - If the LHS, start or end cannot be inited.

getStart

public Expression getStart()
Get the start expression.

Returns:
The start expression, is an instance of ValueExpression.

getEnd

public Expression getEnd()
Get the end expression.

Returns:
The end expression, is an instance of ValueExpression.

setEnd

public void setEnd(ValueExpression e)

setStart

public void setStart(ValueExpression s)

isNot

public boolean isNot()

setNot

public void setNot(boolean v)

isTrue

public boolean isTrue(Object o,
                      Query q)
               throws QueryExecutionException
Return whether this expression evaluates to true. Is equivalent to: LHS >= START AND LHS <= END. And of course if the expression is NOTed then it returns !(LHS >= START AND LHS <= END).

Specified by:
isTrue in class Expression
Parameters:
o - The object to perform the expression on.
q - The Query object.
Returns:
true if the LHS is between the start and end values.
Throws:
QueryExecutionException - If the expression cannot be executed.

toString

public String toString()
Returns a string version of this expression. Will return the form:

   Expression [ NOT ] BETWEEN Expression AND Expression
 

Specified by:
toString in class Expression
Returns:
A string version of the expression.


  Copyright © 2008 Gary Bentley. All Rights Reserved.