choco.cp.solver.variables.integer
Class BooleanDomain

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

public final class BooleanDomain
extends AbstractIntDomain


Field Summary
protected  BooleanDomainIterator _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
BooleanDomain(IntDomainVarImpl v, IEnvironment environment, PropagationEngine propagationEngine)
          Constructs a new domain for the specified variable and bounds.
 
Method Summary
protected  boolean _instantiate(int x, SConstraint cause)
          Instantiating a variable to an search value.
protected  boolean _removeVal(int x, SConstraint cause)
          Removing a value from the domain of a variable.
protected  boolean _updateInf(int x, SConstraint cause)
          Improving the lower bound.
protected  boolean _updateSup(int x, SConstraint cause)
          Improving the upper bound.
 boolean contains(int x)
          Checks if the value is present.
 int getInf()
          Returns the minimal present value.
 DisposableIntIterator getIterator()
          Retrieve an getIterator for traversing the sequence of values contained in the domain
 int getNextValue(int x)
          Returns the value following x
 int getOffset()
           
 int getPrevValue(int x)
          Returns the value preceding x
 int getRandomValue()
          Returns a value randomly choosed in the domain.
 int getSize()
          Returns the current size of the domain.
 int getSup()
          Returns the maximal present value.
 int getValueIfInst()
          This method is not relevant if the variable is not instantiated.
 boolean hasNextValue(int x)
          Checks if the value has a following value.
 boolean hasPrevValue(int x)
          Checks if the value has a preceding value.
 boolean instantiate(int x, SConstraint cause, boolean forceAwake)
          Internal var: instantiation of the variable caused by its i-th constraint Returns a boolean indicating whether the call indeed added new information.
 boolean isBoolean()
          Is it a 0/1 domain ?
 boolean isEnumerated()
           
 boolean isInstantiated()
           
 String pretty()
          pretty printing of the object.
 boolean remove(int x)
          Removes a value.
 boolean removeVal(int x, SConstraint cause, boolean forceAwake)
          Internal var: update (value removal) on the domain of a variable caused by its i-th constraint.
 void restrict(int x)
          Removes all the value but the specified one.
 String toString()
           
 int updateInf(int x)
          Sets a new minimal value.
 boolean updateInf(int x, SConstraint cause, boolean forceAwake)
          Internal var: update on the variable lower bound caused by its i-th constraint.
 int updateSup(int x)
          Sets a new maximal value.
 boolean updateSup(int x, SConstraint cause, boolean forceAwake)
          Internal var: update on the variable upper bound caused by its i-th constraint.
 
Methods inherited from class choco.cp.solver.variables.integer.AbstractIntDomain
clearDeltaDomain, copyDelta, fastNextValue, fastPrevValue, freezeDeltaDomain, getDeltaIterator, getReleasedDeltaDomain, releaseDeltaDomain, removeInterval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_iterator

protected BooleanDomainIterator _iterator
Constructor Detail

BooleanDomain

public BooleanDomain(IntDomainVarImpl v,
                     IEnvironment environment,
                     PropagationEngine propagationEngine)
Constructs a new domain for the specified variable and bounds.

Parameters:
v - The involved variable.
environment -
propagationEngine -
Method Detail

getValueIfInst

public final int getValueIfInst()
This method is not relevant if the variable is not instantiated. For performance issue, this test is not

Returns:
the value IF the variable is instantiated

isInstantiated

public final boolean isInstantiated()
Returns:
true if the boolean is instantiated

getInf

public final int getInf()
Returns the minimal present value.


getSup

public final int getSup()
Returns the maximal present value.


updateInf

public int updateInf(int x)
Sets a new minimal value.

Parameters:
x - New bound value.

updateSup

public int updateSup(int x)
Sets a new maximal value.

Parameters:
x - New bound value.

contains

public final boolean contains(int x)
Checks if the value is present.

Parameters:
x - The value to check.

remove

public boolean remove(int x)
Removes a value.


restrict

public final void restrict(int x)
Removes all the value but the specified one.


