Class RectangleImpl

java.lang.Object
org.refcodes.graphical.RectangleImpl
All Implemented Interfaces:
Dimension, HeightAccessor, Position, PosXAccessor, PosYAccessor, Rectangle, WidthAccessor

public class RectangleImpl extends Object implements Rectangle
The class RectangleImpl implements the Rectangle interface.
  • Constructor Details

    • RectangleImpl

      public RectangleImpl(int aPositionX, int aPositionY, int aWidth, int aHeight)
      Constructs a Rectangle with the given metrics.
      Parameters:
      aPositionX - The X position of the rectangle.
      aPositionY - The Y position of the rectangle.
      aWidth - The width of the rectangle.
      aHeight - The height of the rectangle.
    • RectangleImpl

      public RectangleImpl(Position aPosition, Dimension aDimension)
      Constructs a Rectangle with the given metrics.
      Parameters:
      aPosition - The position of the rectangle.
      aDimension - The dimension of the rectangle.
  • Method Details

    • getWidth

      public int getWidth()
      Retrieves the width from the width property.
      Specified by:
      getWidth in interface WidthAccessor
      Returns:
      The width stored by the width property.
    • getHeight

      public int getHeight()
      Retrieves the height from the height property.
      Specified by:
      getHeight in interface HeightAccessor
      Returns:
      The height stored by the height property.
    • getPositionX

      public int getPositionX()
      Retrieves the X position from the X position property.
      Specified by:
      getPositionX in interface PosXAccessor
      Returns:
      The X position stored by the X position property.
    • getPositionY

      public int getPositionY()
      Retrieves the Y position from the Y position property.
      Specified by:
      getPositionY in interface PosYAccessor
      Returns:
      The Y position stored by the Y position property.
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object