Package com.nomagic.ui
Class UnmodifiableDimension
- java.lang.Object
-
- com.nomagic.ui.UnmodifiableDimension
-
@OpenApiAll public class UnmodifiableDimension extends java.lang.Object
Unmodifiable dimension. Values can not be modified after creation.
-
-
Field Summary
Fields Modifier and Type Field Description private static UnmodifiableDimension[][]
CACHE
private static int
CACHE_SIZE
static UnmodifiableDimension
EMPTY
Empty dimension holder.int
height
Dimension's heightint
width
Dimension's width
-
Constructor Summary
Constructors Modifier Constructor Description private
UnmodifiableDimension(int width, int height)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static UnmodifiableDimension
create(int width, int height)
Factory method to create an instance of UnmodifiableDimension.static UnmodifiableDimension
create(java.awt.Dimension dimension)
Creates dimension from given @Dimension
boolean
equals(java.lang.Object obj)
int
getHeight()
Returns heightint
getWidth()
Returns widthint
hashCode()
UnmodifiableDimension
set(int width, int height)
Applies given width and height to selfUnmodifiableDimension
set(java.awt.Dimension dimension)
Applies given dimension to selfUnmodifiableDimension
setHeight(int height)
Applies given height to selfUnmodifiableDimension
setWidth(int width)
Applies given width to selfjava.awt.Dimension
toDimension()
Converts to @Dimension
java.lang.String
toString()
Returns a string representation of thisUnmodifiableDimension
object.
-
-
-
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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
Returns a string representation of thisUnmodifiableDimension
object. 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:
toString
in classjava.lang.Object
- Returns:
- a string representation of this
UnmodifiableDimension
object.
-
toDimension
public java.awt.Dimension toDimension()
Converts to @Dimension
- Returns:
-
-