Class ScaleView

    • Field Detail

      • cste

        public final int cste
    • Constructor Detail

      • ScaleView

        public ScaleView​(IntVar var,
                         int cste)
        Create a cste × var view
        Parameters:
        var - a variable
        cste - a positive integer
    • Method Detail

      • monitorDelta

        public IIntDeltaMonitor monitorDelta​(ICause propagator)
        Description copied from interface: IntVar
        Allow to monitor removed values of this.
        Parameters:
        propagator - the cause that requires to monitor delta
        Returns:
        a delta monitor
      • doRemoveIntervalFromVar

        protected boolean doRemoveIntervalFromVar​(int from,
                                                  int to)
                                           throws ContradictionException
        Description copied from class: IntView
        Action to execute on IntView.var when this view requires to remove an interval from it
        Overrides:
        doRemoveIntervalFromVar in class IntView<IntVar>
        Parameters:
        from - first value of the interval before modification of the view
        to - last value of the interval before modification of the view
        Returns:
        true if IntView.var has been modified
        Throws:
        ContradictionException - if modification fails
      • contains

        public boolean contains​(int value)
        Description copied from interface: IntVar
        Checks if a value v belongs to the domain of this
        Parameters:
        value - int
        Returns:
        true if the value belongs to the domain of this, false otherwise.
      • isInstantiatedTo

        public boolean isInstantiatedTo​(int value)
        Description copied from interface: IntVar
        Checks wether this is instantiated to val
        Parameters:
        value - int
        Returns:
        true if this is instantiated to val, false otherwise
      • getValue

        public int getValue()
        Description copied from interface: IntVar
        Retrieves the current value of the variable if instantiated, otherwier the lower bound.
        Returns:
        the current value (or lower bound if not yet instantiated).
      • getLB

        public int getLB()
        Description copied from interface: IntVar
        Retrieves the lower bound of the variable
        Returns:
        the lower bound
      • getUB

        public int getUB()
        Description copied from interface: IntVar
        Retrieves the upper bound of the variable
        Returns:
        the upper bound
      • nextValue

        public int nextValue​(int v)
        Description copied from interface: IntVar
        Returns the first value just after v in this which is in the domain. If no such value exists, returns Integer.MAX_VALUE;

        To iterate over the values in a IntVar, use the following loop:

         int ub = iv.getUB();
         for (int i = iv.getLB(); i <= ub; i = iv.nextValue(i)) {
             // operate on value i here
         }
        Parameters:
        v - the value to start checking (exclusive)
        Returns:
        the next value in the domain
      • nextValueOut

        public int nextValueOut​(int v)
        Description copied from interface: IntVar
        Returns the first value just after v in this which is out of the domain. If v is less than or equal to IntVar.getLB()-2, returns v + 1, if v is greater than or equal to IntVar.getUB(), returns v + 1.
        Parameters:
        v - the value to start checking (exclusive)
        Returns:
        the next value out of the domain
      • previousValue

        public int previousValue​(int v)
        Description copied from interface: IntVar
        Returns the previous value just before v in this. If no such value exists, returns Integer.MIN_VALUE;

        To iterate over the values in a IntVar, use the following loop:

         int lb = iv.getLB();
         for (int i = iv.getUB(); i >= lb; i = iv.previousValue(i)) {
             // operate on value i here
         }
        Parameters:
        v - the value to start checking (exclusive)
        Returns:
        the previous value in the domain
      • previousValueOut

        public int previousValueOut​(int v)
        Description copied from interface: IntVar
        Returns the first value just before v in this which is out of the domain. If v is greater than or equal to IntVar.getUB()+2, returns v - 1, if v is less than or equal to IntVar.getLB(), returns v - 1.
        Parameters:
        v - the value to start checking (exclusive)
        Returns:
        the previous value out of the domain
      • getValueIterator

        public DisposableValueIterator getValueIterator​(boolean bottomUp)
        Description copied from interface: IntVar
        Retrieves an iterator over values of this.

        The values can be iterated in a bottom-up way or top-down way.

        To bottom-up iterate over the values in a IntVar, use the following loop:

         DisposableValueIterator vit = var.getValueIterator(true);
         while(vit.hasNext()){
             int v = vit.next();
             // operate on value v here
         }
         vit.dispose();
        To top-down iterate over the values in a IntVar, use the following loop:
         DisposableValueIterator vit = var.getValueIterator(false);
         while(vit.hasPrevious()){
             int v = vit.previous();
             // operate on value v here
         }
         vit.dispose();
        Using both previous and next can lead to unexpected behaviour.
        Specified by:
        getValueIterator in interface IntVar
        Overrides:
        getValueIterator in class IntView<IntVar>
        Parameters:
        bottomUp - way to iterate over values. true means from lower bound to upper bound, false means from upper bound to lower bound.
        Returns:
        a disposable iterator over values of this.
      • getRangeIterator

        public DisposableRangeIterator getRangeIterator​(boolean bottomUp)
        Description copied from interface: IntVar
        Retrieves an iterator over ranges (or intervals) of this.

        The ranges can be iterated in a bottom-up way or top-down way.

        To bottom-up iterate over the values in a IntVar, use the following loop:

         DisposableRangeIterator rit = var.getRangeIterator(true);
         while (rit.hasNext()) {
             int from = rit.min();
             int to = rit.max();
             // operate on range [from,to] here
             rit.next();
         }
         rit.dispose();
        To top-down iterate over the values in a IntVar, use the following loop:
         DisposableRangeIterator rit = var.getRangeIterator(false);
         while (rit.hasPrevious()) {
             int from = rit.min();
             int to = rit.max();
             // operate on range [from,to] here
             rit.previous();
         }
         rit.dispose();
        Using both previous and next can lead to unexpected behaviour.
        Specified by:
        getRangeIterator in interface IntVar
        Overrides:
        getRangeIterator in class IntView<IntVar>
        Parameters:
        bottomUp - way to iterate over ranges. true means from lower bound to upper bound, false means from upper bound to lower bound.
        Returns:
        a disposable iterator over ranges of this.
      • justifyEvent

        public void justifyEvent​(IntEventType mask,
                                 int one,
                                 int two,
                                 int three)
        Description copied from interface: IView
        This methods is related to explanations, it binds an event occurring on the observed variable to the view.
        Parameters:
        mask - type of modification
        one - an int
        two - an int
        three - an int