Class BooleanMatchExpression


  • public class BooleanMatchExpression
    extends AbstractRuleMatchExpression
    Implements a Boolean match expression, i.e., a traditional pre- or postcondition.
    Author:
    Holger Eichelberger
    • Field Detail

      • resolved

        private transient java.lang.Object resolved
    • Constructor Detail

      • BooleanMatchExpression

        public BooleanMatchExpression​(Expression expression)
                               throws VilException
        Creates a new Boolean match expression.
        Parameters:
        expression - an expression which evaluates to a Boolean
        Throws:
        VilException - in case that the expression does not evaluate to a Boolean
    • Method Detail

      • getExpression

        public Expression getExpression()
        Returns the actual Boolean expression.
        Returns:
        the actual expression
      • determineExpected

        public java.lang.Object determineExpected​(AbstractRuleMatchExpression rhsExpr,
                                                  java.lang.Object rhsValue)
                                           throws VilException
        Description copied from class: AbstractRuleMatchExpression
        Determines the expected value on the left side (represented by this object) based on the actual value for the corresponding right side.
        Specified by:
        determineExpected in class AbstractRuleMatchExpression
        Parameters:
        rhsExpr - the (resolved) RHS expression
        rhsValue - the RHS value
        Returns:
        the expected LHS value (null denotes no expectation)
        Throws:
        VilException - in case that determining the expected object fails
      • contributesTo

        public boolean contributesTo​(AbstractRuleMatchExpression expression)
        Description copied from class: AbstractRuleMatchExpression
        Returns whether this rule match expression may contribute to the fulfillment of expression.
        Specified by:
        contributesTo in class AbstractRuleMatchExpression
        Parameters:
        expression - the expression to be considered (typically a RHS expression, while this is a LHS expression)
        Returns:
        true if this rule may contribute, false else
      • evaluate

        public Collection<?> evaluate​(IExpressionVisitor evaluator)
                               throws VilException
        Description copied from class: AbstractRuleMatchExpression
        Evaluates this expression. Some subtypes may define some kind of value resolution, e.g., for match expressions. This must be called before!
        Specified by:
        evaluate in class AbstractRuleMatchExpression
        Parameters:
        evaluator - the expression evaluator (in case that an actual expression must be evaluated as part of this evaluation).
        Returns:
        the evaluation result
        Throws:
        VilException - in case that evaluation fails
      • resolve

        void resolve​(java.lang.Object resolved)
        Resolves the expression.
        Parameters:
        resolved - the resolved object