Interface Expression

All Known Subinterfaces:
Constraint, LeafExpression
All Known Implementing Classes:
Absolute, Add, And, Between, Divide, EqualTo, Equivalent, FixedValue, Implication, LessThan, LessThanOrEqualTo, Maximum, Minimum, Minus, Multiply, Nand, Nor, Not, NotEqualTo, Or, Subtract, Variable, Xor

public interface Expression
Represents something that can have a range of numeric values.

Could be a single immutable value (see FixedValue), a variable that can have one or more possible values (see Variable) or a composite that contains other Expression objects (e.g. Add).

  • Method Details

    • getMin

      long getMin(ReadConstraintStore constraintStore)
    • getMax

      long getMax(ReadConstraintStore constraintStore)
    • setNot

      default ExpressionResult setNot(ConstraintStore store, long not)
    • setMin

      ExpressionResult setMin(ConstraintStore constraintStore, long min)
    • setMax

      ExpressionResult setMax(ConstraintStore constraintStore, long max)
    • walk

      void walk(Consumer<Expression> consumer)
      Traverse this expression.

      If this expression is a composite then all its sub-expressions will be traversed.

      Parameters:
      consumer - will be called for each Expression contained within this Expression.
    • replace

      Returns a Expression with LeafExpressions in this Expression replaced with values returned from the given function.
      Parameters:
      function - returns the LeafExpression to use as a replacement for the LeafExpression it is called with, or null if the original LeafExpression should continue to be used.
      Returns:
      a new Expression with LeafExpressions in this Expression replaced with versions returned from function.