Package com.io7m.coffeepick.runtime
Class RuntimeVersionRange
java.lang.Object
com.io7m.coffeepick.runtime.RuntimeVersionRange
- All Implemented Interfaces:
RuntimeVersionRangeType
public final class RuntimeVersionRange extends java.lang.Object implements RuntimeVersionRangeType
A range of runtime versions.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRuntimeVersionRange.BuilderBuilds instances of typeRuntimeVersionRange. -
Method Summary
Modifier and Type Method Description static RuntimeVersionRange.Builderbuilder()Creates a builder forRuntimeVersionRange.static RuntimeVersionRangecopyOf(RuntimeVersionRangeType instance)Creates an immutable copy of aRuntimeVersionRangeTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofRuntimeVersionRangethat have equal attribute values.inthashCode()Computes a hash code from attributes:lower,lowerExclusive,upper,upperExclusive.RuntimeVersionlower()booleanlowerExclusive()static RuntimeVersionRangeof(RuntimeVersion lower, boolean lowerExclusive, RuntimeVersion upper, boolean upperExclusive)Construct a new immutableRuntimeVersionRangeinstance.java.lang.StringtoString()Prints the immutable valueRuntimeVersionRangewith attribute values.RuntimeVersionupper()booleanupperExclusive()RuntimeVersionRangewithLower(RuntimeVersion value)Copy the current immutable object by setting a value for thelowerattribute.RuntimeVersionRangewithLowerExclusive(boolean value)Copy the current immutable object by setting a value for thelowerExclusiveattribute.RuntimeVersionRangewithUpper(RuntimeVersion value)Copy the current immutable object by setting a value for theupperattribute.RuntimeVersionRangewithUpperExclusive(boolean value)Copy the current immutable object by setting a value for theupperExclusiveattribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.io7m.coffeepick.runtime.RuntimeVersionRangeType
checkPreconditions, includes, toExternalString
-
Method Details
-
lower
- Specified by:
lowerin interfaceRuntimeVersionRangeType- Returns:
- The lower bound of the range
-
lowerExclusive
public boolean lowerExclusive()- Specified by:
lowerExclusivein interfaceRuntimeVersionRangeType- Returns:
trueiff the lower bound is exclusive
-
upper
- Specified by:
upperin interfaceRuntimeVersionRangeType- Returns:
- The upper bound of the range
-
upperExclusive
public boolean upperExclusive()- Specified by:
upperExclusivein interfaceRuntimeVersionRangeType- Returns:
trueiff the upper bound is exclusive
-
withLower
Copy the current immutable object by setting a value for thelowerattribute. A shallow reference 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
-
withLowerExclusive
Copy the current immutable object by setting a value for thelowerExclusiveattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for lowerExclusive- Returns:
- A modified copy of the
thisobject
-
withUpper
Copy the current immutable object by setting a value for theupperattribute. A shallow reference 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
-
withUpperExclusive
Copy the current immutable object by setting a value for theupperExclusiveattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for upperExclusive- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofRuntimeVersionRangethat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:lower,lowerExclusive,upper,upperExclusive.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueRuntimeVersionRangewith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
public static RuntimeVersionRange of(RuntimeVersion lower, boolean lowerExclusive, RuntimeVersion upper, boolean upperExclusive)Construct a new immutableRuntimeVersionRangeinstance.- Parameters:
lower- The value for thelowerattributelowerExclusive- The value for thelowerExclusiveattributeupper- The value for theupperattributeupperExclusive- The value for theupperExclusiveattribute- Returns:
- An immutable RuntimeVersionRange instance
-
copyOf
Creates an immutable copy of aRuntimeVersionRangeTypevalue. 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 RuntimeVersionRange instance
-
builder
Creates a builder forRuntimeVersionRange.RuntimeVersionRange.builder() .setLower(com.io7m.coffeepick.runtime.RuntimeVersion) // requiredlower.setLowerExclusive(boolean) // requiredlowerExclusive.setUpper(com.io7m.coffeepick.runtime.RuntimeVersion) // requiredupper.setUpperExclusive(boolean) // requiredupperExclusive.build();- Returns:
- A new RuntimeVersionRange builder
-