Class RectangleSize


  • public class RectangleSize
    extends Object
    Represents a 2D size.
    • Constructor Detail

      • RectangleSize

        public RectangleSize​(int width,
                             int height)
        Creates a new RectangleSize instance.
        Parameters:
        width - The width of the rectangle.
        height - The height of the rectangle.
    • Method Detail

      • isEmpty

        public boolean isEmpty()
      • getWidth

        public int getWidth()
        Returns:
        The rectangle's width.
      • getHeight

        public int getHeight()
        Returns:
        The rectangle's height.
      • parse

        public static RectangleSize parse​(String size)
        Parses a string into a {link RectangleSize} instance.
        Parameters:
        size - A string representing width and height separated by "x".
        Returns:
        An instance representing the input size.
      • scale

        public RectangleSize scale​(double scaleRatio)
        Get a scaled version of the current size.
        Parameters:
        scaleRatio - The ratio by which to scale.
        Returns:
        A scaled version of the current size.
      • equals

        public boolean equals​(Object obj)
        Overrides:
        equals in class Object
        Parameters:
        obj - A RectangleSize instance to be checked for equality with the current instance.
        Returns:
        true if and only if the input objects are equal by value, false otherwise.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object