org.openrdf.sesame.sail.query
Class ValueCompare

java.lang.Object
  extended byorg.openrdf.sesame.sail.query.ValueCompare
All Implemented Interfaces:
BooleanExpr

public class ValueCompare
extends Object
implements BooleanExpr

A comparison between two values.


Field Summary
static int EQ
          equal to
static int GE
          greater than or equal to
static int GT
          greater than
static int LE
          lower than or equal to
static int LT
          lower than
static int NE
          not equal to
 
Constructor Summary
ValueCompare(ValueExpr leftArg, ValueExpr rightArg)
           
ValueCompare(ValueExpr leftArg, ValueExpr rightArg, int op)
           
 
Method Summary
 ValueExpr getLeftArg()
           
 int getOperator()
           
 ValueExpr getRightArg()
           
 void getVariables(Collection variables)
          Gets all variables that are used in this BooleanExpr.
 boolean isTrue(RdfSource rdfSource)
          Evaluates the boolean expression on the supplied RdfSource object.
static boolean isTrue(Value leftVal, Value rightVal, int operator)
           
static String operator2string(int op)
          Gives a string representation of the specified operator code.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EQ

public static final int EQ
equal to

See Also:
Constant Field Values

NE

public static final int NE
not equal to

See Also:
Constant Field Values

LT

public static final int LT
lower than

See Also:
Constant Field Values

LE

public static final int LE
lower than or equal to

See Also:
Constant Field Values

GE

public static final int GE
greater than or equal to

See Also:
Constant Field Values

GT

public static final int GT
greater than

See Also:
Constant Field Values
Constructor Detail

ValueCompare

public ValueCompare(ValueExpr leftArg,
                    ValueExpr rightArg)

ValueCompare

public ValueCompare(ValueExpr leftArg,
                    ValueExpr rightArg,
                    int op)
Method Detail

getLeftArg

public ValueExpr getLeftArg()

getRightArg

public ValueExpr getRightArg()

getOperator

public int getOperator()

getVariables

public void getVariables(Collection variables)
Description copied from interface: BooleanExpr
Gets all variables that are used in this BooleanExpr.

Specified by:
getVariables in interface BooleanExpr
Parameters:
variables - A Collection to add the Var objects to.

isTrue

public boolean isTrue(RdfSource rdfSource)
               throws BooleanExprEvaluationException
Description copied from interface: BooleanExpr
Evaluates the boolean expression on the supplied RdfSource object.

Specified by:
isTrue in interface BooleanExpr
Parameters:
rdfSource - The RdfSource to evaluate the boolean expression against.
Returns:
the result of the evaluation.
Throws:
BooleanExprEvaluationException - If the boolean expression could not be evaluated, for example when comparing two incompatible operands. When thrown, the result of the boolean expression is neither true or false, but unknown.

isTrue

public static boolean isTrue(Value leftVal,
                             Value rightVal,
                             int operator)
                      throws BooleanExprEvaluationException
Throws:
BooleanExprEvaluationException

operator2string

public static String operator2string(int op)
Gives a string representation of the specified operator code.

Parameters:
op - One of Compare.EQ, Compare.NE, ValueCompare.LT, ValueCompare.LE, ValueCompare.GE or ValueCompare.GT.
Throws:
IllegalArgumentException - If the specified operator code is an illegal code.

toString

public String toString()


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.