Class PAreaSizeD<S>

java.lang.Object
com.io7m.jregions.core.parameterized.sizes.PAreaSizeD<S>
Type Parameters:
S - A phantom type parameter indicating the coordinate space of the area
All Implemented Interfaces:
PAreaSizeDType<S>, AreaSizeValuesDType

public final class PAreaSizeD<S>
extends java.lang.Object
implements PAreaSizeDType<S>
The size of an area with double coordinates.
  • Nested Class Summary

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

    Modifier and Type Method Description
    static <S> PAreaSizeD.Builder<S> builder()
    Creates a builder for PAreaSizeD.
    static <S> PAreaSizeD<S> copyOf​(PAreaSizeDType<S> instance)
    Creates an immutable copy of a PAreaSizeDType value.
    boolean equals​(java.lang.Object another)
    This instance is equal to all instances of PAreaSizeD that have equal attribute values.
    int hashCode()
    Computes a hash code from attributes: sizeX, sizeY.
    double height()
    Deprecated.
    static <S> PAreaSizeD<S> of​(double sizeX, double sizeY)
    Construct a new immutable PAreaSizeD instance.
    double sizeX()  
    double sizeY()  
    java.lang.String toString()
    Prints the immutable value PAreaSizeD with attribute values.
    double width()
    Deprecated.
    PAreaSizeD<S> withSizeX​(double value)
    Copy the current immutable object by setting a value for the sizeX attribute.
    PAreaSizeD<S> withSizeY​(double value)
    Copy the current immutable object by setting a value for the sizeY 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.sizes.PAreaSizeDType

    checkPreconditions
  • Method Details

    • width

      @Deprecated public double width()
      Deprecated.
      Specified by:
      width in interface AreaSizeValuesDType
      Returns:
      The width of the area
    • height

      @Deprecated public double height()
      Deprecated.
      Specified by:
      height in interface AreaSizeValuesDType
      Returns:
      The height of the area
    • sizeX

      public double sizeX()
      Specified by:
      sizeX in interface AreaSizeValuesDType
      Specified by:
      sizeX in interface PAreaSizeDType<S>
      Returns:
      The value of the sizeX attribute
    • sizeY

      public double sizeY()
      Specified by:
      sizeY in interface AreaSizeValuesDType
      Specified by:
      sizeY in interface PAreaSizeDType<S>
      Returns:
      The value of the sizeY attribute
    • withSizeX

      public final PAreaSizeD<S> withSizeX​(double value)
      Copy the current immutable object by setting a value for the sizeX attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for sizeX
      Returns:
      A modified copy of the this object
    • withSizeY

      public final PAreaSizeD<S> withSizeY​(double value)
      Copy the current immutable object by setting a value for the sizeY attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for sizeY
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals​(java.lang.Object another)
      This instance is equal to all instances of PAreaSizeD 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: sizeX, sizeY.
      Overrides:
      hashCode in class java.lang.Object
      Returns:
      hashCode value
    • toString

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

      public static <S> PAreaSizeD<S> of​(double sizeX, double sizeY)
      Construct a new immutable PAreaSizeD instance.
      Type Parameters:
      S - generic parameter S
      Parameters:
      sizeX - The value for the sizeX attribute
      sizeY - The value for the sizeY attribute
      Returns:
      An immutable PAreaSizeD instance
    • copyOf

      public static <S> PAreaSizeD<S> copyOf​(PAreaSizeDType<S> instance)
      Creates an immutable copy of a PAreaSizeDType 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 PAreaSizeD instance
    • builder

      public static <S> PAreaSizeD.Builder<S> builder()
      Creates a builder for PAreaSizeD.
       PAreaSizeD.&lt;S&gt;builder()
          .setSizeX(double) // required sizeX
          .setSizeY(double) // required sizeY
          .build();
       
      Type Parameters:
      S - generic parameter S
      Returns:
      A new PAreaSizeD builder