org.outerj.expression
Class AbstractExpression

java.lang.Object
  extended byorg.outerj.expression.AbstractExpression
All Implemented Interfaces:
Expression
Direct Known Subclasses:
AbsFunction, AbstractComparisonExpression, AbstractNumericOperator, AbstractXReporterExpression, AddDaysFunction, AndFunction, BeginOfMonthFunction, BeginOfQuarterFunction, BeginOfYearFunction, CeilingFunction, ColumnFunction, ConcatenateFunction, DateFunction, DayOfMonthFunction, DayOfWeekFunction, DayOfYearFunction, DaysInMonthFunction, EndOfMonthFunction, EndOfQuarterFunction, EndOfYearFunction, FalseFunction, FloorFunction, IfFunction, LengthFunction, LowerCaseFunction, MonthFunction, NegateFunction, NotFunction, NowFunction, NVLFunction, OrFunction, PowerFunction, RandomFunction, RemainderFunction, SAvgFunction, SCountFunction, SetTimeFunction, SFirstFunction, SLastFunction, SMaxFunction, SMinFunction, SSumFunction, SubstringFunction, TextToDateFunction, TrimFunction, TrueFunction, UpperCaseFunction, ValidationError, ValidationOk, ValidationValue, YearFunction

public abstract class AbstractExpression
extends java.lang.Object
implements Expression


Field Summary
protected  java.util.ArrayList arguments
           
protected  int column
           
protected  int line
           
 
Constructor Summary
AbstractExpression()
           
 
Method Summary
 void addArgument(Expression expression)
          Add an argument to this expression.
 void addArgument(int index, Expression expression)
          Add an argument to this expression.
 void check()
          Check if the expression's structure is OK.
protected  void checkArgument(int position, java.lang.Class clazz)
           
protected  void checkArguments(java.lang.Class[] types)
           
protected  void checkArgumentsOfSameType(java.lang.Class clazz)
          Checks that all the arguments are of the same type.
protected  void checkNoArguments()
           
 int getColumn()
          Returns the column number where this expression occurs.
 int getLine()
          Returns the line number where this expression occurs.
 void setPosition(int line, int column)
          Called by the parser to set the position of this expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.outerj.expression.Expression
evaluate, getDescription, getResultType
 

Field Detail

arguments

protected java.util.ArrayList arguments

line

protected int line

column

protected int column
Constructor Detail

AbstractExpression

public AbstractExpression()
Method Detail

addArgument

public void addArgument(Expression expression)
Description copied from interface: Expression
Add an argument to this expression. The argument itself is also an expression. The expression can check the validity of its arguments in the Expression.check() method.

Specified by:
addArgument in interface Expression

addArgument

public void addArgument(int index,
                        Expression expression)
Description copied from interface: Expression
Add an argument to this expression. The argument itself is also an expression. The expression can check the validity of its arguments in the Expression.check() method.

Specified by:
addArgument in interface Expression

setPosition

public void setPosition(int line,
                        int column)
Description copied from interface: Expression
Called by the parser to set the position of this expression.

Specified by:
setPosition in interface Expression

getLine

public int getLine()
Description copied from interface: Expression
Returns the line number where this expression occurs.

Specified by:
getLine in interface Expression

getColumn

public int getColumn()
Description copied from interface: Expression
Returns the column number where this expression occurs.

Specified by:
getColumn in interface Expression

check

public void check()
           throws ExpressionException
Description copied from interface: Expression
Check if the expression's structure is OK. If everything is ok, this method should just return.

Specified by:
check in interface Expression
Throws:
ExpressionException - to indicate the expression-syntax error.

checkArguments

protected void checkArguments(java.lang.Class[] types)
                       throws ExpressionException
Throws:
ExpressionException

checkArgument

protected void checkArgument(int position,
                             java.lang.Class clazz)
                      throws ExpressionException
Throws:
ExpressionException

checkNoArguments

protected void checkNoArguments()
                         throws ExpressionException
Throws:
ExpressionException

checkArgumentsOfSameType

protected void checkArgumentsOfSameType(java.lang.Class clazz)
                                 throws ExpressionException
Checks that all the arguments are of the same type.

Throws:
ExpressionException