Venice 0.751beta

nz.org.venice.parser
Class ExpressionFactory

java.lang.Object
  extended bynz.org.venice.parser.ExpressionFactory

public class ExpressionFactory
extends java.lang.Object

Create an executable expression from the given token and arguments.

Author:
Andrew Leppard

Method Summary
static Expression newExpression(Expression exp, Expression[] children)
           
static Expression newExpression(java.lang.String inputExpressionString)
           
static Expression newExpression(Token token)
          Create an executable terminal expression from the given token.
static Expression newExpression(Token token, Expression arg1)
          Create an executable unary expression from the given token and argument.
static Expression newExpression(Token token, Expression arg1, Expression arg2)
          Create an executable binary expression from the given token and arguments.
static Expression newExpression(Token token, Expression arg1, Expression arg2, Expression arg3)
          Create an executable ternary expression from the given token and arguments.
static Expression newExpression(Token token, Expression arg1, Expression arg2, Expression arg3, Expression arg4)
          Create an executable quaternary expression from the given token and arguments.
static Expression setChild(Expression exp, Expression child, int index)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newExpression

public static Expression newExpression(Token token)
Create an executable terminal expression from the given token.

Parameters:
token - the terminal expression, e.g. a number
Returns:
an executable expression

newExpression

public static Expression newExpression(Token token,
                                       Expression arg1)
Create an executable unary expression from the given token and argument.

Parameters:
token - the unary expression, e.g. "not(X)"
arg1 - the first argument
Returns:
an executable expression

newExpression

public static Expression newExpression(Token token,
                                       Expression arg1,
                                       Expression arg2)
Create an executable binary expression from the given token and arguments.

Parameters:
token - the binary expression, e.g. "X and Y"
arg1 - the first argument
arg2 - the second argument
Returns:
an executable expression

newExpression

public static Expression newExpression(Token token,
                                       Expression arg1,
                                       Expression arg2,
                                       Expression arg3)
Create an executable ternary expression from the given token and arguments.

Parameters:
token - the ternary expression, e.g. "if(X) { Y } else { Z }"
arg1 - the first argument
arg2 - the second argument
arg3 - the third argument
Returns:
an executable expression

newExpression

public static Expression newExpression(Token token,
                                       Expression arg1,
                                       Expression arg2,
                                       Expression arg3,
                                       Expression arg4)
Create an executable quaternary expression from the given token and arguments.

Parameters:
token - the ternary expression, e.g. "if(X) { Y } else { Z }"
arg1 - the first argument
arg2 - the second argument
arg3 - the third argument
arg4 - the fourth argument
Returns:
an executable expression

newExpression

public static Expression newExpression(java.lang.String inputExpressionString)

newExpression

public static Expression newExpression(Expression exp,
                                       Expression[] children)

setChild

public static Expression setChild(Expression exp,
                                  Expression child,
                                  int index)

Venice 0.751beta