Package com.nomagic.ui
Class UnmodifiableDimension
- java.lang.Object
-
- com.nomagic.ui.UnmodifiableDimension
-
@OpenApiAll public class UnmodifiableDimension extends java.lang.ObjectUnmodifiable dimension. Values can not be modified after creation.
-
-
Field Summary
Fields Modifier and Type Field Description private static UnmodifiableDimension[][]CACHEprivate static intCACHE_SIZEstatic UnmodifiableDimensionEMPTYEmpty dimension holder.intheightDimension's heightintwidthDimension's width
-
Constructor Summary
Constructors Modifier Constructor Description privateUnmodifiableDimension(int width, int height)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static UnmodifiableDimensioncreate(int width, int height)Factory method to create an instance of UnmodifiableDimension.static UnmodifiableDimensioncreate(java.awt.Dimension dimension)Creates dimension from given @Dimensionbooleanequals(java.lang.Object obj)intgetHeight()Returns heightintgetWidth()Returns widthinthashCode()UnmodifiableDimensionset(int width, int height)Applies given width and height to selfUnmodifiableDimensionset(java.awt.Dimension dimension)Applies given dimension to selfUnmodifiableDimensionsetHeight(int height)Applies given height to selfUnmodifiableDimensionsetWidth(int width)Applies given width to selfjava.awt.DimensiontoDimension()Converts to @Dimensionjava.lang.StringtoString()Returns a string representation of thisUnmodifiableDimensionobject.
-
-
-
Field Detail
-
CACHE_SIZE
private static final int CACHE_SIZE
- See Also:
- Constant Field Values
-
CACHE
private static final UnmodifiableDimension[][] CACHE
-
EMPTY
public static final UnmodifiableDimension EMPTY
Empty dimension holder.
-
width
public final int width
Dimension's width
-
height
public final int height
Dimension's height
-
-
Method Detail
-
create
public static UnmodifiableDimension create(int width, int height)
Factory method to create an instance of UnmodifiableDimension.- Parameters:
width- widthheight- height- Returns:
- instance
-
create
public static UnmodifiableDimension create(java.awt.Dimension dimension)
Creates dimension from given @Dimension- Parameters:
dimension- dimension- Returns:
- created dimension
-
set
public UnmodifiableDimension set(int width, int height)
Applies given width and height to self- Parameters:
width- widthheight- height- Returns:
- new dimension or self if width and height are not changed
-
set
public UnmodifiableDimension set(java.awt.Dimension dimension)
Applies given dimension to self- Parameters:
dimension- dimension- Returns:
- new dimension or self if width and height are not changed
-
setWidth
public UnmodifiableDimension setWidth(int width)
Applies given width to self- Parameters:
width- width- Returns:
- new dimension or self if width is not changed
-
setHeight
public UnmodifiableDimension setHeight(int height)
Applies given height to self- Parameters:
height- height- Returns:
- new dimension or self if height is not changed
-
getWidth
public int getWidth()
Returns width- Returns:
- width
-
getHeight
public int getHeight()
Returns height- Returns:
- height
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
Returns a string representation of thisUnmodifiableDimensionobject. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of this
UnmodifiableDimensionobject.
-
toDimension
public java.awt.Dimension toDimension()
Converts to @Dimension- Returns:
-
-