public final class NumericalValueRange extends NumericalValue
NumericalValue
sub-class for representing integer intervals. Each NumericalValueRange
is
defined by two integers - min
and max
- the lower and the upper bound of the represented interval.BASE_64_CONSTANT_PATTERN, DECIMAL_CONSTANT_PATTERN, HEX_CONSTANT_PATTERN, NUMERICAL_RANGE_PATTERN, SINGLE_CONSTANT_PATTERN
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int value)
Returns true if the passed integer lies completely inside the interval represented by this
NumericalValue
. |
boolean |
contains(NumericalValue value)
Returns true if the passed
NumericalValue lies completely inside the interval represented by this
NumericalValueRange . |
boolean |
contains(NumericalValueRange range)
Returns true if the passed
NumericalValueRange lies completely inside the interval represented by this
NumericalValueRange . |
boolean |
contains(Object value)
Returns true if the passed
Integer or NumericalValue lies completely inside the interval
represented by this NumericalValue . |
boolean |
contains(SingleNumericalValue value)
Returns true if the passed
SingleNumericalValue lies completely inside the interval represented by this
NumericalValueRange . |
static NumericalValueRange |
create(int min,
int max)
The build method for creating
NumericalValueRange objects. |
int |
getMax()
Returns the upper boundary.
|
int |
getMin()
Returns the lower boundary.
|
static NumericalValueRange |
parseNumericalValueRange(String value)
Parses a
NumericalValueRange from a String . |
String |
toString() |
intersect, intersect, parseNumericalValue
public static final NumericalValueRange create(int min, int max)
NumericalValueRange
objects. The specified min and max
parameters are going to be used for initializing the min
and max
variables of the new
NumericalValueRange
. Since this only makes sense if min ≤ max, null
will be
returned if this requirement is violated.min
- the lower boundmax
- the upper boundNumericalValueRange
representing the specified interval or null
public static final NumericalValueRange parseNumericalValueRange(String value)
NumericalValueRange
from a String
. The lower and boundaries must be separated by a '~'
character and the the leading integer must not be larger than the trailing one. If these format requirements are
violated the method will return null
.value
- the String
to parseNumericalValueRange
representing the interval in the parsed String
or null
public final int getMin()
public final int getMax()
public boolean contains(Object value)
NumericalValue
Integer
or NumericalValue
lies completely inside the interval
represented by this NumericalValue
. If the parameter is not an Integer
or a
NumericalValue
, the method will return false
.contains
in class NumericalValue
value
- the Integer
or NumericalValue
to checktrue
if the value is complete contained, false
if it is notpublic boolean contains(NumericalValue value)
NumericalValue
lies completely inside the interval represented by this
NumericalValueRange
.value
- the NumericalValue
to checktrue
if the value is complete contained, false
if it is notpublic boolean contains(NumericalValueRange range)
NumericalValueRange
lies completely inside the interval represented by this
NumericalValueRange
.range
- the NumericalValueRange
to checktrue
if the value is complete contained, false
if it is notpublic boolean contains(SingleNumericalValue value)
SingleNumericalValue
lies completely inside the interval represented by this
NumericalValueRange
.value
- the SingleNumericalValue
to checktrue
if the value is complete contained, false
if it is notpublic boolean contains(int value)
NumericalValue
NumericalValue
.contains
in class NumericalValue
value
- the integer to checktrue
if the value is complete contained, false
if it is notCopyright © 2013 University of Konstanz, Distributed Systems Group. All Rights Reserved.