Package VASSAL.script.expression
Class BeanShellExpression
java.lang.Object
VASSAL.script.expression.Expression
VASSAL.script.expression.BeanShellExpression
-
Nested Class Summary
-
Field Summary
Fields inherited from class VASSAL.script.expression.Expression
CACHE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
convertProperty
(String prop) Convert a Property name to its BeanShell equivalent.static Expression
Create a BeanShellExpression.static Expression
createExpression
(String s, boolean dontCreateStringExpressions) evaluate
(PropertySource ps, Map<String, String> properties, boolean localized) Deprecated.evaluate
(PropertySource ps, Map<String, String> properties, boolean localized, Auditable owner, AuditTrail audit) Evaluate this expression using a BeanShell InterpreterDeprecated.getFilter
(PropertySource ps, Auditable owner, AuditTrail audit) Return a PieceFilter using the expression.static Expression
static boolean
isBeanShellExpression
(String expr) protected boolean
static boolean
protected void
reset()
protected static String
Output a BeanShell equivalent of this expression.Methods inherited from class VASSAL.script.expression.Expression
createPropertyExpression, createSimplePropertyExpression, equals, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, getExpression, getFilter, getFilter, handleError, hashCode, quietEvaluate, quietEvaluate, resetCachedExpressions, setExpression, tryEvaluate, tryEvaluate, tryEvaluate, tryEvaluate, tryEvaluate, tryEvaluate, tryEvaluate, tryEvaluate, tryEvaluate, tryEvaluate, tryEvaluate
-
Field Details
-
interpreter
-
-
Constructor Details
-
BeanShellExpression
-
-
Method Details
-
reset
protected void reset()- Overrides:
reset
in classExpression
-
evaluate
public String evaluate(PropertySource ps, Map<String, String> properties, boolean localized, Auditable owner, AuditTrail audit) throws ExpressionExceptionEvaluate this expression using a BeanShell Interpreter- Overrides:
evaluate
in classExpression
- Parameters:
ps
- A property source to use to evaluate properties referenced in the expressionproperties
- A map of additional properties to uselocalized
- Use localized version of property valuesaudit
- Audit Trail to record significant information for error reporting- Returns:
- Evaluated expression value
- Throws:
ExpressionException
- If a catastrophic failure occurs in evaluation
-
evaluate
@Deprecated(since="2021-06-11") public String evaluate(PropertySource ps, Map<String, String> properties, boolean localized) throws ExpressionExceptionDeprecated.- Overrides:
evaluate
in classExpression
- Throws:
ExpressionException
-
toBeanShellString
Description copied from class:Expression
Output a BeanShell equivalent of this expression.- Overrides:
toBeanShellString
in classExpression
- Returns:
- BeanShell equivalent
-
strip
-
isDynamic
protected boolean isDynamic() -
getFilter
Deprecated.Return a PieceFilter that selects GamePieces that cause this expression to evaluate to true- Overrides:
getFilter
in classExpression
-
getFilter
Description copied from class:Expression
Return a PieceFilter using the expression. The default PieceFilter always returns true. Individual subclasses that are capable of selecting pieces MUST override these defaults. Auditing functionality is supplied since creating a filter usually involves evaluating an Expression.- Overrides:
getFilter
in classExpression
- Parameters:
ps
- PropertySource to use as source of filteraudit
- Audit trail to record expression evaluation info in- Returns:
- Created PieceFilter
-
convertProperty
-
isBeanShellExpression
-
isJavaIdentifier
-
createExpression
Create a BeanShellExpression. The expression may or may not be surrounded by {}. Create null, integer and simple Expressions as their basic type to ensure efficient evaluation. -
createExpression
- Parameters:
s
- String to convert to a Beanshell expressionsdontCreateStringExpressions
- If True, then convert quoted string to Beanshell Expressions, not String Expressions- Returns:
- Expression
-
instance
-
evaluate(PropertySource, Map, boolean, Auditable, AuditTrail)