Class PAreaSizeI<S>

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

public final class PAreaSizeI<S> extends Object implements PAreaSizeIType<S>
The size of an area with int coordinates.
  • Method Details

    • width

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

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

      public int sizeX()
      Specified by:
      sizeX in interface AreaSizeValuesIType
      Specified by:
      sizeX in interface PAreaSizeIType<S>
      Returns:
      The value of the sizeX attribute
    • sizeY

      public int sizeY()
      Specified by:
      sizeY in interface AreaSizeValuesIType
      Specified by:
      sizeY in interface PAreaSizeIType<S>
      Returns:
      The value of the sizeY attribute
    • withSizeX

      public final PAreaSizeI<S> withSizeX(int value)
      Copy the current immutable object by setting a value for the sizeX attribute. A value equality check is 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 PAreaSizeI<S> withSizeY(int value)
      Copy the current immutable object by setting a value for the sizeY attribute. A value equality check is 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(Object another)
      This instance is equal to all instances of PAreaSizeI that have equal attribute values.
      Overrides:
      equals in class 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 Object
      Returns:
      hashCode value
    • toString

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

      public static <S> PAreaSizeI<S> of(int sizeX, int sizeY)
      Construct a new immutable PAreaSizeI 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 PAreaSizeI instance
    • copyOf

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

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