public interface VarSet extends ConstrainedVariable
The domain of a constrained set variable defines two sets:
The cardinality of a set constrained variable is an integer constrained variable.
You may define set intersections and unions.
See also Problem#elementAt(Set[], Var)
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(java.util.Set<java.lang.Integer> setOfValues) |
Var |
getCardinality() |
java.util.Set<java.lang.Integer> |
getPossibleSet() |
java.util.Set<java.lang.Integer> |
getRequiredSet() |
java.util.Set<java.lang.Integer> |
getValue() |
VarSet |
intersection(VarSet varSet)
Creates a new set variable that is an intersection of this set variable
with the "varSet" passed as a parameter.
|
boolean |
isBound() |
boolean |
isPossible(int value) |
boolean |
isRequired(int value) |
void |
remove(int value)
Removes the "value' from the possible set
|
void |
require(int val)
Adds the "value" to the required set
|
void |
setEmpty(boolean flag)
Sets the cardinality of this set variable to be equals 0 if
the flag is true, and to be more or equal 1 if the flag is false.
|
void |
setValue(java.util.Set<java.lang.Integer> set)
Instantiates this set variable with the constant "set" of integers.
|
VarSet |
union(VarSet varSet)
Creates a new set variable that is an union of this set variable
with the "varSet" passed as a parameter.
|
getImpl, getName, getObject, getProblem, setImpl, setName, setObjectboolean contains(java.util.Set<java.lang.Integer> setOfValues)
setOfValues - Var getCardinality()
java.util.Set<java.lang.Integer> getPossibleSet()
java.util.Set<java.lang.Integer> getRequiredSet()
java.util.Set<java.lang.Integer> getValue()
throws java.lang.Exception
java.lang.Exception - if this set variable in not boundVarSet intersection(VarSet varSet) throws java.lang.Exception
varSet - java.lang.Exceptionboolean isBound()
boolean isPossible(int value)
boolean isRequired(int value)
void remove(int value)
throws java.lang.Exception
value - java.lang.Exceptionvoid require(int val)
throws java.lang.Exception
val - java.lang.Exception - if the value is outside of the possible setvoid setEmpty(boolean flag)
flag - void setValue(java.util.Set<java.lang.Integer> set)
throws java.lang.Exception
set - java.lang.Exception - if some values in the "set' are not possible