Class IndexDomainView


  • public class IndexDomainView
    extends java.lang.Object
    Defines index domain view for a variable and related operations on it.
    Version:
    4.7
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static boolean debugAll  
      (package private) boolean[] forRemoval  
      int[] indexToValue
      It specifies mapping of the index value onto value in the domain of the variable.
      (package private) IntVar var  
      (package private) boolean viewOfSparseDomain  
    • Constructor Summary

      Constructors 
      Constructor Description
      IndexDomainView​(IntVar var, boolean forceSparse)
      It creates an index domain view for a given variable.
      IndexDomainView​(IntVar var, int[] valuesInFocus)
      It creates an index domain view with only given values being in focus of the index domain view.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(int i)
      It checks if the value of a given index is still in the domain.
      int getSize()
      It returns size of the variable for which the index domain view is being created.
      int indexOfValue​(int value)
      It finds an index for a given value.
      void intializeSupportSweep()
      It marks all values in focus of the index domain view as not supported and requiring support to be established.
      boolean isSupported()
      It checks if all values are currently supported.
      void removeUnSupportedValues​(Store store)
      It removes all values for which no support was found since the initialization of the support sweep.
      boolean setSupport​(int i)
      It returns true if the ith-value was supported before.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • indexToValue

        public int[] indexToValue
        It specifies mapping of the index value onto value in the domain of the variable.
      • forRemoval

        boolean[] forRemoval
      • viewOfSparseDomain

        boolean viewOfSparseDomain
    • Constructor Detail

      • IndexDomainView

        public IndexDomainView​(IntVar var,
                               boolean forceSparse)
        It creates an index domain view for a given variable. It currently implements only sparse representation for index domain view.
        Parameters:
        var - variable for which the index domain view is created.
        forceSparse - forces a sparse representation inside (one value has one entry within the mapping).
      • IndexDomainView

        public IndexDomainView​(IntVar var,
                               int[] valuesInFocus)
        It creates an index domain view with only given values being in focus of the index domain view. Only values in focus may end up being removed if no support is founded.
        Parameters:
        var - variable for which the index domain view is created.
        valuesInFocus - values which are of interest.
    • Method Detail

      • intializeSupportSweep

        public void intializeSupportSweep()
        It marks all values in focus of the index domain view as not supported and requiring support to be established.
      • removeUnSupportedValues

        public void removeUnSupportedValues​(Store store)
        It removes all values for which no support was found since the initialization of the support sweep.
        Parameters:
        store - current store
      • contains

        public boolean contains​(int i)
        It checks if the value of a given index is still in the domain.
        Parameters:
        i - index which is being checked if it is still contained within a variable.
        Returns:
        true if the i-th value is still in the domain, false otherwise.
      • setSupport

        public boolean setSupport​(int i)
        It returns true if the ith-value was supported before.
        Parameters:
        i - the position of the value which is being supported.
        Returns:
        false if value has not been supported before by other value, true otherwise.
      • isSupported

        public boolean isSupported()
        It checks if all values are currently supported.
        Returns:
        true if all values are supported, false otherwise.
      • indexOfValue

        public int indexOfValue​(int value)
        It finds an index for a given value.
        Parameters:
        value - value for which the indexed is searched for.
        Returns:
        index for a given value.
      • getSize

        public int getSize()
        It returns size of the variable for which the index domain view is being created.
        Returns:
        number of values in the variable domain for which the index domain view is being created.