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.
  • Method Details

    • lower

      public RuntimeVersion lower()
      Specified by:
      lower in interface RuntimeVersionRangeType
      Returns:
      The lower bound of the range
    • lowerExclusive

      public boolean lowerExclusive()
      Specified by:
      lowerExclusive in interface RuntimeVersionRangeType
      Returns:
      true iff the lower bound is exclusive
    • upper

      public RuntimeVersion upper()
      Specified by:
      upper in interface RuntimeVersionRangeType
      Returns:
      The upper bound of the range
    • upperExclusive

      public boolean upperExclusive()
      Specified by:
      upperExclusive in interface RuntimeVersionRangeType
      Returns:
      true iff the upper bound is exclusive
    • withLower

      public final RuntimeVersionRange withLower​(RuntimeVersion value)
      Copy the current immutable object by setting a value for the lower attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for lower
      Returns:
      A modified copy of the this object
    • withLowerExclusive

      public final RuntimeVersionRange withLowerExclusive​(boolean value)
      Copy the current immutable object by setting a value for the lowerExclusive attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for lowerExclusive
      Returns:
      A modified copy of the this object
    • withUpper

      public final RuntimeVersionRange withUpper​(RuntimeVersion value)
      Copy the current immutable object by setting a value for the upper attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for upper
      Returns:
      A modified copy of the this object
    • withUpperExclusive

      public final RuntimeVersionRange withUpperExclusive​(boolean value)
      Copy the current immutable object by setting a value for the upperExclusive attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for upperExclusive
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals​(java.lang.Object another)
      This instance is equal to all instances of RuntimeVersionRange that have equal attribute values.
      Overrides:
      equals in class java.lang.Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: lower, lowerExclusive, upper, upperExclusive.
      Overrides:
      hashCode in class java.lang.Object
      Returns:
      hashCode value
    • toString

      public java.lang.String toString()
      Prints the immutable value RuntimeVersionRange with attribute values.
      Overrides:
      toString in class java.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 immutable RuntimeVersionRange instance.
      Parameters:
      lower - The value for the lower attribute
      lowerExclusive - The value for the lowerExclusive attribute
      upper - The value for the upper attribute
      upperExclusive - The value for the upperExclusive attribute
      Returns:
      An immutable RuntimeVersionRange instance
    • copyOf

      public static RuntimeVersionRange copyOf​(RuntimeVersionRangeType instance)
      Creates an immutable copy of a RuntimeVersionRangeType value. 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

      public static RuntimeVersionRange.Builder builder()
      Creates a builder for RuntimeVersionRange.
       RuntimeVersionRange.builder()
          .setLower(com.io7m.coffeepick.runtime.RuntimeVersion) // required lower
          .setLowerExclusive(boolean) // required lowerExclusive
          .setUpper(com.io7m.coffeepick.runtime.RuntimeVersion) // required upper
          .setUpperExclusive(boolean) // required upperExclusive
          .build();
       
      Returns:
      A new RuntimeVersionRange builder