|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.cp.solver.variables.integer.AbstractIntDomain
choco.cp.solver.variables.integer.LinkedIntDomain
public class LinkedIntDomain
Integer domain implementation using linked list of indices. This implementation is more costful in terms of memory than bit set implementation but should be more efficient in terms of CPU (mainly for interating the domain).
This implementation should be extendable to deal with large sparse domains, since we mainly deal with indices of values (which is managed implicitely here: offset + index). Author: Guillaume Rochart Creation date: January, 20th 2007
Field Summary | |
---|---|
protected IntDomainIterator |
_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 | |
---|---|
LinkedIntDomain(IntDomainVarImpl v,
int[] sortedValues,
IEnvironment environment,
PropagationEngine propagationEngine)
|
|
LinkedIntDomain(IntDomainVarImpl v,
int a,
int b,
IEnvironment environment,
PropagationEngine propagationEngine)
Constructs a new domain for the specified variable and bounds. |
Method Summary | |
---|---|
boolean |
contains(int x)
Checks if the value x is in the current domain. |
int |
getInf()
Returns the lower bound of the domain in O(1). |
DisposableIntIterator |
getIterator()
Retrieve an getIterator for traversing the sequence of values contained in the domain |
int |
getNextValue(int x)
Looks for the value after x in the domain. |
int |
getPrevValue(int x)
Looks for the value before x in the domain. |
int |
getRandomValue()
Returns a value randomly choosed in the domain. |
int |
getSize()
Retuens the dynamic size of the domain, that is the number of possible values in the domain when the method is called. |
int |
getSup()
Returns the upper bound of the domain in O(1). |
boolean |
hasNextValue(int x)
Checks if there is a value after x in the domain. |
boolean |
hasPrevValue(int x)
Checks if there is a value before x in the domain. |
boolean |
isBoolean()
Checks if this is a boolean domain, that is the values are 0 or 1. |
boolean |
isEnumerated()
Interface method to know if this domain is enumerated. |
String |
pretty()
pretty printing of the object. |
boolean |
remove(int x)
Removes a precise value from the domain. |
void |
restrict(int x)
Restricts the domain to the given value. |
String |
toString()
|
int |
updateInf(int x)
Updates the lower bound of the domain to the next value contained in the domain which is more or equal to x. |
int |
updateSup(int x)
Updates the upper bound of the domain to the next value contained in the domain which is less or equal to x. |
Methods inherited from class choco.cp.solver.variables.integer.AbstractIntDomain |
---|
clearDeltaDomain, copyDelta, fastNextValue, fastPrevValue, freezeDeltaDomain, getDeltaIterator, getReleasedDeltaDomain, instantiate, releaseDeltaDomain, removeInterval, removeVal, updateInf, updateSup |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected IntDomainIterator _iterator
Constructor Detail |
---|
public LinkedIntDomain(IntDomainVarImpl v, int a, int b, IEnvironment environment, PropagationEngine propagationEngine)
v
- The involved variable.a
- Minimal value.b
- Maximal value.environment
- propagationEngine
- public LinkedIntDomain(IntDomainVarImpl v, int[] sortedValues, IEnvironment environment, PropagationEngine propagationEngine)
Method Detail |
---|
public int getInf()
public int getSup()
public boolean contains(int x)
x
- the value to check wetehr it is in the domain.
It can be completely outside of the original domain in this implementation.
public int updateInf(int x)
x
- a value the lower bound should be more than. x should be less than the upper bound!
public int updateSup(int x)
x
- a value the upper bound should be less than. x should be more than lower bound!
public void restrict(int x)
x
- the value to which this domain should be restricted to.public boolean remove(int x)
x
- the value in the domain.
public int getSize()
public DisposableIntIterator getIterator()
IntDomain
public int getNextValue(int x)
x
- A value (in or out of the domain).
public int getPrevValue(int x)
x
- A value (in or out of the domain).
public boolean hasNextValue(int x)
x
- value in or out of the domain.
public boolean hasPrevValue(int x)
x
- value in or out of the domain.
public int getRandomValue()
public boolean isEnumerated()
public boolean isBoolean()
public String toString()
toString
in class AbstractIntDomain
public String pretty()
IPretty
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |