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
FieldsModifier and TypeFieldDescriptionprotected floatstatic final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract DimensionBaseclone()Returns a clone of this dimension.final floatCalculates the value of this dimension in the context of a given UI element.abstract booleanequals(DimensionBase dimensionBase) Checks whether this dimension is equal to a given dimension.booleangetUnit()inthashCode()booleanChecks whether this dimension has been modified since the last calculation.protected abstract floatRecalculates the value of this dimension when it has been marked as dirty.abstract @NotNull StringtoString()Returns the string representation of this dimension.
-
Field Details
-
computedValue
protected float 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:
node- 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:
node- 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:
clonein interfaceCloneable<DimensionBase>- Overrides:
clonein classObject- Returns:
- New dimension instance
-
equals
-
equals
Checks whether this dimension is equal to a given dimension.- Specified by:
equalsin interfaceCloneable<DimensionBase>- Parameters:
dimensionBase- Other dimension- Returns:
trueif both objects are equal.
-
hashCode
public int hashCode() -
toString
Returns the string representation of this dimension.
-