com.singularsys.jep.reals
Class RealEvaluator

java.lang.Object
  extended by com.singularsys.jep.reals.RealEvaluator
All Implemented Interfaces:
Evaluator, JepComponent, java.io.Serializable

public class RealEvaluator
extends java.lang.Object
implements Evaluator

Performs fast evaluation of expressions by using primitive types double and boolean instead of objects.

See Also:
Serialized Form

Constructor Summary
RealEvaluator()
           
 
Method Summary
 java.lang.Object eval(Node node)
          Evaluates a sub expression.
 java.lang.Object evaluate(Node node)
          Evaluates a node and returns and object with the value of the node.
 JepComponent getLightWeightInstance()
          Gets a light-weight instance suitable for using in multiple threads.
 void init(Jep jep)
          Initialize the component.
protected  double visit(Node node)
           
protected  double[] visitChildren(ASTFunNode node)
           
protected  double visitConstant(ASTConstant node)
           
protected  double visitFunction(ASTFunNode node)
           
protected  double visitVariable(ASTVarNode node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RealEvaluator

public RealEvaluator()
Method Detail

evaluate

public java.lang.Object evaluate(Node node)
                          throws EvaluationException
Description copied from interface: Evaluator
Evaluates a node and returns and object with the value of the node.

Specified by:
evaluate in interface Evaluator
Throws:
EvaluationException - if errors occur during evaluation;

eval

public java.lang.Object eval(Node node)
                      throws EvaluationException
Description copied from interface: Evaluator
Evaluates a sub expression.

Specified by:
eval in interface Evaluator
Throws:
EvaluationException - if errors occur during evaluation;

init

public void init(Jep jep)
Description copied from interface: JepComponent
Initialize the component. This methods is called whenever a component is added to Jep. Hence it allows components to keep track of the other components they may rely on.

Specified by:
init in interface JepComponent
Parameters:
jep - the current Jep instance

visit

protected double visit(Node node)
                throws EvaluationException
Throws:
EvaluationException

visitChildren

protected double[] visitChildren(ASTFunNode node)
                          throws EvaluationException
Throws:
EvaluationException

visitFunction

protected double visitFunction(ASTFunNode node)
                        throws EvaluationException
Throws:
EvaluationException

visitVariable

protected double visitVariable(ASTVarNode node)
                        throws EvaluationException
Throws:
EvaluationException

visitConstant

protected double visitConstant(ASTConstant node)
                        throws EvaluationException
Throws:
EvaluationException

getLightWeightInstance

public JepComponent getLightWeightInstance()
Description copied from interface: JepComponent
Gets a light-weight instance suitable for using in multiple threads.

Specified by:
getLightWeightInstance in interface JepComponent
Returns:
either an new instance, or 'this'.


Copyright © 2010 Singular Systems http://www.singularsys.com/jep