Module org.maxicp

Record Class IntervalLengthOrValue

java.lang.Object
java.lang.Record
org.maxicp.modeling.algebra.integer.IntervalLengthOrValue
Record Components:
interval - the interval
value - the default value if the interval is absent
All Implemented Interfaces:
Serializable, Expression, IntExpression, SymbolicIntExpression

public record IntervalLengthOrValue(IntervalVar interval, int value) extends Record implements SymbolicIntExpression
Gives the length an IntervalVar or a given value if the interval is not present
See Also:
  • Constructor Details

    • IntervalLengthOrValue

      public IntervalLengthOrValue(IntervalVar interval, int value)
      Creates an instance of a IntervalLengthOrValue record class.
      Parameters:
      interval - the value for the interval record component
      value - the value for the value record component
  • Method Details

    • defaultEvaluate

      public int defaultEvaluate() throws VariableNotFixedException
      Specified by:
      defaultEvaluate in interface SymbolicIntExpression
      Throws:
      VariableNotFixedException
    • defaultMin

      public int defaultMin()
      Specified by:
      defaultMin in interface SymbolicIntExpression
    • defaultMax

      public int defaultMax()
      Specified by:
      defaultMax in interface SymbolicIntExpression
    • defaultContains

      public boolean defaultContains(int v)
      Specified by:
      defaultContains in interface SymbolicIntExpression
    • defaultFillArray

      public int defaultFillArray(int[] array)
      Specified by:
      defaultFillArray in interface SymbolicIntExpression
    • defaultSize

      public int defaultSize()
      Specified by:
      defaultSize in interface SymbolicIntExpression
    • computeSubexpressions

      public Collection<? extends Expression> computeSubexpressions()
      Description copied from interface: Expression
      Should be implemented by all subclasses, but not used directly. Use subexpressions() instead, which is a cached version of this. Returns a collection that contains all sub-expressions of this expression. It should not be modified. In practice, it should actually be unmutable or a copy.
      Specified by:
      computeSubexpressions in interface Expression
    • mapSubexpressions

      public IntExpression mapSubexpressions(Function<Expression,Expression> f)
      Description copied from interface: Expression
      Apply a function on all sub-expressions of this expression and returns a new expression of the same type. This function should return a value that is of the same class as the object that was given to it.
      Specified by:
      mapSubexpressions in interface Expression
      Specified by:
      mapSubexpressions in interface IntExpression
    • isFixed

      public boolean isFixed()
      Description copied from interface: Expression
      True if the expression is fixed
      Specified by:
      isFixed in interface Expression
    • getModelProxy

      public ModelProxy getModelProxy()
      Description copied from interface: Expression
      Returns the ModelDispatcher linked to this Expression
      Specified by:
      getModelProxy in interface Expression
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • interval

      public IntervalVar interval()
      Returns the value of the interval record component.
      Returns:
      the value of the interval record component
    • value

      public int value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component