Record Class SyConstraints

java.lang.Object
java.lang.Record
com.io7m.jsycamore.api.components.SyConstraints
Record Components:
sizeMinimumX - The minimum allowed size on the X axis
sizeMinimumY - The minimum allowed size on the Y axis
sizeMaximumX - The maximum allowed size on the X axis
sizeMaximumY - The maximum allowed size on the Y axis

public record SyConstraints(int sizeMinimumX, int sizeMinimumY, int sizeMaximumX, int sizeMaximumY) extends Record
A set of size constraints.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SyConstraints(int sizeMinimumX, int sizeMinimumY, int sizeMaximumX, int sizeMaximumY)
    A set of size constraints.
  • Method Summary

    Modifier and Type
    Method
    Description
    deriveLimitedBy(com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<?> size)
    Derive a new set of constraints that obey the current constraints whilst attempting to constrain to the given size.
    Derive a new set of constraints where the new maximum height has the given size subtracted from it.
    deriveSubtractMaximumSizes(int sizeX, int sizeY)
    Derive a new set of constraints where the new maximum width and height values have the given sizes subtracted from them.
    Derive a new set of constraints where the new maximum width has the given size subtracted from it.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    isSatisfiedBy(com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<?> size)
     
    <T extends SySpaceType>
    com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<T>
     
    int
    Returns the value of the sizeMaximumX record component.
    int
    Returns the value of the sizeMaximumY record component.
    <T extends SySpaceType>
    com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<T>
     
    int
    Returns the value of the sizeMinimumX record component.
    int
    Returns the value of the sizeMinimumY record component.
    <T extends SySpaceType>
    com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<T>
    sizeNotExceeding(int sizeX, int sizeY)
    Produce an area size based on the given size values, clamped such that they will fit within these constraints, ignoring the minimum constraint but obeying the maximum constraint.
    <T extends SySpaceType>
    com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<T>
    sizeWithin(int sizeX, int sizeY)
    Produce an area size based on the given size values, clamped such that they will fit within these constraints.
    final String
    Returns a string representation of this record class.
     
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SyConstraints

      public SyConstraints(int sizeMinimumX, int sizeMinimumY, int sizeMaximumX, int sizeMaximumY)
      A set of size constraints.
      Parameters:
      sizeMinimumX - The minimum allowed size on the X axis
      sizeMinimumY - The minimum allowed size on the Y axis
      sizeMaximumX - The maximum allowed size on the X axis
      sizeMaximumY - The maximum allowed size on the Y axis
  • Method Details

    • zero

      public static SyConstraints zero()
      Returns:
      Constraints that force a zero size
    • sizeMinimum

      public <T extends SySpaceType> com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<T> sizeMinimum()
      Type Parameters:
      T - The coordinate space type
      Returns:
      The minimum area size that can fit in these constraints
    • sizeMaximum

      public <T extends SySpaceType> com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<T> sizeMaximum()
      Type Parameters:
      T - The coordinate space type
      Returns:
      The maximum area size that can fit in these constraints
    • sizeWithin

      public <T extends SySpaceType> com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<T> sizeWithin(int sizeX, int sizeY)
      Produce an area size based on the given size values, clamped such that they will fit within these constraints.
      Type Parameters:
      T - The coordinate space type
      Parameters:
      sizeX - The size on the X axis
      sizeY - The size on the Y axis
      Returns:
      A clamped area size
    • sizeNotExceeding

      public <T extends SySpaceType> com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<T> sizeNotExceeding(int sizeX, int sizeY)
      Produce an area size based on the given size values, clamped such that they will fit within these constraints, ignoring the minimum constraint but obeying the maximum constraint.
      Type Parameters:
      T - The coordinate space type
      Parameters:
      sizeX - The size on the X axis
      sizeY - The size on the Y axis
      Returns:
      A clamped area size
    • isSatisfiedBy

      public boolean isSatisfiedBy(com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<?> size)
      Parameters:
      size - The area size
      Returns:
      true if the given size fits within these constraints
    • withoutMinimum

      public SyConstraints withoutMinimum()
      Returns:
      These constraints without the minimum sizes
    • deriveLimitedBy

      public SyConstraints deriveLimitedBy(com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<?> size)
      Derive a new set of constraints that obey the current constraints whilst attempting to constrain to the given size.
      Parameters:
      size - The size
      Returns:
      A new set of constraints
    • deriveSubtractMaximumWidth

      public SyConstraints deriveSubtractMaximumWidth(int size)
      Derive a new set of constraints where the new maximum width has the given size subtracted from it.
      Parameters:
      size - The size to subtract
      Returns:
      A new set of constraints
    • deriveSubtractMaximumHeight

      public SyConstraints deriveSubtractMaximumHeight(int size)
      Derive a new set of constraints where the new maximum height has the given size subtracted from it.
      Parameters:
      size - The size to subtract
      Returns:
      A new set of constraints
    • deriveSubtractMaximumSizes

      public SyConstraints deriveSubtractMaximumSizes(int sizeX, int sizeY)
      Derive a new set of constraints where the new maximum width and height values have the given sizes subtracted from them.
      Parameters:
      sizeX - The X size to subtract
      sizeY - The Y size to subtract
      Returns:
      A new set of constraints
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • sizeMinimumX

      public int sizeMinimumX()
      Returns the value of the sizeMinimumX record component.
      Returns:
      the value of the sizeMinimumX record component
    • sizeMinimumY

      public int sizeMinimumY()
      Returns the value of the sizeMinimumY record component.
      Returns:
      the value of the sizeMinimumY record component
    • sizeMaximumX

      public int sizeMaximumX()
      Returns the value of the sizeMaximumX record component.
      Returns:
      the value of the sizeMaximumX record component
    • sizeMaximumY

      public int sizeMaximumY()
      Returns the value of the sizeMaximumY record component.
      Returns:
      the value of the sizeMaximumY record component