Class UnmodifiableDimension

java.lang.Object
com.nomagic.ui.UnmodifiableDimension

@OpenApiAll public class UnmodifiableDimension extends Object
Unmodifiable dimension. Values can not be modified after creation.
  • Field Details

    • 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 Details

    • create

      public static UnmodifiableDimension create(int width, int height)
      Factory method to create an instance of UnmodifiableDimension.
      Parameters:
      width - width
      height - height
      Returns:
      instance
    • create

      public static UnmodifiableDimension create(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 - width
      height - height
      Returns:
      new dimension or self if width and height are not changed
    • set

      public UnmodifiableDimension set(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(Object obj)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Returns a string representation of this UnmodifiableDimension 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 class Object
      Returns:
      a string representation of this UnmodifiableDimension object.
    • toDimension

      public Dimension toDimension()
      Converts to @Dimension
      Returns: