public final class IntegerDomain
extends java.lang.Object
IntegerDomain
class represents a finite integer domain (a finite set of integer values).
The domain is defined as a set of disjoint ranges IntegerRange
.
Modifier and Type | Field and Description |
---|---|
static IntegerDomain |
EMPTY |
Constructor and Description |
---|
IntegerDomain()
Constructs the empty domain.
|
IntegerDomain(java.math.BigInteger value)
Constructs a single-value domain.
|
IntegerDomain(java.math.BigInteger min,
java.math.BigInteger max)
Constructs a single-range domain (
[min, max] ). |
IntegerDomain(int width)
Constructs a single-range domain (
[0, 2^width - 1] ). |
IntegerDomain(IntegerDomain rhs)
Constructs a copy of the given domain.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(IntegerDomain rhs)
Checks whether this domain contains (as a subset) the given one (
rhs ). |
void |
exclude(IntegerDomain domain)
Excludes the given domain from this one.
|
void |
exclude(IntegerRange range)
Excludes the given range from the domain.
|
java.util.List<IntegerRange> |
getRanges()
Represents the domain in the form of ordered disjoint ranges.
|
void |
include(IntegerDomain domain)
Includes the given domain into this one.
|
void |
include(IntegerRange range)
Includes the given range into the domain.
|
void |
intersect(IntegerDomain domain)
Intersects this domain with the given one.
|
void |
intersect(IntegerRange range)
Intersects the domain with the given range (restricts the domain to the given range).
|
boolean |
isEmpty()
Checks whether the domain is empty.
|
boolean |
isSingular()
Checks whether the domain is singular (consists of a single value).
|
ru.ispras.testbase.knowledge.iterator.Iterator<java.math.BigInteger> |
iterator()
Returns the iterator over the domain's values.
|
boolean |
overlaps(IntegerDomain rhs)
Checks whether this domain overlaps with the given one (
rhs ). |
void |
set(java.math.BigInteger value)
Initializes the domain.
|
void |
set(IntegerDomain domain)
Initializes the domain.
|
void |
set(IntegerRange range)
Initializes the domain.
|
java.math.BigInteger |
size()
Returns the size of the domain.
|
java.lang.String |
toString() |
public static final IntegerDomain EMPTY
public IntegerDomain()
public IntegerDomain(java.math.BigInteger min, java.math.BigInteger max)
[min, max]
).min
- the lower bound of the domain.max
- the upper bound of the domain.java.lang.IllegalArgumentException
- if min
or max
is null.public IntegerDomain(java.math.BigInteger value)
value
- the only value of the domain.java.lang.IllegalArgumentException
- if value
is null.public IntegerDomain(int width)
[0, 2^width - 1]
).width
- the bit width.public IntegerDomain(IntegerDomain rhs)
rhs
- the domain to be copied.java.lang.IllegalArgumentException
- if rhs
is null.public java.util.List<IntegerRange> getRanges()
public java.math.BigInteger size()
public boolean isEmpty()
true
if the domain is empty; false
otherwise.public boolean isSingular()
true
if the domain is singular; false
otherwise.public boolean overlaps(IntegerDomain rhs)
rhs
).rhs
- the domain to be compared with this one.true
if this domain overlaps with the given one; false
otherwise.java.lang.IllegalArgumentException
- if rhs
is null.public boolean contains(IntegerDomain rhs)
rhs
).rhs
- the domain to be compared with this one.true
if this domain contains the given one; false
otherwise.java.lang.IllegalArgumentException
- if rhs
is null.public void set(java.math.BigInteger value)
value
- the value to be used for initialization.java.lang.IllegalArgumentException
- if range
is null.public void set(IntegerRange range)
range
- the range to be used for initialization.java.lang.IllegalArgumentException
- if range
is null.public void set(IntegerDomain domain)
domain
- the domain to be used for initialization.java.lang.IllegalArgumentException
- if domain
is null.public void include(IntegerRange range)
range
- the range to be included to the domain.java.lang.IllegalArgumentException
- if range
is null.public void include(IntegerDomain domain)
domain
- the domain to be included.java.lang.IllegalArgumentException
- if domain
is null.public void exclude(IntegerRange range)
range
- the range to be excluded from the domain.java.lang.IllegalArgumentException
- if range
is null.public void exclude(IntegerDomain domain)
domain
- the domain to be excluded.java.lang.IllegalArgumentException
- if domain
is null.public void intersect(IntegerRange range)
range
- the range to be intersected with the domain.java.lang.IllegalArgumentException
- if range
is null.public void intersect(IntegerDomain domain)
domain
- the domain to be intersected with this one.java.lang.IllegalArgumentException
- if domain
is null.public ru.ispras.testbase.knowledge.iterator.Iterator<java.math.BigInteger> iterator()
public java.lang.String toString()
toString
in class java.lang.Object