| Constructor and Description |
|---|
SparseSetDomain(StateManager sm,
int min,
int max) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(int v)
Checks if the specified value belongs to the domain.
|
int |
fillArray(int[] dest)
Copies the values of the domain into an array.
|
boolean |
isBound()
Checks if the domain contains a single element.
|
int |
max()
Returns the maximum value of the domain.
|
int |
min()
Returns the minimum value of the domain.
|
void |
remove(int v,
DomainListener l)
Removes a value from the domain and notifies appropriately the listener.
|
void |
removeAbove(int value,
DomainListener l)
Removes every value larger than the specified value from the domain.
|
void |
removeAllBut(int v,
DomainListener l)
Removes every value from the domain except the specified one.
|
void |
removeBelow(int value,
DomainListener l)
Removes every value less than the specified value from the domain.
|
int |
size()
Returns the cardinality of the domain.
|
String |
toString() |
public SparseSetDomain(StateManager sm, int min, int max)
public int fillArray(int[] dest)
IntDomainpublic int min()
IntDomainpublic int max()
IntDomainpublic int size()
IntDomainpublic boolean contains(int v)
IntDomainpublic boolean isBound()
IntDomainpublic void remove(int v,
DomainListener l)
IntDomainremove in interface IntDomainv - the value to be removedl - the methods of the listener are notified as follows:
DomainListener.change() is called
if v belongs to the domainDomainListener.changeMax() is called
if v is equal to the maximum valueDomainListener.changeMin() is called
if v is equal to the minimum valueDomainListener.bind() is called
if v belongs to the domain and after its removal
the domain has a single valueDomainListener.empty() is called
if v is the last value in the domain i.e.
the domain is empty after this operationpublic void removeAllBut(int v,
DomainListener l)
IntDomainremoveAllBut in interface IntDomainv - the value to be keptl - the methods of the listener are notified as follows:
DomainListener.change() is called
if some value is removed during the operationDomainListener.changeMax() is called
if v is not equal to the maximum valueDomainListener.changeMin() is called
if v is not equal to the minimum valueDomainListener.bind() is called
if v belongs to the domain and after its removal
the domain has a single valueDomainListener.empty() is called
if v is not in the domain i.e.
the domain is empty after this operationpublic void removeBelow(int value,
DomainListener l)
IntDomainremoveBelow in interface IntDomainvalue - the value such that all the values less than v are removedl - the methods of the listener are notified as follows:
DomainListener.change() is called
if some value is removed during the operationDomainListener.changeMax() is called
if v is is larger than the minimum valueDomainListener.bind() is called
if v is equal to the maximum valueDomainListener.empty() is called
if v is larger than the maximum value i.e.
the domain is empty after this operationpublic void removeAbove(int value,
DomainListener l)
IntDomainremoveAbove in interface IntDomainvalue - the value such that all the values larger than v are removedl - the methods of the listener are notified as follows:
DomainListener.change() is called
if some value is removed during the operationDomainListener.changeMax() is called
if v is is less than the maximum valueDomainListener.bind() is called
if v is equal to the minimum valueDomainListener.empty() is called
if v is less than the minimum value i.e.
the domain is empty after this operationCopyright © 2018 Laurent Michel, Pierre Schaus, Pascal Van Hentenryck. All rights reserved.