net.sourceforge.jeval
Class ExpressionTree

java.lang.Object
  extended by net.sourceforge.jeval.ExpressionTree

public class ExpressionTree
extends java.lang.Object

Represents an expression tree made up of a left operand, right operand, operator and unary operator.


Constructor Summary
ExpressionTree(Evaluator evaluator, java.lang.Object leftOperand, java.lang.Object rightOperand, Operator operator, Operator unaryOperator)
          Creates a new ExpressionTree.
 
Method Summary
 java.lang.String evaluate(boolean wrapStringFunctionResults)
          Evaluates the operands for this tree using the operator and the unary operator.
 java.lang.Object getLeftOperand()
          Returns the left operand of this tree.
 Operator getOperator()
          Returns the operator for this tree.
 java.lang.Object getRightOperand()
          Returns the right operand of this tree.
 Operator getUnaryOperator()
          Returns the unary operator for this tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionTree

public ExpressionTree(Evaluator evaluator,
                      java.lang.Object leftOperand,
                      java.lang.Object rightOperand,
                      Operator operator,
                      Operator unaryOperator)
Creates a new ExpressionTree.

Parameters:
evaluator - The Evaluator object processing this tree.
leftOperand - The left operand to place as the left node of the tree.
rightOperand - The right operand to place as the right node of the tree.
operator - The operator to place as the operator node of the tree.
unaryOperator - The new unary operator for this tree.
Method Detail

getLeftOperand

public java.lang.Object getLeftOperand()
Returns the left operand of this tree.

Returns:
The left operand of this tree.

getRightOperand

public java.lang.Object getRightOperand()
Returns the right operand of this tree.

Returns:
The right operand of this tree.

getOperator

public Operator getOperator()
Returns the operator for this tree.

Returns:
The operator of this tree.

getUnaryOperator

public Operator getUnaryOperator()
Returns the unary operator for this tree.

Returns:
The unary operator of this tree.

evaluate

public java.lang.String evaluate(boolean wrapStringFunctionResults)
                          throws EvaluationException
Evaluates the operands for this tree using the operator and the unary operator.

Parameters:
wrapStringFunctionResults - Indicates if the results from functions that return strings should be wrapped in quotes. The quote character used will be whatever is the current quote character for this object.
Throws:
EvaluateException - Thrown is an error is encoutnered while processing the expression.
EvaluationException


Copyright (C) 2002-2007 Robert Breidecker.