choco.integer.var
Class IntervalIntDomain

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.integer.var.AbstractIntDomain
          extended by choco.integer.var.IntervalIntDomain
All Implemented Interfaces:
Entity, IntDomain
Direct Known Subclasses:
JumpIntervalIntDomain, PalmIntervalIntDomain

public class IntervalIntDomain
extends AbstractIntDomain


Nested Class Summary
 
Nested classes/interfaces inherited from class choco.integer.var.AbstractIntDomain
AbstractIntDomain.IntDomainIterator
 
Field Summary
protected  StoredInt inf
          The backtrackable minimal value of the variable.
protected static java.util.Random random
          A random generator for random value from the domain
protected  StoredInt sup
          The backtrackable maximal value of the variable.
 
Fields inherited from class choco.integer.var.AbstractIntDomain
currentInfPropagated, currentSupPropagated, logger, variable
 
Fields inherited from class choco.AbstractEntity
hook, problem
 
Constructor Summary
IntervalIntDomain(IntDomainVarImpl v, int a, int b)
           
 
Method Summary
protected  boolean _removeVal(int x)
          Removing a value from the domain of a variable.
 boolean contains(int x)
          Testing whether an search value is contained within the domain.
 IntIterator getDeltaIterator()
          Returns an getIterator over the set of values that have been removed from the domain since the last propagation
 int getInf()
          Access the minimal value stored in the domain.
 IntIterator getIterator()
          Returns an getIterator.
 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.
 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 isEnumerated()
           
 java.lang.String pretty()
          pretty printing of the object.
 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.integer.var.AbstractIntDomain
_instantiate, _updateInf, _updateSup, clearDeltaDomain, freezeDeltaDomain, getReleasedDeltaDomain, instantiate, releaseDeltaDomain, removeInterval, removeVal, updateInf, updateSup
 
Methods inherited from class choco.AbstractEntity
getProblem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface choco.Entity
getProblem
 

Field Detail

random

protected static java.util.Random random
A random generator for random value from the domain


inf

protected final StoredInt inf
The backtrackable minimal value of the variable.


sup

protected final StoredInt sup
The backtrackable maximal value of the variable.

Constructor Detail

IntervalIntDomain

public IntervalIntDomain(IntDomainVarImpl v,
                         int a,
                         int b)
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.


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.


getRandomValue

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


getSize

public 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 IntIterator getIterator()
Description copied from class: AbstractIntDomain
Returns an getIterator.

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

remove

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


getSup

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


getInf

public 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)
                      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.

Overrides:
_removeVal in class AbstractIntDomain
Throws:
ContradictionException

isEnumerated

public boolean isEnumerated()

getDeltaIterator

public IntIterator getDeltaIterator()
Description copied from interface: IntDomain
Returns an getIterator over the set of values that have been removed from the domain since the last propagation


pretty

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

Specified by:
pretty in interface Entity
Overrides:
pretty in class AbstractEntity
Returns:
a readable string representation of the object