Class Domains.Dom

  • All Implemented Interfaces:
    Domains.IDom
    Enclosing class:
    Domains

    public static final class Domains.Dom
    extends Domains.DomBasic
    The class for representing the domain of an integer variable.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        Dom​(int[] values)
      Builds an integer domain, with the specified integer values.
        Dom​(int min, int max)
      Builds an integer domain, with the specified integer interval.
      protected Dom​(String seq)
      Builds an integer domain, with the integer values (entities that are either integers or integer intervals) obtained by parsing the specified string.
    • Constructor Detail

      • Dom

        protected Dom​(String seq)
        Builds an integer domain, with the integer values (entities that are either integers or integer intervals) obtained by parsing the specified string.
      • Dom

        public Dom​(int[] values)
        Builds an integer domain, with the specified integer values.
      • Dom

        public Dom​(int min,
                   int max)
        Builds an integer domain, with the specified integer interval.
    • Method Detail

      • compactFormOf

        public static String compactFormOf​(int[] values)
      • firstValue

        public long firstValue()
        Returns the first (smallest) value of the domain. It may be VAL_M_INFINITY for -infinity.
      • lastValue

        public long lastValue()
        Returns the last (greatest) value of the domain. It may be VAL_P_INFINITY for +infinity.
      • contains

        public boolean contains​(long v)
        Returns true iff the domain contains the specified value.
      • nValues

        public long nValues()
        Returns the number of values in the domain, if the domain is finite. Returns -1 otherwise.
      • allValues

        public Object allValues()
        Returns the values of the integer domain, either as an object Range or as an array of integers. Returns null if the domain is infinite (or too large).
      • when

        public Domains.Dom when​(boolean condition)
        Returns this object if the condition is evaluated to true, null otherwise.
        Parameters:
        condition - a Boolean expression
        Returns:
        this object if the condition is evaluated to true, null otherwise