Class Dimension.Clamp
java.lang.Object
dev.prozilla.pine.common.math.dimension.DimensionBase
dev.prozilla.pine.common.math.dimension.Dimension.Clamp
- All Implemented Interfaces:
Cloneable<DimensionBase>
,Printable
- Enclosing class:
Dimension
-
Field Summary
Fields inherited from class dev.prozilla.pine.common.math.dimension.DimensionBase
computedValue, DEFAULT_DIRTY
-
Constructor Summary
ConstructorsConstructorDescriptionClamp
(DimensionBase dimension, DimensionBase dimensionMin, DimensionBase dimensionMax) Creates a function that returns the value of a dimension, clamped between the values of two dimensions. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a clone of this dimension.boolean
equals
(DimensionBase dimensionBase) Checks whether this dimension is equal to a given dimension.boolean
equals
(DimensionBase dimension, DimensionBase dimensionMin, DimensionBase dimensionMax) boolean
isDirty
(RectTransform context, boolean isHorizontal) Checks whether this dimension has been modified since the last calculation.protected int
recompute
(RectTransform context, boolean isHorizontal) Recalculates the value of this dimension when it has been marked as dirty.toString()
Returns the string representation of this dimension.Methods inherited from class dev.prozilla.pine.common.math.dimension.DimensionBase
compute, equals, getUnit, hashCode
-
Constructor Details
-
Clamp
Creates a function that returns the value of a dimension, clamped between the values of two dimensions.
-
-
Method Details
-
isDirty
Description copied from class:DimensionBase
Checks whether this dimension has been modified since the last calculation.- Overrides:
isDirty
in classDimensionBase
- Returns:
- True if this dimension has been modified.
-
recompute
Description copied from class:DimensionBase
Recalculates the value of this dimension when it has been marked as dirty.- Specified by:
recompute
in classDimensionBase
- Parameters:
context
- UI element, serving as the context of this dimension.- Returns:
- The computed value of this dimension in pixels.
-
clone
Description copied from class:DimensionBase
Returns a clone of this dimension.- Specified by:
clone
in interfaceCloneable<DimensionBase>
- Specified by:
clone
in classDimensionBase
- Returns:
- New dimension instance
-
equals
Description copied from class:DimensionBase
Checks whether this dimension is equal to a given dimension.- Specified by:
equals
in interfaceCloneable<DimensionBase>
- Specified by:
equals
in classDimensionBase
- Parameters:
dimensionBase
- Other dimension- Returns:
true
if both objects are equal.
-
equals
public boolean equals(DimensionBase dimension, DimensionBase dimensionMin, DimensionBase dimensionMax) -
toString
Description copied from class:DimensionBase
Returns the string representation of this dimension.- Specified by:
toString
in interfacePrintable
- Specified by:
toString
in classDimensionBase
- Returns:
- String representation of this object.
-