net.sourceforge.jeval.operator
Interface Operator

All Known Implementing Classes:
AbstractOperator, AdditionOperator, BooleanAndOperator, BooleanNotOperator, BooleanOrOperator, ClosedParenthesesOperator, DivisionOperator, EqualOperator, GreaterThanOperator, GreaterThanOrEqualOperator, LessThanOperator, LessThanOrEqualOperator, ModulusOperator, MultiplicationOperator, NotEqualOperator, OpenParenthesesOperator, SubtractionOperator

public interface Operator

An oerator than can specified in an expression.


Method Summary
 double evaluate(double operand)
          Evaluate one double operand.
 double evaluate(double leftOperand, double rightOperand)
          Evaluates two double operands.
 java.lang.String evaluate(java.lang.String leftOperand, java.lang.String rightOperand)
          Evaluates two string operands.
 int getLength()
          Returns the length of the operator symbol.
 int getPrecedence()
          Returns the precedence given to this operator.
 java.lang.String getSymbol()
          Returns the character(s) that makes up the operator.
 boolean isUnary()
          Returns an indicator of if the operator is unary or not.
 

Method Detail

evaluate

double evaluate(double leftOperand,
                double rightOperand)
Evaluates two double operands.

Parameters:
leftOperand - The left operand being evaluated.
rightOperand - The right operand being evaluated.

evaluate

java.lang.String evaluate(java.lang.String leftOperand,
                          java.lang.String rightOperand)
                          throws EvaluationException
Evaluates two string operands.

Parameters:
leftOperand - The left operand being evaluated.
rightOperand - The right operand being evaluated.
Returns:
String The value of the evaluated operands.
Throws:
EvaluateException - Thrown when an error is found while evaluating the expression.
EvaluationException

evaluate

double evaluate(double operand)
Evaluate one double operand.

Parameters:
operand - The operand being evaluated.

getSymbol

java.lang.String getSymbol()
Returns the character(s) that makes up the operator.

Returns:
The operator symbol.

getPrecedence

int getPrecedence()
Returns the precedence given to this operator.

Returns:
The precedecne given to this operator.

getLength

int getLength()
Returns the length of the operator symbol.

Returns:
The length of the operator symbol.

isUnary

boolean isUnary()
Returns an indicator of if the operator is unary or not.

Returns:
An indicator of if the operator is unary or not.


Copyright (C) 2002-2007 Robert Breidecker.