- java.lang.Object
-
- com.io7m.jranges.RangeHalfOpenL
-
- All Implemented Interfaces:
RangeHalfOpenLType
public final class RangeHalfOpenL extends java.lang.Object implements RangeHalfOpenLType
A half open (inclusive lower, exclusive upper) range withlongcomponents.- Since:
- 4.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRangeHalfOpenL.BuilderBuilds instances of typeRangeHalfOpenL.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RangeHalfOpenL.Builderbuilder()Creates a builder forRangeHalfOpenL.static RangeHalfOpenLcopyOf(RangeHalfOpenLType instance)Creates an immutable copy of aRangeHalfOpenLTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofRangeHalfOpenLthat have equal attribute values.inthashCode()Computes a hash code from attributes:lower,upper.longlower()static RangeHalfOpenLof(long lower, long upper)Construct a new immutableRangeHalfOpenLinstance.java.lang.StringtoString()Prints the immutable valueRangeHalfOpenLwith attribute values.longupper()RangeHalfOpenLwithLower(long value)Copy the current immutable object by setting a value for thelowerattribute.RangeHalfOpenLwithUpper(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.RangeHalfOpenLType
checkPreconditions, includesValue, interval, isIncludedIn, isIncludedIn
-
-
-
-
Method Detail
-
lower
public long lower()
- Specified by:
lowerin interfaceRangeHalfOpenLType- Returns:
- The lower bound of the inclusive range.
-
upper
public long upper()
- Specified by:
upperin interfaceRangeHalfOpenLType- Returns:
- The upper bound of the inclusive range.
-
withLower
public final RangeHalfOpenL 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 RangeHalfOpenL 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 ofRangeHalfOpenLthat 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 valueRangeHalfOpenLwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
public static RangeHalfOpenL of(long lower, long upper)
Construct a new immutableRangeHalfOpenLinstance.- Parameters:
lower- The value for thelowerattributeupper- The value for theupperattribute- Returns:
- An immutable RangeHalfOpenL instance
-
copyOf
public static RangeHalfOpenL copyOf(RangeHalfOpenLType instance)
Creates an immutable copy of aRangeHalfOpenLTypevalue. 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 RangeHalfOpenL instance
-
builder
public static RangeHalfOpenL.Builder builder()
Creates a builder forRangeHalfOpenL.RangeHalfOpenL.builder() .setLower(long) // requiredlower.setUpper(long) // requiredupper.build();- Returns:
- A new RangeHalfOpenL builder
-
-