choco.cp.solver.variables.integer
Class IntervalIntDomain

java.lang.Object
  extended by choco.cp.solver.variables.integer.AbstractIntDomain
      extended by choco.cp.solver.variables.integer.IntervalIntDomain
All Implemented Interfaces:
IPretty, Domain, IntDomain

public class IntervalIntDomain
extends AbstractIntDomain


Field Summary
protected  IntervalIntDomainIterator _iterator
           
 
Fields inherited from class choco.cp.solver.variables.integer.AbstractIntDomain
currentInfPropagated, currentSupPropagated
 
Fields inherited from interface choco.kernel.solver.variables.integer.IntDomain
LOGGER
 
Constructor Summary
IntervalIntDomain(IntDomainVarImpl v, int a, int b, IEnvironment environment, PropagationEngine propagationEngine)
           
 
Method Summary
protected  boolean _removeVal(int x, SConstraint cause)
          Removing a value from the domain of a variable.
 boolean contains(int x)
          Testing whether an search value is contained within the domain.
 int fastNextValue(int x)
          Accessing the smallest value stored in the domain and strictly greater than x, assuming x is greater or equal to the lower bound.
 void freezeDeltaDomain()
          The delta domain container is "frozen" (it can no longer accept new value removals) so that this set of values can be iterated as such
 int getInf()
          Access the minimal value stored in the domain.
 DisposableIntIterator getIterator()
          Retrieve an getIterator for traversing the sequence of values contained in the domain
 int getNextValue(int x)
          Accessing the smallest value stored in the domain and strictly greater than x.
 int getPrevValue(int x)
          Accessing the largest value stored in the domain and strictly smaller than x.
 int getRandomValue()
          Draws a value at random from the domain.
 boolean getReleasedDeltaDomain()
          checks whether the delta domain has indeed been released (ie: chechks that no domain updates are pending)
 int getSize()
          Access the total number of values stored in the domain.
 int getSup()
          Access the maximal value stored in the domain/
 boolean hasNextValue(int x)
          Testing whether there are values in the domain that are strictly greater than x.
 boolean hasPrevValue(int x)
          Testing whether there are values in the domain that are strictly smaller than x.
 boolean isBoolean()
          Is it a 0/1 domain ?
 boolean isEnumerated()
           
 String pretty()
          pretty printing of the object.
 boolean releaseDeltaDomain()
          release the delta domain
 boolean remove(int x)
          Removing a single value from the domain.
 void restrict(int x)
          Restricting the domain to a singleton
 int updateInf(int x)
          Augment the minimal value stored in the domain.
 int updateSup(int x)
          Diminish the maximal value stored in the domain.
 
Methods inherited from class choco.cp.solver.variables.integer.AbstractIntDomain
clearDeltaDomain, copyDelta, fastPrevValue, getDeltaIterator, instantiate, removeInterval, removeVal, toString, updateInf, updateSup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_iterator

protected IntervalIntDomainIterator _iterator
Constructor Detail

IntervalIntDomain

public IntervalIntDomain(IntDomainVarImpl v,
                         int a,
                         int b,
                         IEnvironment environment,
                         PropagationEngine propagationEngine)
Method Detail

contains

public boolean contains(int x)
Description copied from interface: IntDomain
Testing whether an search value is contained within the domain.


getNextValue

public int getNextValue(int x)
Description copied from interface: IntDomain
Accessing the smallest value stored in the domain and strictly greater than x. Does not require x to be in the domain.

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

 int ub = dom.getSup();
 for (int val = dom.getInf(); val <= ub; val = dom.getNextValue(val)) {
     // operate on value 'val' here
 }


fastNextValue

public final int fastNextValue(int x)
Description copied from interface: IntDomain
Accessing the smallest value stored in the domain and strictly greater than x, assuming x is greater or equal to the lower bound.

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

 int ub = dom.getSup();
 for (int val = dom.getInf(); val <= ub; val = dom.fastNextValue(val)) {
     // operate on value 'val' here
 }

Specified by:
fastNextValue in interface IntDomain
Overrides:
fastNextValue in class AbstractIntDomain

getPrevValue

public int getPrevValue(int x)
Description copied from interface: IntDomain
Accessing the largest value stored in the domain and strictly smaller than x. Does not require x to be in the domain.

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

 int lb = dom.getInf();
 for (int val = dom.getSup(); val >= lb; val = dom.getPrevValue(val)) {
     // operate on value 'val' here
 }


getRandomValue

public int getRandomValue()
Description copied from interface: IntDomain
Draws a value at random from the domain.


getSize

public final int getSize()
Description copied from interface: IntDomain
Access the total number of values stored in the domain.


hasNextValue

public boolean hasNextValue(int x)
Description copied from interface: IntDomain
Testing whether there are values in the domain that are strictly greater than x. Does not require x to be in the domain.


hasPrevValue

public boolean hasPrevValue(int x)
Description copied from interface: IntDomain
Testing whether there are values in the domain that are strictly smaller than x. Does not require x to be in the domain.


getIterator

public DisposableIntIterator getIterator()
Description copied from interface: IntDomain
Retrieve an getIterator for traversing the sequence of values contained in the domain


remove

public boolean remove(int x)
Description copied from interface: IntDomain
Removing a single value from the domain.


getSup

public final int getSup()
Description copied from interface: IntDomain
Access the maximal value stored in the domain/


getInf

public final int getInf()
Description copied from interface: IntDomain
Access the minimal value stored in the domain.


restrict

public void restrict(int x)
Description copied from interface: IntDomain
Restricting the domain to a singleton


updateInf

public int updateInf(int x)
Description copied from interface: IntDomain
Augment the minimal value stored in the domain. returns the new lower bound (x or more, in case x was not in the domain)


updateSup

public int updateSup(int x)
Description copied from interface: IntDomain
Diminish the maximal value stored in the domain. returns the new upper bound (x or more, in case x was not in the domain).


_removeVal

protected boolean _removeVal(int x,
                             SConstraint cause)
                      throws ContradictionException
Description copied from class: AbstractIntDomain
Removing a value from the domain of a variable. Returns true if this was a real modification on the domain.

Parameters:
x - the value to remove
cause - constraint causing the modification
Returns:
wether the removal has been done
Throws:
ContradictionException - contradiction excpetion

isEnumerated

public boolean isEnumerated()

isBoolean

public boolean isBoolean()
Description copied from interface: IntDomain
Is it a 0/1 domain ?


pretty

public String pretty()
Description copied from interface: IPretty
pretty printing of the object. This String is not constant and may depend on the context.

Returns:
a readable string representation of the object

freezeDeltaDomain

public void freezeDeltaDomain()
Description copied from interface: IntDomain
The delta domain container is "frozen" (it can no longer accept new value removals) so that this set of values can be iterated as such

Specified by:
freezeDeltaDomain in interface IntDomain
Overrides:
freezeDeltaDomain in class AbstractIntDomain

releaseDeltaDomain

public boolean releaseDeltaDomain()
release the delta domain

Specified by:
releaseDeltaDomain in interface IntDomain
Overrides:
releaseDeltaDomain in class AbstractIntDomain
Returns:
wether it was a new update

getReleasedDeltaDomain

public boolean getReleasedDeltaDomain()
checks whether the delta domain has indeed been released (ie: chechks that no domain updates are pending)

Specified by:
getReleasedDeltaDomain in interface IntDomain
Overrides:
getReleasedDeltaDomain in class AbstractIntDomain


Copyright © 2012. All Rights Reserved.