jwo.utils.expression
Interface Substitutable

All Known Implementing Classes:
PolySurfaceThread

public interface Substitutable

Interface for any class that wishes to perform a dynamic variable or function substitution.

Version:
2.3, 12th February, 2007.
Author:
Jo Wood

Method Summary
 Object doFunction(Vector function)
          Should substitute the given function with an appropriate value.
 int getReturnType()
          Should report the type of value returned by a call to getValue.
 Object getValue(String varName)
          Should substitute the given variable name with an appropriate value.
 void setFocalModifier(double xOffset, double yOffset)
          Should allow a focal modifier (relative spatial offset) to be set.
 

Method Detail

getValue

Object getValue(String varName)
Should substitute the given variable name with an appropriate value. Classes that implement this method can be used to perform dynamic variable substitution at the time of evaluation rather than as a pre-processing step.

Parameters:
varName - Name of variable to substitute.
Returns:
Value associated with variable or null if no substitution applied.

getReturnType

int getReturnType()
Should report the type of value returned by a call to getValue. This should be one of MatheEvaluator.EXPR_STRING , MatheEvaluator.EXPR_VARIABLE, MatheEvaluator.EXPR_NUMERIC, MatheEvaluator.EXPR_SPATIAL, or MatheEvaluator.EXPR_OTHER. MatheEvaluator.EXPR_OTHER can also be used if type is not known or used.

Returns:
Type of value returned by the substitutable object.

doFunction

Object doFunction(Vector function)
Should substitute the given function with an appropriate value. Classes that implement this method can be used to perform dynamic function execution at the time of evaluation rather than as a pre-processing step.

There is no restriction on the syntax of the supplied function as this is the responsibility of the implementing class to process, but a Vector is used to allow the function name to be stored separately from its parameters if required.

Parameters:
function - Name and parameters of function to call.
Returns:
Value returned by the function or null if no value returned.

setFocalModifier

void setFocalModifier(double xOffset,
                      double yOffset)
Should allow a focal modifier (relative spatial offset) to be set.

Parameters:
xOffset - Offset in the x direction.
yOffset - Offset in the y direction.


Copyright Jo Wood, 1996-2009, last modified, 17th April, 2009