public final class Circle extends Object implements Comparable<Circle>
Constructor and Description 

Circle()
Constructs a new circle with center point located at
(0., 0.)
and radius equal to 1 . 
Circle(Circle other)
Constructs a new circle with the same center point and radius as
other . 
Circle(IPoint2D c,
double r)
Constructs a new circle with center point located at
c and
radius equal to r . 
Modifier and Type  Method and Description 

int 
compareTo(Circle other)
Compares two circles by their radius.

boolean 
equals(Object obj)
Compares this circle to the specified object.

IPoint2D 
getCenter()
Returns the center point of the circle.

double 
getRadius()
Returns the radius of the circle.

String 
toString()
Returns the string containing the center point of the circle followed by a
comma and space, followed by the radius.

static Circle 
withDiameter(IPoint2D c,
double d)
Returns a new circle with center point located at
c and
diameter equal to d . 
public Circle()
(0., 0.)
and radius equal to 1
.public Circle(IPoint2D c, double r)
c
and
radius equal to r
.IllegalArgumentException
 if the radius is not greater
than zero.c
 the center point of the circler
 the radius of the circlepublic Circle(Circle other)
other
.other
 the circle to copypublic IPoint2D getCenter()
public double getRadius()
public int compareTo(Circle other)
0
if both circles have the same radius.compareTo
in interface Comparable<Circle>
Comparable.compareTo(java.lang.Object)
other
 the circle to be compared0
if both circles have the same radius; a
negative value if this circle has a smaller radius than the other
circle; and a positive value if this circle has a larger radius
than the other circlepublic boolean equals(Object obj)
true
if and only if the argument is not null
and
is a Circle
object with center point and radius equal to this
circle's center point and radius.equals
in class Object
Object.equals(java.lang.Object)
obj
 the object to compare against this circletrue
if the given object represents a
Circle
equivalent to this circle; false
otherwisepublic String toString()
System.out.println(new Circle(new IPoint2D(1.005, 22.1), 3.1415));
would print the string:
(1.005, 22.1), 3.1415
toString
in class Object
Object.toString()
public static Circle withDiameter(IPoint2D c, double d)
c
and
diameter equal to d
.IllegalArgumentException
 if the radius of the new
circle is not greater than zero.c
 the center of the circled
 the diameter of the circlec
and diameter
equal to d