Package com.io7m.jranges
Class RangeInclusiveD
java.lang.Object
com.io7m.jranges.RangeInclusiveD
- All Implemented Interfaces:
RangeInclusiveDType
An inclusive range with
double
components.-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic RangeInclusiveD.Builder
builder()
Creates a builder forRangeInclusiveD
.static RangeInclusiveD
copyOf
(RangeInclusiveDType instance) Creates an immutable copy of aRangeInclusiveDType
value.boolean
This instance is equal to all instances ofRangeInclusiveD
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:lower
,upper
.double
lower()
static RangeInclusiveD
of
(double lower, double upper) Construct a new immutableRangeInclusiveD
instance.toString()
Prints the immutable valueRangeInclusiveD
with attribute values.double
upper()
final RangeInclusiveD
withLower
(double value) Copy the current immutable object by setting a value for thelower
attribute.final RangeInclusiveD
withUpper
(double value) Copy the current immutable object by setting a value for theupper
attribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.io7m.jranges.RangeInclusiveDType
checkPreconditions, includesValue, interval, isIncludedIn
-
Method Details
-
lower
public double lower()- Specified by:
lower
in interfaceRangeInclusiveDType
- Returns:
- The lower bound of the inclusive range.
-
upper
public double upper()- Specified by:
upper
in interfaceRangeInclusiveDType
- Returns:
- The upper bound of the inclusive range.
-
withLower
Copy the current immutable object by setting a value for thelower
attribute. A value strict bits equality used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for lower- Returns:
- A modified copy of the
this
object
-
withUpper
Copy the current immutable object by setting a value for theupper
attribute. A value strict bits equality used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for upper- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofRangeInclusiveD
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:lower
,upper
. -
toString
Prints the immutable valueRangeInclusiveD
with attribute values. -
of
Construct a new immutableRangeInclusiveD
instance.- Parameters:
lower
- The value for thelower
attributeupper
- The value for theupper
attribute- Returns:
- An immutable RangeInclusiveD instance
-
copyOf
Creates an immutable copy of aRangeInclusiveDType
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable RangeInclusiveD instance
-
builder
Creates a builder forRangeInclusiveD
.RangeInclusiveD.builder() .setLower(double) // required
lower
.setUpper(double) // requiredupper
.build();- Returns:
- A new RangeInclusiveD builder
-