public abstract class AbstractEvaluator extends Object implements Evaluator
Evaluator implementations.| Constructor and Description |
|---|
AbstractEvaluator() |
AbstractEvaluator(ExpressionParser parser) |
| Modifier and Type | Method and Description |
|---|---|
Object |
get(String name)
Gets the value of a variable.
|
ExpressionParser |
getParser()
Gets the parser used when evaluating expressions.
|
boolean |
isStrict()
Gets whether the evaluator is operating in strict mode.
|
void |
set(String name,
Object value)
Sets the value of a variable.
|
void |
setAll(Map<? extends String,? extends Object> map)
Assigns variables en masse.
|
void |
setStrict(boolean strict)
Sets whether the evaluator is operating in strict mode.
|
public AbstractEvaluator()
public AbstractEvaluator(ExpressionParser parser)
public ExpressionParser getParser()
Evaluatorpublic boolean isStrict()
EvaluatorisStrict in interface EvaluatorEvaluator.setStrict(boolean)public void setStrict(boolean strict)
Evaluator
When evaluating strictly, usage of an unassigned variable token in a place
where its value is needed will generate an IllegalArgumentException
with an "Unknown variable" message; in non-strict mode, such a variable
will instead be resolved to an object of type Unresolved with the
same name as the original variable.
In cases such as assignment, this may be sufficient to complete the
evaluation; for example, the expression foo=bar will complete
successfully in non-strict mode, with the variable foo containing
an object of type Unresolved and token value "bar". But in
cases where the unresolved value is needed as an input for additional
operations, the evaluation may still ultimately fail if the operation in
question is not defined for unresolved values. For example, the
DefaultStackEvaluator will fail with an "Unsupported binary
operator" exception when given the expression foo+bar, since
foo and bar are unresolved variables, and the +
operator cannot handle such objects.
public Object get(String name)
Evaluatorpublic void set(String name, Object value)
EvaluatorCopyright © 2015–2023 SciJava. All rights reserved.