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 axissizeMinimumY- The minimum allowed size on the Y axissizeMaximumX- The maximum allowed size on the X axissizeMaximumY- 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
ConstructorsConstructorDescriptionSyConstraints(int sizeMinimumX, int sizeMinimumY, int sizeMaximumX, int sizeMaximumY) A set of size constraints. -
Method Summary
Modifier and TypeMethodDescriptionderiveLimitedBy(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.deriveSubtractMaximumHeight(int 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.deriveSubtractMaximumWidth(int size) Derive a new set of constraints where the new maximum width has the given size subtracted from it.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisSatisfiedBy(com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<?> size) <T extends SySpaceType>
com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<T> intReturns the value of thesizeMaximumXrecord component.intReturns the value of thesizeMaximumYrecord component.<T extends SySpaceType>
com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<T> intReturns the value of thesizeMinimumXrecord component.intReturns the value of thesizeMinimumYrecord 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 StringtoString()Returns a string representation of this record class.static SyConstraintszero()
-
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 axissizeMinimumY- The minimum allowed size on the Y axissizeMaximumX- The maximum allowed size on the X axissizeMaximumY- The maximum allowed size on the Y axis
-
-
Method Details
-
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 axissizeY- 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 axissizeY- 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:
trueif the given size fits within these constraints
-
withoutMinimum
- Returns:
- These constraints without the minimum sizes
-
deriveLimitedBy
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
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
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
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 subtractsizeY- The Y size to subtract- Returns:
- A new set of constraints
-
toString
-
hashCode
-
equals
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 thecomparemethod from their corresponding wrapper classes. -
sizeMinimumX
public int sizeMinimumX()Returns the value of thesizeMinimumXrecord component.- Returns:
- the value of the
sizeMinimumXrecord component
-
sizeMinimumY
public int sizeMinimumY()Returns the value of thesizeMinimumYrecord component.- Returns:
- the value of the
sizeMinimumYrecord component
-
sizeMaximumX
public int sizeMaximumX()Returns the value of thesizeMaximumXrecord component.- Returns:
- the value of the
sizeMaximumXrecord component
-
sizeMaximumY
public int sizeMaximumY()Returns the value of thesizeMaximumYrecord component.- Returns:
- the value of the
sizeMaximumYrecord component
-