Class Circle

  • All Implemented Interfaces:
    Shape

    @API(type=EXTENDABLE,
         src=PRIVATE)
    public class Circle
    extends BaseShape
    The class describes a circle
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int radius
      The overall width of this ellipse.
      int x
      The x coordinate of the upper left corner of this ellipse.
      int y
      The y coordinate of the upper left corner of thise llipse.
    • Constructor Summary

      Constructors 
      Constructor Description
      Circle​(int x, int y, int radius)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(int x, int y)
      Check if the specified coordinates are inside the shape.
      Rectangle getBounds()  
      java.lang.String toString()  
      Shape translate​(int tx, int ty)
      Translate the shape into another one.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • x

        public final int x
        The x coordinate of the upper left corner of this ellipse.
      • y

        public final int y
        The y coordinate of the upper left corner of thise llipse.
      • radius

        public final int radius
        The overall width of this ellipse.
    • Constructor Detail

      • Circle

        public Circle​(int x,
                      int y,
                      int radius)
        Constructor.
        Parameters:
        x - The center x pos.
        y - The center y pos.
        radius - The radius of the circle.
    • Method Detail

      • translate

        public Shape translate​(int tx,
                               int ty)
        Description copied from interface: Shape
        Translate the shape into another one.
        Parameters:
        tx - the distance by which coordinates are translated in the X axis direction
        ty - the distance by which coordinates are translated in the Y axis direction
        Returns:
        The newly translated shape
        See Also:
        Shape.translate(int, int)
      • contains

        public boolean contains​(int x,
                                int y)
        Description copied from interface: Shape
        Check if the specified coordinates are inside the shape.
        Parameters:
        x - The horizontal coordinate.
        y - The vertical coordinate.
        Returns:
        true if the point is inside the shape. false otherwise.
        See Also:
        Shape.contains(int, int)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()