org.jacorb.idl
Class ConstExprEvaluator

java.lang.Object
  extended byorg.jacorb.idl.ConstExprEvaluator

public class ConstExprEvaluator
extends java.lang.Object

Based on the MathEvaluator class by The-Son LAI, Lts@writeme.com Expression evaluator for IDL constant expression Supports the following functions: +, -, *, /, ^, %, ^, | , <<, >>
When the getValue() is called, a Double object is returned. If it returns null, an error occured.

Version:
$Id: ConstExprEvaluator.java,v 1.3 2004/01/15 11:12:13 nick.cross Exp $
Author:
Gerald Brose, The-Son LAI Lts@writeme.com

Nested Class Summary
protected  class ConstExprEvaluator.Node
           
protected  class ConstExprEvaluator.Operator
           
 
Field Summary
protected static ConstExprEvaluator.Operator[] operators
           
 
Constructor Summary
ConstExprEvaluator()
          creates an empty ConstExprEvaluator.
ConstExprEvaluator(java.lang.String s)
          creates a ConstExprEvaluator and assign the expression string.
 
Method Summary
protected  ConstExprEvaluator.Operator[] getOperators()
           
 java.lang.Double getValue()
          evaluates and returns the value of the expression
 java.lang.Double getVariable(java.lang.String s)
          gets the variable's value that was assigned previously
 void reset()
          resets the evaluator
 void setExpression(java.lang.String s)
          sets the expression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

operators

protected static ConstExprEvaluator.Operator[] operators
Constructor Detail

ConstExprEvaluator

public ConstExprEvaluator()
creates an empty ConstExprEvaluator. You need to use setExpression(String s) to assign an expression string to it.


ConstExprEvaluator

public ConstExprEvaluator(java.lang.String s)
creates a ConstExprEvaluator and assign the expression string.

Method Detail

setExpression

public void setExpression(java.lang.String s)
sets the expression


reset

public void reset()
resets the evaluator


getValue

public java.lang.Double getValue()
evaluates and returns the value of the expression


getVariable

public java.lang.Double getVariable(java.lang.String s)
gets the variable's value that was assigned previously


getOperators

protected ConstExprEvaluator.Operator[] getOperators()