Class DimensionComparator
java.lang.Object
dev.prozilla.pine.common.math.dimension.DimensionBase
dev.prozilla.pine.common.math.dimension.DimensionComparator
- All Implemented Interfaces:
Cloneable<DimensionBase>
,Printable
- Direct Known Subclasses:
Dimension.Add
,Dimension.If
,Dimension.Max
,Dimension.Min
,Dimension.Multiply
Abstract class for a function that compares two dimensions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DimensionBase
protected final DimensionBase
protected boolean
Fields inherited from class dev.prozilla.pine.common.math.dimension.DimensionBase
computedValue, DEFAULT_DIRTY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract int
compare
(int valueA, int valueB) Compares the values of both dimensions stored in this comparator.boolean
equals
(DimensionBase dimensionBase) Checks whether this dimension is equal to a given dimension.boolean
has
(DimensionBase dimension) boolean
isDirty
(RectTransform context, boolean isHorizontal) Checks whether this dimension has been modified since the last calculation.protected final int
recompute
(RectTransform context, boolean isHorizontal) Recalculates the value of this dimension when it has been marked as dirty.Methods inherited from class dev.prozilla.pine.common.math.dimension.DimensionBase
clone, compute, equals, getUnit, hashCode, toString
-
Field Details
-
dimensionA
-
dimensionB
-
isDirty
protected boolean isDirty
-
-
Constructor Details
-
DimensionComparator
-
-
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.
-
has
-
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.
-
compare
protected abstract int compare(int valueA, int valueB) Compares the values of both dimensions stored in this comparator.- Returns:
- The result of this comparator function.
-