Class Domain
java.lang.Object
org.clafer.domain.Domain
- Direct Known Subclasses:
BoolDomain
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboundBetween(int low, int high) Remove all elements less than the low bound or greater than the high bound from this domain.static DomainboundDomain(int low, int high) boundHigh(int high) Remove all elements greater than the bound from this domain.boundLow(int low) Remove all elements less than the bound from this domain.static DomainconstantDomain(int value) booleancontains(int value) Checks if a value is within this domain.booleancontainsAll(int[] values) booleancontainsAll(int low, int high) booleancontainsAll(gnu.trove.TIntCollection values) booleancontainsAny(int[] values) booleancontainsAny(int low, int high) booleancontainsAny(gnu.trove.TIntCollection values) difference(Domain other) Subtract this domain with the other domain.static DomainenumDomain(int... values) static DomainenumDomain(gnu.trove.set.TIntSet values) static DomainenumDomain(IntStream values) booleanvoidforEach(IntConsumer action) Perform the action for every value in this domain in increasing order.intReturns the largest integer contained in this domain.intReturns the smallest integer contained in this domain.int[]Returns all the values contained in this domain.inthashCode()insert(int value) Add an element into this domain.intersection(Domain other) Intersect this domain with the other domain.booleanintersects(Domain other) Check if this domain intersects another domain.booleanChecks if this domain is defined as a lower and upper bound.booleanChecks if this domain contains a single value.booleanisEmpty()Checks if this domain contains no values.booleanisSubsetOf(Domain superset) Check if this domain is a (non-strict) subset of another domain.booleanisSupersetOf(Domain subset) iterator()Iterate over the domain in increasing order.iterator(boolean increasing) Iterate over the domain in the specified order.minus()offset(int c) Shift the elements in this domain.remove(int value) Remove an element from this domain.removeAll(IntPredicate predicate) Remove all elements from this domain where the predicate evaluates totrue.retainAll(IntPredicate predicate) Retains all elements from this domain where the predicate evaluates totrue.intsize()Returns how many values are contained in this domain.stream()toString()Union this domain with the other domain.
-
Field Details
-
EmptyDomain
-
bounds
-
-
Constructor Details
-
Domain
- Parameters:
bounds- sorted, unique, and immutable integers
-
-
Method Details
-
boundDomain
-
constantDomain
-
enumDomain
-
enumDomain
-
enumDomain
-
isBounded
Checks if this domain is defined as a lower and upper bound. If the domain is bounded then it contains every value between its lower and upper bound.- Returns:
trueif and only if this domain is a single contiguous region,falseotherwise
-
contains
Checks if a value is within this domain.- Parameters:
value- test this value- Returns:
trueif and only if this domain contains thevalue,falseotherwise
-
containsAll
-
containsAll
-
containsAll
-
containsAny
-
containsAny
-
containsAny
-
getLowBound
Returns the smallest integer contained in this domain. Undefined if this domain is empty.- Returns:
- the smallest integer contained in this domain
-
getHighBound
Returns the largest integer contained in this domain. Undefined if this domain is empty.- Returns:
- the largest integer contained in this domain
-
isEmpty
Checks if this domain contains no values.- Returns:
trueif and only if the size of this domain is zero,falseotherwise
-
isConstant
Checks if this domain contains a single value.- Returns:
trueif and only if the size of this domain is one,falseotherwise
-
size
Returns how many values are contained in this domain.- Returns:
- the size of this domain
-
isSubsetOf
Check if this domain is a (non-strict) subset of another domain.- Parameters:
superset-- Returns:
trueif and only if this domain is a subset ofsuperset,falseotherwise
-
isSupersetOf
-
intersects
Check if this domain intersects another domain.- Parameters:
other-- Returns:
trueif and only if this domain is intersectsother,falseotherwise
-
insert
-
remove
-
removeAll
Remove all elements from this domain where the predicate evaluates totrue.- Parameters:
predicate-- Returns:
- a subset of this domain where the predicate evaluates to
false.
-
retainAll
Retains all elements from this domain where the predicate evaluates totrue.- Parameters:
predicate-- Returns:
- a subset of this domain where the predicate evaluates to
true.
-
boundLow
-
boundHigh
-
boundBetween
Remove all elements less than the low bound or greater than the high bound from this domain.- Parameters:
low-high-- Returns:
-
invalid @code
{@code this.intersection({low, low + 1, ..., high})
-
minus
-
difference
Subtract this domain with the other domain.- Parameters:
other-- Returns:
- the difference of this domain with the other domain
-
intersection
Intersect this domain with the other domain.- Parameters:
other-- Returns:
- the intersection of this domain with the other domain
-
union
-
offset
-
add
-
getValues
Returns all the values contained in this domain.- Returns:
- values contained in this domain
-
forEach
Perform the action for every value in this domain in increasing order.- Parameters:
action- the action to perform
-
iterator
Iterate over the domain in increasing order.- Returns:
- an iterator over the values in this domain in increasing order
-
iterator
Iterate over the domain in the specified order.- Parameters:
increasing- increasing or decreasing order- Returns:
- an iterator over the values in this domain in the order specified
-
stream
-
equals
-
hashCode
-
toString
-