Package VASSAL.script.expression
Class Expression
java.lang.Object
VASSAL.script.expression.Expression
- Direct Known Subclasses:
BeanShellExpression,FormattedStringExpression,IntExpression,NullExpression,PropertyMatchExpression,SinglePropertyExpression,StringExpression
public abstract class Expression extends Object
An abstract class representing an expression that can be evaluated.
Subclasses implement specific types of expression and the way they are
evaluated.
-
Constructor Summary
Constructors Constructor Description Expression() -
Method Summary
Modifier and Type Method Description static ExpressioncreateExpression(String s)Factory method to create an appropriate expression based on the supplied String.static ExpressioncreatePropertyExpression(String s)Factory method to create a new Property Match Expression.static ExpressioncreateSimplePropertyExpression(String s)Factory method to create a Beanshell expression of a value that is known to be a property name.booleanequals(Object obj)Stringevaluate()Stringevaluate(boolean localized)Stringevaluate(PropertySource ps)Stringevaluate(PropertySource ps, boolean localized)abstract Stringevaluate(PropertySource ps, Map<String,String> properties, boolean localized)Each subclass must implement evaluate() to evaluate itselfStringgetExpression()PieceFiltergetFilter()PieceFiltergetFilter(PropertySource ps)Return a PieceFilter using the expression.inthashCode()voidsetExpression(String s)abstract StringtoBeanShellString()Output a BeanShell equivalent of this expression.
-
Constructor Details
-
Expression
public Expression()
-
-
Method Details
-
setExpression
-
getExpression
-
evaluate
public abstract String evaluate(PropertySource ps, Map<String,String> properties, boolean localized) throws ExpressionExceptionEach subclass must implement evaluate() to evaluate itself- Parameters:
ps- Property Source providing property valuesproperties- default property valueslocalized- localize property calls?- Returns:
- evaluated String.
- Throws:
ExpressionException
-
evaluate
- Throws:
ExpressionException
-
evaluate
- Throws:
ExpressionException
-
evaluate
- Throws:
ExpressionException
-
evaluate
- Throws:
ExpressionException
-
getFilter
Return a PieceFilter using the expression.- Parameters:
ps- PropertySource to use as source of filter- Returns:
- Created PieceFilter
-
getFilter
-
toBeanShellString
Output a BeanShell equivalent of this expression.- Returns:
- BeanShell equivalent
-
createExpression
Factory method to create an appropriate expression based on the supplied String. The majority of expressions in a module are going to be blank, integers or simple strings, so return optimised Expression subclasses for these types. -
createPropertyExpression
Factory method to create a new Property Match Expression.- Parameters:
s- Expression string- Returns:
- Generated Expression
-
createSimplePropertyExpression
Factory method to create a Beanshell expression of a value that is known to be a property name. Used to convert values such as the Follow proprty field in Embellishment -
hashCode
public int hashCode() -
equals
-