Package VASSAL.script.expression
Class BeanShellExpression
java.lang.Object
VASSAL.script.expression.Expression
VASSAL.script.expression.BeanShellExpression
public class BeanShellExpression extends Expression
A basic beanShell expression
-
Field Summary
Fields Modifier and Type Field Description protected ExpressionInterpreter
interpreter
-
Constructor Summary
Constructors Constructor Description BeanShellExpression(String s)
-
Method Summary
Modifier and Type Method Description static String
convertProperty(String prop)
Convert a Property name to it's BeanShell equivalent.static Expression
createExpression(String s)
Create a BeanShellExpression.static Expression
createExpression(String s, boolean dontCreateStringExpressions)
boolean
equals(Object bse)
String
evaluate(PropertySource ps, Map<String,String> properties, boolean localized)
Evaluate this expression using a BeanShell InterpreterPieceFilter
getFilter(PropertySource ps)
Return a PieceFilter that selects GamePieces that cause this expression to evaluate to truestatic boolean
isBeanShellExpression(String expr)
protected boolean
isDynamic()
static boolean
isJavaIdentifier(String s)
protected static String
strip(String expr)
String
toBeanShellString()
Output a BeanShell equivalent of this expression.Methods inherited from class VASSAL.script.expression.Expression
createPropertyExpression, createSimplePropertyExpression, evaluate, evaluate, evaluate, evaluate, getExpression, getFilter, hashCode, setExpression
-
Field Details
-
interpreter
-
-
Constructor Details
-
BeanShellExpression
-
-
Method Details
-
evaluate
public String evaluate(PropertySource ps, Map<String,String> properties, boolean localized) throws ExpressionExceptionEvaluate this expression using a BeanShell Interpreter- Specified by:
evaluate
in classExpression
- Parameters:
ps
- Property Source providing property valuesproperties
- default property valueslocalized
- localize property calls?- Returns:
- evaluated String.
- Throws:
ExpressionException
-
toBeanShellString
Description copied from class:Expression
Output a BeanShell equivalent of this expression.- Specified by:
toBeanShellString
in classExpression
- Returns:
- BeanShell equivalent
-
strip
-
isDynamic
protected boolean isDynamic() -
getFilter
Return a PieceFilter that selects GamePieces that cause this expression to evaluate to true- Overrides:
getFilter
in classExpression
- Parameters:
ps
- PropertySource to use as source of filter- Returns:
- Created PieceFilter
-
convertProperty
Convert a Property name to it's BeanShell equivalent.- Parameters:
prop
- Property name- Returns:
- beanshell equivalent
-
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
-
equals
- Overrides:
equals
in classExpression
-