Class Between

  • All Implemented Interfaces:
    Constraint, Expression

    public final class Between
    extends java.lang.Object
    implements Constraint
    Enforces that the possible values of a given Expression are within the given range.
    • Field Detail

      • min

        private final long min
      • max

        private final long max
    • Constructor Detail

      • Between

        public Between​(Expression e,
                       long min,
                       long max)
        Enforces that the possible values of the given Expression are within the given range (inclusive).
        Parameters:
        e -
        min - the minimum possible value (inclusive) for the expression
        max - the maximum possible value (inclusive) for the expression
    • Method Detail

      • walk

        public void walk​(java.util.function.Consumer<Expression> r)
        Description copied from interface: Constraint
        Traverse this constraint.
        Specified by:
        walk in interface Constraint
        Specified by:
        walk in interface Expression
        Parameters:
        r - will be called for each Expression contained within this Constraint.
      • replace

        public Between replace​(java.util.function.Function<LeafExpression,​LeafExpression> r)
        Description copied from interface: Constraint
        Returns new Constraint with LeafExpressions in this Constraint replaced with values returned from the given function.
        Specified by:
        replace in interface Constraint
        Specified by:
        replace in interface Expression
        Parameters:
        r - 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 Constraint with LeafExpressions in this Constraint replaced with versions returned from function.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object