common-util

local.tomas.expr.eval
Class ExpressionValue

java.lang.Object
  extended by local.tomas.expr.eval.ExpressionValue
Direct Known Subclasses:
BooleanValue, DateValue, DoubleValue, IntegerValue, NullValue, StringValue

public abstract class ExpressionValue
extends Object

ExpressionValue is the base class for all classes representing values calculated from expressions. It provides default implementations for all evaluation methods.

Author:
tomas.teubner

Field Summary
static ExpressionValue NULL
          The constant value NULL.
 
Constructor Summary
ExpressionValue()
           
 
Method Summary
static ExpressionValue create(Object obj)
          Create an expression value from a basic Java object.
 ExpressionValue evalAbsFunction()
          Evaluate abs function.
 ExpressionValue evalAddition(ExpressionValue right)
          Evaluate addition.
 ExpressionValue evalAnd(ExpressionValue right)
          Evaluate and.
 ExpressionValue evalAvgFunction()
          Evaluate avg function.
 ExpressionValue evalConcatenation(ExpressionValue right)
          Evaluate string concatenation.
 ExpressionValue evalCountFunction()
          Evaluate count function.
 ExpressionValue evalDivision(ExpressionValue right)
          Evaluate division operation.
 ExpressionValue evalEquality(ExpressionValue right)
          Evaluate equality comparison.
 ExpressionValue evalGreaterEqual(ExpressionValue right)
          Evaluate greater equal comparison.
 ExpressionValue evalGreaterThan(ExpressionValue right)
          Evaluate greater than comparison.
 ExpressionValue evalInequality(ExpressionValue right)
          Evaluate inequality comparison.
 ExpressionValue evalInTerm(ExpressionValue right)
          Evaluate "in" term.
 ExpressionValue evalIsNotNull()
          Evaluate "is not null" term.
 ExpressionValue evalIsNull()
          Evaluate "is null" term.
 ExpressionValue evalLengthFunction()
          Evaluate length function.
 ExpressionValue evalLessEqual(ExpressionValue right)
          Evaluate less equal comparison.
 ExpressionValue evalLessThan(ExpressionValue right)
          Evaluate less than comparison.
 ExpressionValue evalLike(ExpressionValue right)
          Evaluate like term.
 ExpressionValue evalLowerFunction()
          Evaluate lower function.
 ExpressionValue evalMatch(ExpressionValue right)
          Evaluate regular expression matching term.
 ExpressionValue evalMaxFunction()
          Evaluate max function.
 ExpressionValue evalMinFunction()
          Evaluate min function.
 ExpressionValue evalMultiplication(ExpressionValue right)
          Evaluate multiplication term.
 ExpressionValue evalNegation()
          Evaluate negation.
 ExpressionValue evalNotLikeTerm(ExpressionValue right)
          Evaluate not like term.
 ExpressionValue evalOrTerm(ExpressionValue right)
          Evaluate or term.
 ExpressionValue evalReplaceFunction(ExpressionValue regex, ExpressionValue replacement)
          Evaluate replacement function.
 ExpressionValue evalSignChange()
          Evaluate negation.
 ExpressionValue evalSubstrFunction(ExpressionValue start, ExpressionValue length)
          Evaluate substring function.
 ExpressionValue evalSubtraction(ExpressionValue right)
          Evaluate subtraction term.
 ExpressionValue evalSumFunction()
          Evaluate sum function.
 ExpressionValue evalTrimFunction()
          Evaluate trim function.
 ExpressionValue evalUpperFunction()
          Evaluate upper function.
abstract  Object getObjectValue()
          Return the Java object representing this expression value.
abstract  ExpressionType getType()
          Get the type of this expression value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL

public static final ExpressionValue NULL
The constant value NULL.

Constructor Detail

ExpressionValue

public ExpressionValue()
Method Detail

create

public static ExpressionValue create(Object obj)
                              throws ExpressionException
Create an expression value from a basic Java object. The object must be null or an instance of String, Double, Integer, Boolean, or java.util.Date.

Parameters:
obj - the java object
Returns:
the expression value
Throws:
ExpressionException - if obj is not a basic Java object.

getType

public abstract ExpressionType getType()
Get the type of this expression value.

Returns:
the type

getObjectValue

public abstract Object getObjectValue()
Return the Java object representing this expression value.

Returns:
the Java object

evalAbsFunction

public ExpressionValue evalAbsFunction()
                                throws ExpressionException
Evaluate abs function.

Throws:
ExpressionException - when invoked

evalAddition

public ExpressionValue evalAddition(ExpressionValue right)
                             throws ExpressionException
Evaluate addition.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalAnd

public ExpressionValue evalAnd(ExpressionValue right)
                        throws ExpressionException
Evaluate and.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalAvgFunction

public ExpressionValue evalAvgFunction()
                                throws ExpressionException
