Package com.io7m.jranges
Class RangeInclusiveL
java.lang.Object
com.io7m.jranges.RangeInclusiveL
- All Implemented Interfaces:
RangeInclusiveLType
An inclusive range with
long
components.-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic RangeInclusiveL.Builder
builder()
Creates a builder forRangeInclusiveL
.static RangeInclusiveL
copyOf
(RangeInclusiveLType instance) Creates an immutable copy of aRangeInclusiveLType
value.boolean
This instance is equal to all instances ofRangeInclusiveL
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:lower
,upper
.long
lower()
static RangeInclusiveL
of
(long lower, long upper) Construct a new immutableRangeInclusiveL
instance.toString()
Prints the immutable valueRangeInclusiveL
with attribute values.long
upper()
final RangeInclusiveL
withLower
(long value) Copy the current immutable object by setting a value for thelower
attribute.final RangeInclusiveL
withUpper
(long 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.RangeInclusiveLType
checkPreconditions, includesValue, interval, isIncludedIn
-
Method Details
-
lower
public long lower()- Specified by:
lower
in interfaceRangeInclusiveLType
- Returns:
- The lower bound of the inclusive range.
-
upper
public long upper()- Specified by:
upper
in interfaceRangeInclusiveLType
- Returns:
- The upper bound of the inclusive range.
-
withLower
Copy the current immutable object by setting a value for thelower
attribute. A value equality check is 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 equality check is 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 ofRangeInclusiveL
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:lower
,upper
. -
toString
Prints the immutable valueRangeInclusiveL
with attribute values. -
of
Construct a new immutableRangeInclusiveL
instance.- Parameters:
lower
- The value for thelower
attributeupper
- The value for theupper
attribute- Returns:
- An immutable RangeInclusiveL instance
-
copyOf
Creates an immutable copy of aRangeInclusiveLType
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 RangeInclusiveL instance
-
builder
Creates a builder forRangeInclusiveL
.RangeInclusiveL.builder() .setLower(long) // required
lower
.setUpper(long) // requiredupper
.build();- Returns:
- A new RangeInclusiveL builder
-