java.lang.Object
com.io7m.jregions.core.parameterized.volumes.PVolumeI<S>
Type Parameters:
S - A phantom type parameter indicating the coordinate space of the volume
All Implemented Interfaces:
PVolumeIType<S>, VolumeSizeValuesIType, VolumeValuesIType

public final class PVolumeI<S>
extends java.lang.Object
implements PVolumeIType<S>

A volume with int coordinates.

The coordinates of the area are given in half-closed form. That is, minimumX() refers to the minimum inclusive value on the X axis, and maximumX() refers to the maximum exclusive value on the X axis. Likewise for the Y and Z axes.

  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  PVolumeI.Builder<S>
    Builds instances of type PVolumeI.
  • Method Summary

    Modifier and Type Method Description
    static <S> PVolumeI.Builder<S> builder()
    Creates a builder for PVolumeI.
    static <S> PVolumeI<S> copyOf​(PVolumeIType<S> instance)
    Creates an immutable copy of a PVolumeIType value.
    boolean equals​(java.lang.Object another)
    This instance is equal to all instances of PVolumeI that have equal attribute values.
    int hashCode()
    Computes a hash code from attributes: minimumX, maximumX, minimumY, maximumY, minimumZ, maximumZ.
    int maximumX()  
    int maximumY()  
    int maximumZ()  
    int minimumX()  
    int minimumY()  
    int minimumZ()  
    static <S> PVolumeI<S> of​(int minimumX, int maximumX, int minimumY, int maximumY, int minimumZ, int maximumZ)
    Construct a new immutable PVolumeI instance.
    java.lang.String toString()
    Prints the immutable value PVolumeI with attribute values.
    PVolumeI<S> withMaximumX​(int value)
    Copy the current immutable object by setting a value for the maximumX attribute.
    PVolumeI<S> withMaximumY​(int value)
    Copy the current immutable object by setting a value for the maximumY attribute.
    PVolumeI<S> withMaximumZ​(int value)
    Copy the current immutable object by setting a value for the maximumZ attribute.
    PVolumeI<S> withMinimumX​(int value)
    Copy the current immutable object by setting a value for the minimumX attribute.
    PVolumeI<S> withMinimumY​(int value)
    Copy the current immutable object by setting a value for the minimumY attribute.
    PVolumeI<S> withMinimumZ​(int value)
    Copy the current immutable object by setting a value for the minimumZ attribute.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.io7m.jregions.core.parameterized.volumes.PVolumeIType

    checkPreconditions

    Methods inherited from interface com.io7m.jregions.core.unparameterized.volumes.VolumeValuesIType

    sizeX, sizeY, sizeZ
  • Method Details

    • minimumX

      public int minimumX()
      Specified by:
      minimumX in interface PVolumeIType<S>
      Specified by:
      minimumX in interface VolumeValuesIType
      Returns:
      The value of the minimumX attribute
    • maximumX

      public int maximumX()
      Specified by:
      maximumX in interface PVolumeIType<S>
      Specified by:
      maximumX in interface VolumeValuesIType
      Returns:
      The value of the maximumX attribute
    • minimumY

      public int minimumY()
      Specified by:
      minimumY in interface PVolumeIType<S>
      Specified by:
      minimumY in interface VolumeValuesIType
      Returns:
      The value of the minimumY attribute
    • maximumY

      public int maximumY()
      Specified by:
      maximumY in interface PVolumeIType<S>
      Specified by:
      maximumY in interface VolumeValuesIType
      Returns:
      The value of the maximumY attribute
    • minimumZ

      public int minimumZ()
      Specified by:
      minimumZ in interface PVolumeIType<S>
      Specified by:
      minimumZ in interface VolumeValuesIType
      Returns:
      The value of the minimumZ attribute
    • maximumZ

      public int maximumZ()
      Specified by:
      maximumZ in interface PVolumeIType<S>
      Specified by:
      maximumZ in interface VolumeValuesIType
      Returns:
      The value of the maximumZ attribute
    • withMinimumX

      public final PVolumeI<S> withMinimumX​(int value)
      Copy the current immutable object by setting a value for the minimumX attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for minimumX
      Returns:
      A modified copy of the this object
    • withMaximumX

      public final PVolumeI<S> withMaximumX​(int value)
      Copy the current immutable object by setting a value for the maximumX attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for maximumX
      Returns:
      A modified copy of the this object
    • withMinimumY

      public final PVolumeI<S> withMinimumY​(int value)
      Copy the current immutable object by setting a value for the minimumY attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for minimumY
      Returns:
      A modified copy of the this object
    • withMaximumY

      public final PVolumeI<S> withMaximumY​(int value)
      Copy the current immutable object by setting a value for the maximumY attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for maximumY
      Returns:
      A modified copy of the this object
    • withMinimumZ

      public final PVolumeI<S> withMinimumZ​(int value)
      Copy the current immutable object by setting a value for the minimumZ attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for minimumZ
      Returns:
      A modified copy of the this object
    • withMaximumZ

      public final PVolumeI<S> withMaximumZ​(int value)
      Copy the current immutable object by setting a value for the maximumZ attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for maximumZ
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals​(java.lang.Object another)
      This instance is equal to all instances of PVolumeI 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: minimumX, maximumX, minimumY, maximumY, minimumZ, maximumZ.
      Overrides:
      hashCode in class java.lang.Object
      Returns:
      hashCode value
    • toString

      public java.lang.String toString()
      Prints the immutable value PVolumeI with attribute values.
      Overrides:
      toString in class java.lang.Object
      Returns:
      A string representation of the value
    • of

      public static <S> PVolumeI<S> of​(int minimumX, int maximumX, int minimumY, int maximumY, int minimumZ, int maximumZ)
      Construct a new immutable PVolumeI instance.
      Type Parameters:
      S - generic parameter S
      Parameters:
      minimumX - The value for the minimumX attribute
      maximumX - The value for the maximumX attribute
      minimumY - The value for the minimumY attribute
      maximumY - The value for the maximumY attribute
      minimumZ - The value for the minimumZ attribute
      maximumZ - The value for the maximumZ attribute
      Returns:
      An immutable PVolumeI instance
    • copyOf

      public static <S> PVolumeI<S> copyOf​(PVolumeIType<S> instance)
      Creates an immutable copy of a PVolumeIType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Type Parameters:
      S - generic parameter S
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable PVolumeI instance
    • builder

      public static <S> PVolumeI.Builder<S> builder()
      Creates a builder for PVolumeI.
       PVolumeI.&lt;S&gt;builder()
          .setMinimumX(int) // required minimumX
          .setMaximumX(int) // required maximumX
          .setMinimumY(int) // required minimumY
          .setMaximumY(int) // required maximumY
          .setMinimumZ(int) // required minimumZ
          .setMaximumZ(int) // required maximumZ
          .build();
       
      Type Parameters:
      S - generic parameter S
      Returns:
      A new PVolumeI builder