Interface IntVar

All Known Subinterfaces:
BoolVar
All Known Implementing Classes:
BoolVarImpl, BoolVarIsEqual, IntVarImpl, IntVarViewMul, IntVarViewOffset, IntVarViewOpposite

public interface IntVar
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(int v)
    Returns true if the domain contains the specified value.
    int
    fillArray(int[] dest)
    Copies the values of the domain into an array.
    void
    fix(int v)
    Fix the specified value
    Returns the solver in which this variable was created.
    boolean
    Returns true if the domain of the variable has a single value.
    int
    max()
    Returns the maximum of the domain of the variable
    int
    min()
    Returns the minimum of the domain of the variable
    void
    Asks that Constraint.propagate() is called whenever the bound (maximum or minimum values) of the domain of this variable is changes.
    void
    Asks that Constraint.propagate() is called whenever the domain of this variable changes.
    void
    Asks that Constraint.propagate() is called whenever the domain of this variable is reduced to a singleton.
    void
    remove(int v)
    Removes the specified value.
    void
    removeAbove(int v)
    Remove all the values above a given value
    void
    removeBelow(int v)
    Remove all the values less than a given value
    int
    Returns the size of the domain of the variable
    void
    Asks that the closure is called whenever the max or min setValue of the domain of this variable changes
    void
    Asks that the closure is called whenever the domain change of this variable changes
    void
    Asks that the closure is called whenever the domain of this variable is reduced to a single setValue
  • Method Details

    • getSolver

      Solver getSolver()
      Returns the solver in which this variable was created.
      Returns:
      the solver in which this variable was created
    • whenFixed

      void whenFixed(Procedure f)
      Asks that the closure is called whenever the domain of this variable is reduced to a single setValue
      Parameters:
      f - the closure
    • whenBoundChange

      void whenBoundChange(Procedure f)
      Asks that the closure is called whenever the max or min setValue of the domain of this variable changes
      Parameters:
      f - the closure
    • whenDomainChange

      void whenDomainChange(Procedure f)
      Asks that the closure is called whenever the domain change of this variable changes
      Parameters:
      f - the closure
    • propagateOnDomainChange

      void propagateOnDomainChange(Constraint c)
      Asks that Constraint.propagate() is called whenever the domain of this variable changes. We say that a change event occurs.
      Parameters:
      c - the constraint for which the Constraint.propagate() method should be called on change events of this variable.
    • propagateOnFix

      void propagateOnFix(Constraint c)
      Asks that Constraint.propagate() is called whenever the domain of this variable is reduced to a singleton. In such a state the variable is fixed and we say that a fix event occurs.
      Parameters:
      c - the constraint for which the Constraint.propagate() method should be called on fix events of this variable.
    • propagateOnBoundChange

      void propagateOnBoundChange(Constraint c)
      Asks that Constraint.propagate() is called whenever the bound (maximum or minimum values) of the domain of this variable is changes. We say that a bound change event occurs in this case.
      Parameters:
      c - the constraint for which the Constraint.propagate() method should be called on bound change events of this variable.
    • min

      int min()
      Returns the minimum of the domain of the variable
      Returns:
      the minimum of the domain of the variable
    • max

      int max()
      Returns the maximum of the domain of the variable
      Returns:
      the maximum of the domain of the variable
    • size

      int size()
      Returns the size of the domain of the variable
      Returns:
      the size of the domain of the variable
    • fillArray

      int fillArray(int[] dest)
      Copies the values of the domain into an array.
      Parameters:
      dest - an array large enough dest.length >= size()
      Returns:
      the size of the domain and dest[0,...,size-1] contains the values in the domain in an arbitrary order
    • isFixed

      boolean isFixed()
      Returns true if the domain of the variable has a single value.
      Returns:
      true if the domain of the variable is a singleton.
    • contains

      boolean contains(int v)
      Returns true if the domain contains the specified value.
      Parameters:
      v - the value whose presence in the domain is to be tested
      Returns:
      true if the domain contains the specified value
    • remove

      void remove(int v)
      Removes the specified value.
      Parameters:
      v - the value to remove
      Throws:
      InconsistencyException - is thrown if the domain becomes empty
    • fix

      void fix(int v)
      Fix the specified value
      Parameters:
      v - the value to fix.
      Throws:
      InconsistencyException - is thrown if the value is not in the domain
    • removeBelow

      void removeBelow(int v)
      Remove all the values less than a given value
      Parameters:
      v - the value such that all the values less than v are removed
      Throws:
      InconsistencyException - is thrown if the domain becomes empty
    • removeAbove

      void removeAbove(int v)
      Remove all the values above a given value
      Parameters:
      v - the value such that all the values larger than v are removed
      Throws:
      InconsistencyException - is thrown if the domain becomes empty