Class PAreaBD<S>

java.lang.Object
com.io7m.jregions.core.parameterized.areas.PAreaBD<S>
Type Parameters:
S - A phantom type parameter indicating the coordinate space of the area
All Implemented Interfaces:
PAreaBDType<S>, AreaValuesBDType, AreaSizeValuesBDType

public final class PAreaBD<S>
extends java.lang.Object
implements PAreaBDType<S>

An area with BigDecimal 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 axis.

  • Nested Class Summary

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

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

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface com.io7m.jregions.core.unparameterized.areas.AreaValuesBDType

    sizeX, sizeY

    Methods inherited from interface com.io7m.jregions.core.parameterized.areas.PAreaBDType

    checkPreconditions
  • Method Details

    • width

      @Deprecated public java.math.BigDecimal width()
      Deprecated.
      Specified by:
      width in interface AreaSizeValuesBDType
      Returns:
      The width of the area
    • height

      @Deprecated public java.math.BigDecimal height()
      Deprecated.
      Specified by:
      height in interface AreaSizeValuesBDType
      Returns:
      The height of the area
    • minimumX

      public java.math.BigDecimal minimumX()
      Specified by:
      minimumX in interface AreaValuesBDType
      Specified by:
      minimumX in interface PAreaBDType<S>
      Returns:
      The value of the minimumX attribute
    • maximumX

      public java.math.BigDecimal maximumX()
      Specified by:
      maximumX in interface AreaValuesBDType
      Specified by:
      maximumX in interface PAreaBDType<S>
      Returns:
      The value of the maximumX attribute
    • minimumY

      public java.math.BigDecimal minimumY()
      Specified by:
      minimumY in interface AreaValuesBDType
      Specified by:
      minimumY in interface PAreaBDType<S>
      Returns:
      The value of the minimumY attribute
    • maximumY

      public java.math.BigDecimal maximumY()
      Specified by:
      maximumY in interface AreaValuesBDType
      Specified by:
      maximumY in interface PAreaBDType<S>
      Returns:
      The value of the maximumY attribute
    • withMinimumX

      public final PAreaBD<S> withMinimumX​(java.math.BigDecimal value)
      Copy the current immutable object by setting a value for the minimumX attribute. An equals check 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 PAreaBD<S> withMaximumX​(java.math.BigDecimal value)
      Copy the current immutable object by setting a value for the maximumX attribute. An equals check 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 PAreaBD<S> withMinimumY​(java.math.BigDecimal value)
      Copy the current immutable object by setting a value for the minimumY attribute. An equals check 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 PAreaBD<S> withMaximumY​(java.math.BigDecimal value)
      Copy the current immutable object by setting a value for the maximumY attribute. An equals check 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
    • equals

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

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

      public static <S> PAreaBD<S> of​(java.math.BigDecimal minimumX, java.math.BigDecimal maximumX, java.math.BigDecimal minimumY, java.math.BigDecimal maximumY)
      Construct a new immutable PAreaBD 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
      Returns:
      An immutable PAreaBD instance
    • copyOf

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

      public static <S> PAreaBD.Builder<S> builder()
      Creates a builder for PAreaBD.
       PAreaBD.&lt;S&gt;builder()
          .setMinimumX(java.math.BigDecimal) // required minimumX
          .setMaximumX(java.math.BigDecimal) // required maximumX
          .setMinimumY(java.math.BigDecimal) // required minimumY
          .setMaximumY(java.math.BigDecimal) // required maximumY
          .build();
       
      Type Parameters:
      S - generic parameter S
      Returns:
      A new PAreaBD builder