- java.lang.Object
-
- com.io7m.jranges.RangeHalfOpenB
-
- All Implemented Interfaces:
RangeHalfOpenBType
public final class RangeHalfOpenB extends java.lang.Object implements RangeHalfOpenBType
A half open (inclusive lower, exclusive upper) range withBigIntegercomponents.- Since:
- 4.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRangeHalfOpenB.BuilderBuilds instances of typeRangeHalfOpenB.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RangeHalfOpenB.Builderbuilder()Creates a builder forRangeHalfOpenB.static RangeHalfOpenBcopyOf(RangeHalfOpenBType instance)Creates an immutable copy of aRangeHalfOpenBTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofRangeHalfOpenBthat have equal attribute values.inthashCode()Computes a hash code from attributes:lower,upper.java.math.BigIntegerlower()static RangeHalfOpenBof(java.math.BigInteger lower, java.math.BigInteger upper)Construct a new immutableRangeHalfOpenBinstance.java.lang.StringtoString()Prints the immutable valueRangeHalfOpenBwith attribute values.java.math.BigIntegerupper()RangeHalfOpenBwithLower(java.math.BigInteger value)Copy the current immutable object by setting a value for thelowerattribute.RangeHalfOpenBwithUpper(java.math.BigInteger 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.RangeHalfOpenBType
checkPreconditions, includesValue, interval, isIncludedIn, isIncludedIn
-
-
-
-
Method Detail
-
lower
public java.math.BigInteger lower()
- Specified by:
lowerin interfaceRangeHalfOpenBType- Returns:
- The lower bound of the inclusive range.
-
upper
public java.math.BigInteger upper()
- Specified by:
upperin interfaceRangeHalfOpenBType- Returns:
- The upper bound of the inclusive range.
-
withLower
public final RangeHalfOpenB withLower(java.math.BigInteger value)
Copy the current immutable object by setting a value for thelowerattribute. An equals check 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 RangeHalfOpenB withUpper(java.math.BigInteger value)
Copy the current immutable object by setting a value for theupperattribute. An equals check 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 ofRangeHalfOpenBthat 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 valueRangeHalfOpenBwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
public static RangeHalfOpenB of(java.math.BigInteger lower, java.math.BigInteger upper)
Construct a new immutableRangeHalfOpenBinstance.- Parameters:
lower- The value for thelowerattributeupper- The value for theupperattribute- Returns:
- An immutable RangeHalfOpenB instance
-
copyOf
public static RangeHalfOpenB copyOf(RangeHalfOpenBType instance)
Creates an immutable copy of aRangeHalfOpenBTypevalue. 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 RangeHalfOpenB instance
-
builder
public static RangeHalfOpenB.Builder builder()
Creates a builder forRangeHalfOpenB.RangeHalfOpenB.builder() .setLower(java.math.BigInteger) // requiredlower.setUpper(java.math.BigInteger) // requiredupper.build();- Returns:
- A new RangeHalfOpenB builder
-
-