Class UnmodifiableDimension


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

      • 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 - width
        height - 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 - width
        height - 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 class java.lang.Object
      • hashCode

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

        public java.lang.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 java.lang.Object
        Returns:
        a string representation of this UnmodifiableDimension object.
      • toDimension

        public java.awt.Dimension toDimension()
        Converts to @Dimension
        Returns: