Package com.io7m.jranges
Class RangeHalfOpenI
java.lang.Object
com.io7m.jranges.RangeHalfOpenI
- All Implemented Interfaces:
RangeHalfOpenIType
A half open (inclusive lower, exclusive upper) range with
int components.- Since:
- 4.0.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic RangeHalfOpenI.Builderbuilder()Creates a builder forRangeHalfOpenI.static RangeHalfOpenIcopyOf(RangeHalfOpenIType instance) Creates an immutable copy of aRangeHalfOpenITypevalue.booleanThis instance is equal to all instances ofRangeHalfOpenIthat have equal attribute values.inthashCode()Computes a hash code from attributes:lower,upper.intlower()static RangeHalfOpenIof(int lower, int upper) Construct a new immutableRangeHalfOpenIinstance.toString()Prints the immutable valueRangeHalfOpenIwith attribute values.intupper()final RangeHalfOpenIwithLower(int value) Copy the current immutable object by setting a value for thelowerattribute.final RangeHalfOpenIwithUpper(int 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, waitMethods inherited from interface com.io7m.jranges.RangeHalfOpenIType
checkPreconditions, includesValue, interval, isIncludedIn, isIncludedIn
-
Method Details
-
lower
public int lower()- Specified by:
lowerin interfaceRangeHalfOpenIType- Returns:
- The lower bound of the inclusive range.
-
upper
public int upper()- Specified by:
upperin interfaceRangeHalfOpenIType- Returns:
- The upper bound of the inclusive range.
-
withLower
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
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
This instance is equal to all instances ofRangeHalfOpenIthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:lower,upper. -
toString
Prints the immutable valueRangeHalfOpenIwith attribute values. -
of
Construct a new immutableRangeHalfOpenIinstance.- Parameters:
lower- The value for thelowerattributeupper- The value for theupperattribute- Returns:
- An immutable RangeHalfOpenI instance
-
copyOf
Creates an immutable copy of aRangeHalfOpenITypevalue. 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 RangeHalfOpenI instance
-
builder
Creates a builder forRangeHalfOpenI.RangeHalfOpenI.builder() .setLower(int) // requiredlower.setUpper(int) // requiredupper.build();- Returns:
- A new RangeHalfOpenI builder
-