- java.lang.Object
-
- com.io7m.jranges.RangeInclusiveL
-
- All Implemented Interfaces:
RangeInclusiveLType
public final class RangeInclusiveL extends java.lang.Object implements RangeInclusiveLType
An inclusive range withlongcomponents.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRangeInclusiveL.BuilderBuilds instances of typeRangeInclusiveL.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RangeInclusiveL.Builderbuilder()Creates a builder forRangeInclusiveL.static RangeInclusiveLcopyOf(RangeInclusiveLType instance)Creates an immutable copy of aRangeInclusiveLTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofRangeInclusiveLthat have equal attribute values.inthashCode()Computes a hash code from attributes:lower,upper.longlower()static RangeInclusiveLof(long lower, long upper)Construct a new immutableRangeInclusiveLinstance.java.lang.StringtoString()Prints the immutable valueRangeInclusiveLwith attribute values.longupper()RangeInclusiveLwithLower(long value)Copy the current immutable object by setting a value for thelowerattribute.RangeInclusiveLwithUpper(long value)Copy the current immutable object by setting a value for theupperattribute.-
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 Detail
-
lower
public long lower()
- Specified by:
lowerin interfaceRangeInclusiveLType- Returns:
- The lower bound of the inclusive range.
-
upper
public long upper()
- Specified by:
upperin interfaceRangeInclusiveLType- Returns:
- The upper bound of the inclusive range.
-
withLower
public final RangeInclusiveL withLower(long value)
Copy the current immutable object by setting a value for thelowerattribute. 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
thisobject
-
withUpper
public final RangeInclusiveL withUpper(long value)
Copy the current immutable object by setting a value for theupperattribute. 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
thisobject
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofRangeInclusiveLthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:lower,upper.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueRangeInclusiveLwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
public static RangeInclusiveL of(long lower, long upper)
Construct a new immutableRangeInclusiveLinstance.- Parameters:
lower- The value for thelowerattributeupper- The value for theupperattribute- Returns:
- An immutable RangeInclusiveL instance
-
copyOf
public static RangeInclusiveL copyOf(RangeInclusiveLType instance)
Creates an immutable copy of aRangeInclusiveLTypevalue. 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
public static RangeInclusiveL.Builder builder()
Creates a builder forRangeInclusiveL.RangeInclusiveL.builder() .setLower(long) // requiredlower.setUpper(long) // requiredupper.build();- Returns:
- A new RangeInclusiveL builder
-
-