org.scijava.sjep.eval
Class AbstractEvaluator

java.lang.Object
  extended by org.scijava.sjep.eval.AbstractEvaluator
All Implemented Interfaces:
Evaluator
Direct Known Subclasses:
AbstractStackEvaluator

public abstract class AbstractEvaluator
extends Object
implements Evaluator

Base class for Evaluator implementations.

Author:
Curtis Rueden

Constructor Summary
AbstractEvaluator()
           
AbstractEvaluator(ExpressionParser parser)
           
 
Method Summary
 Object evaluate(String expression)
          Evaluates the given infix expression, returning the result.
 Object evaluate(SyntaxTree syntaxTree)
          Evaluates the given syntax tree, returning the result.
 Object get(Variable v)
          Gets the value of the given variable.
 void set(Variable v, Object value)
          Sets the value of the given variable.
 void setAll(Map<? extends String,? extends Object> map)
          Assigns variables en masse.
 Object value(Object token)
          Gets the value of the given token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.scijava.sjep.eval.Evaluator
evaluate
 

Constructor Detail

AbstractEvaluator

public AbstractEvaluator()

AbstractEvaluator

public AbstractEvaluator(ExpressionParser parser)
Method Detail

evaluate

public Object evaluate(SyntaxTree syntaxTree)
Description copied from interface: Evaluator
Evaluates the given syntax tree, returning the result.

Specified by:
evaluate in interface Evaluator

evaluate

public Object evaluate(String expression)
Description copied from interface: Evaluator
Evaluates the given infix expression, returning the result.

Specified by:
evaluate in interface Evaluator

value

public Object value(Object token)
Description copied from interface: Evaluator
Gets the value of the given token. For variables, returns the value of the variable, throwing an exception if the variable is not set. For literals, returns the token itself.

Specified by:
value in interface Evaluator

get

public Object get(Variable v)
Description copied from interface: Evaluator
Gets the value of the given variable.

Specified by:
get in interface Evaluator

set

public void set(Variable v,
                Object value)
Description copied from interface: Evaluator
Sets the value of the given variable.

Specified by:
set in interface Evaluator

setAll

public void setAll(Map<? extends String,? extends Object> map)
Description copied from interface: Evaluator
Assigns variables en masse.

Specified by:
setAll in interface Evaluator


Copyright © 2015 SciJava. All rights reserved.