vec_math
Class ExpressionCalculator
java.lang.Object
util.PropertyContainer
util.PropertyResources
util.PropertyBundles
vec_math.ExpressionCalculator
- All Implemented Interfaces:
- Cloneable, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying
- Direct Known Subclasses:
- ExposureTime
public class ExpressionCalculator
- extends PropertyBundles
- implements Initializable
Combines an ExpressionNode and an ExpressionParser to
actually fill paramtere values into an expression and evaluate this.
| Methods inherited from class util.PropertyResources |
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString |
| Methods inherited from interface util.PropertySupplying |
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
KEY_INITEXPRESSION
public static final String KEY_INITEXPRESSION
- The evaluator uses this expression for parsing.
- See Also:
- Constant Field Values
expression
private ExpressionNode expression
- The parsable double expression.
ExpressionCalculator
public ExpressionCalculator(Map<String,String> init)
- Constructs a new expression evaluator. The properties can be used for
additional variables that should be available to the evaluator.
init
public void init()
- If the calculator has a property named
KEY_INITEXPRESSION,
we use this expression to initialize the calculator.
- Specified by:
init in interface Initializable- Overrides:
init in class PropertyResources
initCalculator
public void initCalculator(String node)
- Initializes the expression. Variable substitution is done in the
evaluate(java.util.Map) method. Proper parsing is only possible if the
argument follows the generic ExpressionNode specification.
- Parameters:
node - A String expression.
evaluate
public Number evaluate(Map<String,Object> set)
- Returns the actual value of the expression. Variables that are
TargetDependingParameters are evaluted using the
target definition. Variable names must either be substitutable from the
parameter cluster handed over or specified as constants in the
DTDConstants.CONSTANT
section of the merit. The sequence of parameter
substitution first looks up the merit's constant. Only if the variable
is not a defined constant, it is evaluated using the parameter set.
- Returns:
- Either a Double or a Boolean
getExpression
public ExpressionNode getExpression()
- Returns the initial expression.