org.outerj.expression
Class VariableFunction

java.lang.Object
  extended byorg.outerj.expression.VariableFunction
All Implemented Interfaces:
Expression

public class VariableFunction
extends java.lang.Object
implements Expression


Field Summary
protected  int column
           
protected  int line
           
protected  java.lang.String position
           
protected  java.lang.String variableName
           
 
Constructor Summary
VariableFunction(java.lang.String variableName)
           
 
Method Summary
 void addArgument(Expression function)
          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.
 java.lang.Object evaluate(ExpressionContext context)
          Evaluates this expression and returns the result of that evaluation.
 int getColumn()
          Returns the column number where this expression occurs.
 java.lang.String getDescription()
          Returns a description of this expression that will be shown to the user in error messages.
 int getLine()
          Returns the line number where this expression occurs.
 java.lang.Class getResultType()
          Returns the class of the the type of object that this expression will return.
 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
 

Field Detail

variableName

protected java.lang.String variableName

position

protected java.lang.String position

line

protected int line

column

protected int column
Constructor Detail

VariableFunction

public VariableFunction(java.lang.String variableName)
Method Detail

addArgument

public void addArgument(Expression function)
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

evaluate

public java.lang.Object evaluate(ExpressionContext context)
                          throws ExpressionException
Description copied from interface: Expression
Evaluates this expression and returns the result of that evaluation.

Specified by:
evaluate in interface Expression
Throws:
ExpressionException

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.

getResultType

public java.lang.Class getResultType()
Description copied from interface: Expression
Returns the class of the the type of object that this expression will return. This allows to check the correctness of functions at compile-time. If unknown, this may return null.

Specified by:
getResultType 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

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

getDescription

public java.lang.String getDescription()
Description copied from interface: Expression
Returns a description of this expression that will be shown to the user in error messages.

Specified by:
getDescription in interface Expression