Class DualDimension
java.lang.Object
dev.prozilla.pine.common.math.dimension.DualDimension
- All Implemented Interfaces:
Cloneable<DualDimension>,Printable
- Direct Known Subclasses:
QuadDimension
Represents a pair of dimensions (X and Y) for a UI element. Each dimension is defined using a
DimensionBase.- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a default pair of dimensions with all values set to 0 pixels.DualDimension(int xy) Creates a pair of dimensions with two equal values, in pixels.DualDimension(int x, int y) Creates a pair of dimensions.Creates a pair of dimensions with two equal values.Creates a pair of dimensionsDualDimension(String xy) Creates a pair of dimensions with two equal values based on a string.DualDimension(String x, String y) Creates a pair of dimensions based on two strings. -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a new object that is equal to this object.floatComputes the X-dimension for a given element.floatComputes the Y-dimension for a given element.booleanequals(DualDimension dualDimension) Checks if the given object is equal to this object.booleanstatic DualDimensionCreates a pair of dimensions based on the viewport width and height.inthashCode()booleanChecks whether this pair of dimensions computes to0for a given element.static DualDimensionstatic DualDimensionstatic DualDimensionstatic DualDimensionDeprecated.voidreset()voidset(int xy) voidset(int x, int y) voidset(DimensionBase xy) voidset(DimensionBase x, DimensionBase y) voidvoid@NotNull StringtoString()Returns a string representation of this object.static DualDimensionzero()Creates a pair of dimensions with all values set to0.
-
Field Details
-
x
-
y
-
DEFAULT_VALUE
public static final int DEFAULT_VALUE- See Also:
-
-
Constructor Details
-
DualDimension
public DualDimension()Creates a default pair of dimensions with all values set to 0 pixels. -
DualDimension
Creates a pair of dimensions with two equal values based on a string. -
DualDimension
public DualDimension(int xy) Creates a pair of dimensions with two equal values, in pixels. -
DualDimension
Creates a pair of dimensions with two equal values. -
DualDimension
Creates a pair of dimensions based on two strings. -
DualDimension
public DualDimension(int x, int y) Creates a pair of dimensions.- Parameters:
x- Value of x dimension, in pixelsy- Value of y dimension, in pixels
-
DualDimension
Creates a pair of dimensions
-
-
Method Details
-
reset
public void reset() -
set
-
set
public void set(int xy) -
set
-
set
-
set
public void set(int x, int y) -
set
-
compute
-
computeX
Computes the X-dimension for a given element. -
computeY
Computes the Y-dimension for a given element. -
isZero
Checks whether this pair of dimensions computes to0for a given element. -
clone
Description copied from interface:CloneableReturns a new object that is equal to this object.- Specified by:
clonein interfaceCloneable<DualDimension>- Overrides:
clonein classObject- Returns:
- Clone of this object
-
equals
-
equals
Description copied from interface:CloneableChecks if the given object is equal to this object.- Specified by:
equalsin interfaceCloneable<DualDimension>- Parameters:
dualDimension- Other object- Returns:
trueif both objects are equal.
-
hashCode
public int hashCode() -
parse
Deprecated.Replaced byDualDimensionParseras of 1.2.0 -
zero
Creates a pair of dimensions with all values set to0. -
fullscreen
Creates a pair of dimensions based on the viewport width and height. -
parentSize
-
parentWidth
-
parentHeight
-
toString
Description copied from interface:PrintableReturns a string representation of this object.
-
DualDimensionParseras of 1.2.0