- java.lang.Object
-
- com.io7m.jranges.RangeInclusiveD
-
- All Implemented Interfaces:
RangeInclusiveDType
public final class RangeInclusiveD extends java.lang.Object implements RangeInclusiveDType
An inclusive range withdoublecomponents.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRangeInclusiveD.BuilderBuilds instances of typeRangeInclusiveD.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RangeInclusiveD.Builderbuilder()Creates a builder forRangeInclusiveD.static RangeInclusiveDcopyOf(RangeInclusiveDType instance)Creates an immutable copy of aRangeInclusiveDTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofRangeInclusiveDthat have equal attribute values.inthashCode()Computes a hash code from attributes:lower,upper.doublelower()static RangeInclusiveDof(double lower, double upper)Construct a new immutableRangeInclusiveDinstance.java.lang.StringtoString()Prints the immutable valueRangeInclusiveDwith attribute values.doubleupper()RangeInclusiveDwithLower(double value)Copy the current immutable object by setting a value for thelowerattribute.RangeInclusiveDwithUpper(double 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.RangeInclusiveDType
checkPreconditions, includesValue, interval, isIncludedIn
-
-
-
-
Method Detail
-
lower
public double lower()
- Specified by:
lowerin interfaceRangeInclusiveDType- Returns:
- The lower bound of the inclusive range.
-
upper
public double upper()
- Specified by:
upperin interfaceRangeInclusiveDType- Returns:
- The upper bound of the inclusive range.
-
withLower
public final RangeInclusiveD withLower(double value)
Copy the current immutable object by setting a value for thelowerattribute. A value strict bits equality 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 RangeInclusiveD withUpper(double value)
Copy the current immutable object by setting a value for theupperattribute. A value strict bits equality 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 ofRangeInclusiveDthat 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 valueRangeInclusiveDwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
public static RangeInclusiveD of(double lower, double upper)
Construct a new immutableRangeInclusiveDinstance.- Parameters:
lower- The value for thelowerattributeupper- The value for theupperattribute- Returns:
- An immutable RangeInclusiveD instance
-
copyOf
public static RangeInclusiveD copyOf(RangeInclusiveDType instance)
Creates an immutable copy of aRangeInclusiveDTypevalue. 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 RangeInclusiveD instance
-
builder
public static RangeInclusiveD.Builder builder()
Creates a builder forRangeInclusiveD.RangeInclusiveD.builder() .setLower(double) // requiredlower.setUpper(double) // requiredupper.build();- Returns:
- A new RangeInclusiveD builder
-
-