Module org.maxicp

Class SparseSetDomain

java.lang.Object
org.maxicp.cp.engine.core.SparseSetDomain
All Implemented Interfaces:
IntDomain

public class SparseSetDomain extends Object implements IntDomain
Implementation of a domain with a sparse-set
  • Constructor Details

    • SparseSetDomain

      public SparseSetDomain(StateManager sm, int min, int max)
  • Method Details

    • fillArray

      public int fillArray(int[] dest)
      Description copied from interface: IntDomain
      Copies the values of the domain into an array.
      Specified by:
      fillArray in interface IntDomain
      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
    • min

      public int min()
      Description copied from interface: IntDomain
      Returns the minimum value of the domain.
      Specified by:
      min in interface IntDomain
      Returns:
      the minimum value of the domain
    • max

      public int max()
      Description copied from interface: IntDomain
      Returns the maximum value of the domain.
      Specified by:
      max in interface IntDomain
      Returns:
      the maximum value of the domain
    • size

      public int size()
      Description copied from interface: IntDomain
      Returns the cardinality of the domain.
      Specified by:
      size in interface IntDomain
      Returns:
      the cardinality value of the domain
    • contains

      public boolean contains(int v)
      Description copied from interface: IntDomain
      Checks if the specified value belongs to the domain.
      Specified by:
      contains in interface IntDomain
      Parameters:
      v - the value to be tested
      Returns:
      true if v belongs to the domain, false otherwise
    • isSingleton

      public boolean isSingleton()
      Description copied from interface: IntDomain
      Checks if the domain contains a single element.
      Specified by:
      isSingleton in interface IntDomain
      Returns:
      true if the domain contains a single element, false otherwise
    • remove

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

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

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

      public void removeAbove(int value, IntDomainListener l)
      Description copied from interface: IntDomain
      Removes every value larger than the specified value from the domain.
      Specified by:
      removeAbove in interface IntDomain
      Parameters:
      value - the value such that all the values larger than v are removed
      l - the methods of the listener are notified as follows:
    • toString

      public String toString()
      Specified by:
      toString in interface IntDomain
      Overrides:
      toString in class Object
    • fillDeltaArray

      public int fillDeltaArray(int oldMin, int oldMax, int oldSize, int[] arr)
      Specified by:
      fillDeltaArray in interface IntDomain