Package com.io7m.jranges
Class RangeInclusiveI
java.lang.Object
com.io7m.jranges.RangeInclusiveI
- All Implemented Interfaces:
RangeInclusiveIType
An inclusive range with
int components.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic RangeInclusiveI.Builderbuilder()Creates a builder forRangeInclusiveI.static RangeInclusiveIcopyOf(RangeInclusiveIType instance) Creates an immutable copy of aRangeInclusiveITypevalue.booleanThis instance is equal to all instances ofRangeInclusiveIthat have equal attribute values.inthashCode()Computes a hash code from attributes:lower,upper.intlower()static RangeInclusiveIof(int lower, int upper) Construct a new immutableRangeInclusiveIinstance.toString()Prints the immutable valueRangeInclusiveIwith attribute values.intupper()final RangeInclusiveIwithLower(int value) Copy the current immutable object by setting a value for thelowerattribute.final RangeInclusiveIwithUpper(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.RangeInclusiveIType
checkPreconditions, includesValue, interval, isIncludedIn
-
Method Details
-
lower
public int lower()- Specified by:
lowerin interfaceRangeInclusiveIType- Returns:
- The lower bound of the inclusive range.
-
upper
public int upper()- Specified by:
upperin interfaceRangeInclusiveIType- 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 ofRangeInclusiveIthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:lower,upper. -
toString
Prints the immutable valueRangeInclusiveIwith attribute values. -
of
Construct a new immutableRangeInclusiveIinstance.- Parameters:
lower- The value for thelowerattributeupper- The value for theupperattribute- Returns:
- An immutable RangeInclusiveI instance
-
copyOf
Creates an immutable copy of aRangeInclusiveITypevalue. 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 RangeInclusiveI instance
-
builder
Creates a builder forRangeInclusiveI.RangeInclusiveI.builder() .setLower(int) // requiredlower.setUpper(int) // requiredupper.build();- Returns:
- A new RangeInclusiveI builder
-