public class DoubleInterval extends NumericInterval
Modifier and Type | Field and Description |
---|---|
static DoubleInterval |
NonNegative |
static DoubleInterval |
Positive |
IllegalValue
Constructor and Description |
---|
DoubleInterval()
Creates a DoubleRange which accepts any double value.
|
DoubleInterval(double lower,
double upper)
Creates a new DoubleRange that accepts any value in the closed interval
[lower, upper].
|
DoubleInterval(NumericInterval rng)
Creates a new DoubleRange which is a copy of an existing NumericRange one.
|
DoubleInterval(java.lang.String str)
Creates a new DoubleRange from a specification string.
|
Modifier and Type | Method and Description |
---|---|
DoubleInterval |
clone() |
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer.
|
void |
set(double lower,
double upper)
Sets this DoubleRange so that it accepts any value in the closed interval
[lower, upper].
|
void |
set(double lower,
double upper,
java.lang.String closure)
Sets this DoubleRange so that it accepts any value within a specified
interval.
|
void |
set(NumericInterval rng)
Sets this DoubleRange to the value of any NumericRange.
|
void |
setLowerBound(double lower)
Sets the lower bound for the interval of this DoubleRange.
|
void |
setLowerBoundClosed(boolean closed)
Sets the lower bound for the interval of this DoubleRange to be closed or
open.
|
void |
setUpperBound(double upper)
Sets the upper bound for the interval of this DoubleRange.
|
void |
setUpperBoundClosed(boolean closed)
Sets the upper bound for the interval of this DoubleRange to be closed or
open.
|
java.lang.String |
toString() |
void |
updateBounds(double val)
Adjusts the upper or lower bounds of this interval such that it contains
val . |
void |
write(java.io.PrintWriter pw,
NumberFormat fmt,
java.lang.Object ref)
Writes a text description of this element to a PrintWriter.
|
canClipToRange, clipToRange, contains, epsilonEquals, equals, equals, getLowerBound, getRange, getUpperBound, intersect, isBounded, isClosed, isEmpty, isLowerBoundClosed, isTypeCompatible, isUpperBoundClosed, isValid, makeValid, makeValid, merge, parse, scale, validate, validate, validate, withinRange, withinRange
isWritable, setError
public static DoubleInterval Positive
public static DoubleInterval NonNegative
public DoubleInterval()
public DoubleInterval(double lower, double upper)
lower
- interval lower boundupper
- interval upper boundpublic DoubleInterval(NumericInterval rng)
rng
- range to copypublic DoubleInterval(java.lang.String str) throws java.lang.IllegalArgumentException
scan
.str
- specification string for this DoubleRangejava.lang.IllegalArgumentException
- if the string is not in the correct format.public void setLowerBound(double lower)
lower
- new lower interval boundpublic void setLowerBoundClosed(boolean closed)
closed
- if true, sets the lower interval bound to be closedpublic void setUpperBound(double upper)
upper
- new upper interval boundpublic void setUpperBoundClosed(boolean closed)
closed
- if true, sets the upper interval bound to be closedpublic void set(double lower, double upper)
lower
- interval lower boundupper
- interval upper boundpublic void set(NumericInterval rng)
rng
- numeric range to copypublic void set(double lower, double upper, java.lang.String closure)
lower
- interval lower boundupper
- interval upper boundclosure
- specifies whether the lower and upper bounds are open or closedjava.lang.IllegalArgumentException
- if the closure specification string is not one of "[]", "[)", "(]", or
"()".public void updateBounds(double val)
val
.val
- value to be contained by the intervalpublic java.lang.String toString()
toString
in class java.lang.Object
public void scan(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
[
' or '(
' character, depending
on whether the lower bound is closed or open;
,
' character
]
' or ')
' character, depending
on whether the upper bound is closed or open;
public void write(java.io.PrintWriter pw, NumberFormat fmt, java.lang.Object ref) throws java.io.IOException
scan
and complete
enough to allow full reconstruction of the element.write
in interface Scannable
write
in class RangeBase
pw
- stream for writing the elementfmt
- numeric formating informationref
- optional reference object which can be used for producing references to
other objectsjava.io.IOException
- if an I/O error occuredpublic DoubleInterval clone()
clone
in interface Clonable
clone
in class NumericInterval