Class DimensionBase
java.lang.Object
dev.prozilla.pine.common.math.dimension.DimensionBase
- All Implemented Interfaces:
Cloneable<DimensionBase>
,Printable
- Direct Known Subclasses:
Dimension
,Dimension.Clamp
,DimensionComparator
Base class for dimensions of UI elements.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract DimensionBase
clone()
Returns a clone of this dimension.final int
compute
(RectTransform context, boolean isHorizontal) Calculates the value of this dimension in the context of a given UI element.abstract boolean
equals
(DimensionBase dimensionBase) Checks whether this dimension is equal to a given dimension.boolean
getUnit()
int
hashCode()
boolean
isDirty
(RectTransform context, boolean isHorizontal) Checks whether this dimension has been modified since the last calculation.protected abstract int
recompute
(RectTransform context, boolean isHorizontal) Recalculates the value of this dimension when it has been marked as dirty.abstract String
toString()
Returns the string representation of this dimension.
-
Field Details
-
computedValue
protected int computedValue -
DEFAULT_DIRTY
public static final boolean DEFAULT_DIRTY- See Also:
-
-
Constructor Details
-
DimensionBase
public DimensionBase()
-
-
Method Details
-
compute
Calculates the value of this dimension in the context of a given UI element.- Parameters:
context
- UI element, serving as the context of this dimension.- Returns:
- The computed value of this dimension in pixels.
-
recompute
Recalculates the value of this dimension when it has been marked as dirty.- Parameters:
context
- UI element, serving as the context of this dimension.- Returns:
- The computed value of this dimension in pixels.
-
isDirty
Checks whether this dimension has been modified since the last calculation.- Returns:
- True if this dimension has been modified.
-
getUnit
-
clone
Returns a clone of this dimension.- Specified by:
clone
in interfaceCloneable<DimensionBase>
- Overrides:
clone
in classObject
- Returns:
- New dimension instance
-
equals
-
equals
Checks whether this dimension is equal to a given dimension.- Specified by:
equals
in interfaceCloneable<DimensionBase>
- Parameters:
dimensionBase
- Other dimension- Returns:
true
if both objects are equal.
-
hashCode
public int hashCode() -
toString
Returns the string representation of this dimension.
-