Evaluate avg function.

Throws:
ExpressionException - when invoked

evalCountFunction

public ExpressionValue evalCountFunction()
                                  throws ExpressionException
Evaluate count function.

Throws:
ExpressionException - when invoked

evalConcatenation

public ExpressionValue evalConcatenation(ExpressionValue right)
                                  throws ExpressionException
Evaluate string concatenation.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalEquality

public ExpressionValue evalEquality(ExpressionValue right)
                             throws ExpressionException
Evaluate equality comparison.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalGreaterEqual

public ExpressionValue evalGreaterEqual(ExpressionValue right)
                                 throws ExpressionException
Evaluate greater equal comparison.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalGreaterThan

public ExpressionValue evalGreaterThan(ExpressionValue right)
                                throws ExpressionException
Evaluate greater than comparison.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalInequality

public ExpressionValue evalInequality(ExpressionValue right)
                               throws ExpressionException
Evaluate inequality comparison.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalInTerm

public ExpressionValue evalInTerm(ExpressionValue right)
                           throws ExpressionException
Evaluate "in" term.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalIsNotNull

public ExpressionValue evalIsNotNull()
                              throws ExpressionException
Evaluate "is not null" term.

Throws:
ExpressionException - when invoked

evalIsNull

public ExpressionValue evalIsNull()
                           throws ExpressionException
Evaluate "is null" term.

Throws:
ExpressionException - when invoked

evalLengthFunction

public ExpressionValue evalLengthFunction()
                                   throws ExpressionException
Evaluate length function.

Throws:
ExpressionException - when invoked

evalLessEqual

public ExpressionValue evalLessEqual(ExpressionValue right)
                              throws ExpressionException
Evaluate less equal comparison.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalLessThan

public ExpressionValue evalLessThan(ExpressionValue right)
                             throws ExpressionException
Evaluate less than comparison.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalLike

public ExpressionValue evalLike(ExpressionValue right)
                         throws ExpressionException
Evaluate like term.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalDivision

public ExpressionValue evalDivision(ExpressionValue right)
                             throws ExpressionException
Evaluate division operation.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalLowerFunction

public ExpressionValue evalLowerFunction()
                                  throws ExpressionException
Evaluate lower function.

Throws:
ExpressionException - when invoked

evalMaxFunction

public ExpressionValue evalMaxFunction()
                                throws ExpressionException
Evaluate max function.

Throws:
ExpressionException - when invoked

evalMinFunction

public ExpressionValue evalMinFunction()
                                throws ExpressionException
Evaluate min function.

Throws:
ExpressionException - when invoked

evalMultiplication

public ExpressionValue evalMultiplication(ExpressionValue right)
                                   throws ExpressionException
Evaluate multiplication term.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalNegation

public ExpressionValue evalNegation()
                             throws ExpressionException
Evaluate negation.

Throws:
ExpressionException - when invoked

evalNotLikeTerm

public ExpressionValue evalNotLikeTerm(ExpressionValue right)
                                throws ExpressionException
Evaluate not like term.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalOrTerm

public ExpressionValue evalOrTerm(ExpressionValue right)
                           throws ExpressionException
Evaluate or term.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalSignChange

public ExpressionValue evalSignChange()
                               throws ExpressionException
Evaluate negation.

Throws:
ExpressionException - when invoked

evalSubstrFunction

public ExpressionValue evalSubstrFunction(ExpressionValue start,
                                          ExpressionValue length)
                                   throws ExpressionException
Evaluate substring function.

Parameters:
start - starting position
length - length
Throws:
ExpressionException - when invoked

evalSubtraction

public ExpressionValue evalSubtraction(ExpressionValue right)
                                throws ExpressionException
Evaluate subtraction term.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalSumFunction

public ExpressionValue evalSumFunction()
                                throws ExpressionException
Evaluate sum function.

Throws:
ExpressionException - when invoked

evalTrimFunction

public ExpressionValue evalTrimFunction()
                                 throws ExpressionException
Evaluate trim function.

Throws:
ExpressionException - when invoked

evalUpperFunction

public ExpressionValue evalUpperFunction()
                                  throws ExpressionException
Evaluate upper function.

Throws:
ExpressionException - when invoked

evalMatch

public ExpressionValue evalMatch(ExpressionValue right)
                          throws ExpressionException
Evaluate regular expression matching term.

Parameters:
right - right operand
Throws:
ExpressionException - when invoked

evalReplaceFunction

public ExpressionValue evalReplaceFunction(ExpressionValue regex,
                                           ExpressionValue replacement)
                                    throws ExpressionException
Evaluate replacement function.

Parameters:
regex - regular expression to match
replacement - replacement value
Throws:
ExpressionException - when invoked

common-util

Copyright © 2005-2007 Tomas Teubner. All Rights Reserved.