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

public abstract class DimensionBase extends Object implements Printable, Cloneable<DimensionBase>
Base class for dimensions of UI elements.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    static final boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract DimensionBase
    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
    equals(Object object)
     
     
    int
     
    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
    Returns the string representation of this dimension.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface dev.prozilla.pine.common.Printable

    print, print
  • Field Details

    • computedValue

      protected int computedValue
    • DEFAULT_DIRTY

      public static final boolean DEFAULT_DIRTY
      See Also:
  • Constructor Details

    • DimensionBase

      public DimensionBase()
  • Method Details

    • compute

      public final int compute(RectTransform context, boolean isHorizontal)
      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

      protected abstract int recompute(RectTransform context, boolean isHorizontal)
      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

      public boolean isDirty(RectTransform context, boolean isHorizontal)
      Checks whether this dimension has been modified since the last calculation.
      Returns:
      True if this dimension has been modified.
    • getUnit

      public Unit getUnit()
    • clone

      public abstract DimensionBase clone()
      Returns a clone of this dimension.
      Specified by:
      clone in interface Cloneable<DimensionBase>
      Overrides:
      clone in class Object
      Returns:
      New dimension instance
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • equals

      public abstract boolean equals(DimensionBase dimensionBase)
      Checks whether this dimension is equal to a given dimension.
      Specified by:
      equals in interface Cloneable<DimensionBase>
      Parameters:
      dimensionBase - Other dimension
      Returns:
      true if both objects are equal.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public abstract String toString()
      Returns the string representation of this dimension.
      Specified by:
      toString in interface Printable
      Overrides:
      toString in class Object
      Returns:
      String representation of this object.