Class BeanShellExpression

java.lang.Object
VASSAL.script.expression.Expression
VASSAL.script.expression.BeanShellExpression

public class BeanShellExpression
extends Expression
A basic beanShell expression
  • Field Details

  • Constructor Details

    • BeanShellExpression

      public BeanShellExpression​(String s)
  • Method Details

    • evaluate

      public String evaluate​(PropertySource ps, Map<String,​String> properties, boolean localized) throws ExpressionException
      Evaluate this expression using a BeanShell Interpreter
      Specified by:
      evaluate in class Expression
      Parameters:
      ps - Property Source providing property values
      properties - default property values
      localized - localize property calls?
      Returns:
      evaluated String.
      Throws:
      ExpressionException
    • toBeanShellString

      public String toBeanShellString()
      Description copied from class: Expression
      Output a BeanShell equivalent of this expression.
      Specified by:
      toBeanShellString in class Expression
      Returns:
      BeanShell equivalent
    • strip

      protected static String strip​(String expr)
    • isDynamic

      protected boolean isDynamic()
    • getFilter

      public PieceFilter getFilter​(PropertySource ps)
      Return a PieceFilter that selects GamePieces that cause this expression to evaluate to true
      Overrides:
      getFilter in class Expression
      Parameters:
      ps - PropertySource to use as source of filter
      Returns:
      Created PieceFilter
    • convertProperty

      public static String convertProperty​(String prop)
      Convert a Property name to it's BeanShell equivalent.
      Parameters:
      prop - Property name
      Returns:
      beanshell equivalent
    • isBeanShellExpression

      public static boolean isBeanShellExpression​(String expr)
    • isJavaIdentifier

      public static boolean isJavaIdentifier​(String s)
    • createExpression

      public static Expression createExpression​(String s)
      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

      public static Expression createExpression​(String s, boolean dontCreateStringExpressions)
      Parameters:
      s - String to convert to a Beanshell expressions
      dontCreateStringExpressions - If True, then convert quoted string to Beanshell Expressions, not String Expressions
      Returns:
      Expression
    • equals

      public boolean equals​(Object bse)
      Overrides:
      equals in class Expression