getSize

public final int getSize()
Returns the current size of the domain.


getIterator

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


getNextValue

public final int getNextValue(int x)
Returns the value following x


getPrevValue

public final int getPrevValue(int x)
Returns the value preceding x


hasNextValue

public final boolean hasNextValue(int x)
Checks if the value has a following value.


hasPrevValue

public final boolean hasPrevValue(int x)
Checks if the value has a preceding value.


getRandomValue

public final int getRandomValue()
Returns a value randomly choosed in the domain.


isEnumerated

public boolean isEnumerated()

isBoolean

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


toString

public String toString()
Overrides:
toString in class AbstractIntDomain

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

updateSup

public boolean updateSup(int x,
                         SConstraint cause,
                         boolean forceAwake)
                  throws ContradictionException
Internal var: update on the variable upper bound caused by its i-th constraint. Returns a boolean indicating whether the call indeed added new information.

Overrides:
updateSup in class AbstractIntDomain
Parameters:
x - The new upper bound
cause -
forceAwake -
Returns:
a boolean indicating whether the call indeed added new information.
Throws:
ContradictionException - contradiction exception

updateInf

public boolean updateInf(int x,
                         SConstraint cause,
                         boolean forceAwake)
                  throws ContradictionException
Internal var: update on the variable lower bound caused by its i-th constraint. Returns a boolean indicating whether the call indeed added new information

Overrides:
updateInf in class AbstractIntDomain
Parameters:
x - The new lower bound.
cause -
forceAwake -
Returns:
a boolean indicating whether the call indeed added new information
Throws:
ContradictionException - contradiction exception

removeVal

public final boolean removeVal(int x,
                               SConstraint cause,
                               boolean forceAwake)
                        throws ContradictionException
Internal var: update (value removal) on the domain of a variable caused by its i-th constraint. Note: Whenever the hole results in a stronger var (such as a bound update or an instantiation, then we forget about the index of the var generating constraint. Indeed the propagated var is stronger than the initial one that was generated; thus the generating constraint should be informed about such a new var. Returns a boolean indicating whether the call indeed added new information.

Overrides:
removeVal in class AbstractIntDomain
Parameters:
x - The removed value
cause -
forceAwake -
Returns:
a boolean indicating whether the call indeed added new information.
Throws:
ContradictionException - contradiction exception

instantiate

public final boolean instantiate(int x,
                                 SConstraint cause,
                                 boolean forceAwake)
                          throws ContradictionException
Internal var: instantiation of the variable caused by its i-th constraint Returns a boolean indicating whether the call indeed added new information.

Overrides:
instantiate in class AbstractIntDomain
Parameters:
x - the new upper bound
cause -
forceAwake -
Returns:
a boolean indicating whether the call indeed added new information.
Throws:
ContradictionException - contradiction exception

_instantiate

protected final boolean _instantiate(int x,
                                     SConstraint cause)
                              throws ContradictionException
Instantiating a variable to an search value. Returns true if this was a real modification or not

Parameters:
x - the new instantiate value
cause -
Returns:
wether it is a real modification or not
Throws:
ContradictionException - contradiction exception

_updateInf

protected final boolean _updateInf(int x,
                                   SConstraint cause)
                            throws ContradictionException
Improving the lower bound.

Parameters:
x - the new lower bound
cause -
Returns:
a boolean indicating wether the update has been done
Throws:
ContradictionException - contradiction exception

_updateSup

protected final boolean _updateSup(int x,
                                   SConstraint cause)
                            throws ContradictionException
Improving the upper bound.

Parameters:
x - the new upper bound
cause -
Returns:
wether the update has been done
Throws:
ContradictionException - contradiction exception

_removeVal

protected final boolean _removeVal(int x,
                                   SConstraint cause)
                            throws ContradictionException
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 -
Returns:
wether the removal has been done
Throws:
ContradictionException - contradiction excpetion

getOffset

public final int getOffset()


Copyright © 2012. All Rights Reserved.