Module org.maxicp

Interface IntDomain

All Known Implementing Classes:
SparseSetDomain

public interface IntDomain
Interface for integer domain implementation. A domain is encapsulated in an CPIntVar implementation. A domain is like a set of integers.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(int v)
    Checks if the specified value belongs to the domain.
    int
    fillArray(int[] dest)
    Copies the values of the domain into an array.
    int
    fillDeltaArray(int oldMin, int oldMax, int oldSize, int[] arr)
     
    boolean
    Checks if the domain contains a single element.
    int
    max()
    Returns the maximum value of the domain.
    int
    min()
    Returns the minimum value of the domain.
    void
    Removes a value from the domain and notifies appropriately the listener.
    void
    Removes every value larger than the specified value from the domain.
    void
    Removes every value from the domain except the specified one.
    void
    Removes every value less than the specified value from the domain.
    int
    Returns the cardinality of the domain.
     
  • Method Details

    • min

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

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

      int size()
      Returns the cardinality of the domain.
      Returns:
      the cardinality value of the domain
    • contains

      boolean contains(int v)
      Checks if the specified value belongs to the domain.
      Parameters:
      v - the value to be tested
      Returns:
      true if v belongs to the domain, false otherwise
    • isSingleton

      boolean isSingleton()
      Checks if the domain contains a single element.
      Returns:
      true if the domain contains a single element, false otherwise
    • remove

      void remove(int v, IntDomainListener l)
      Removes a value from the domain and notifies appropriately the listener.
      Parameters:
      v - the value to be removed
      l - the methods of the listener are notified as follows:
    • removeAllBut

      void removeAllBut(int v, IntDomainListener l)
      Removes every value from the domain except the specified one.
      Parameters:
      v - the value to be kept
      l - the methods of the listener are notified as follows:
    • removeBelow

      void removeBelow(int v, IntDomainListener l)
      Removes every value less than the specified value from the domain.
      Parameters:
      v - the value such that all the values less than v are removed
      l - the methods of the listener are notified as follows:
    • removeAbove

      void removeAbove(int v, IntDomainListener l)
      Removes every value larger than the specified value from the domain.
      Parameters:
      v - the value such that all the values larger than v are removed
      l - the methods of the listener are notified as follows:
    • 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
    • fillDeltaArray

      int fillDeltaArray(int oldMin, int oldMax, int oldSize, int[] arr)
    • toString

      String toString()
      Overrides:
      toString in class Object