Algorithm
Development Kit 1.0

algs.model.twod
Class TwoDCircle

java.lang.Object
  extended by algs.model.twod.TwoDCircle
All Implemented Interfaces:
ICircle

public class TwoDCircle
extends java.lang.Object
implements ICircle

A circle is defined by a center point and a radius.

Since:
1.0
Version:
1.0, 6/15/08
Author:
George Heineman

Constructor Summary
TwoDCircle(double x, double y, double radius)
          Construct a Circle.
TwoDCircle(TwoDPoint origin, double radius)
          Construct a Circle.
 
Method Summary
 IRectangle boundingRectangle()
          return bounding rectangle for this circle.
 boolean equals(java.lang.Object o)
          Must properly compute equals(Object) to compare based origin and radius
 IPoint getOrigin()
          Return origin as an IPoint.
 double getRadius()
          return the radius of the circle.
 double getX()
          Return the x-coordinate value of the circle origin.
 double getY()
          Return the y-coordinate value of the circle origin.
 int hashCode()
          Hashcode.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TwoDCircle

public TwoDCircle(TwoDPoint origin,
                  double radius)
Construct a Circle.

Parameters:
origin -
radius -

TwoDCircle

public TwoDCircle(double x,
                  double y,
                  double radius)
Construct a Circle.

Parameters:
x - x-coordinate of origin
y - y-coordinate of origin
radius - radius of circle
Method Detail

equals

public boolean equals(java.lang.Object o)
Description copied from interface: ICircle
Must properly compute equals(Object) to compare based origin and radius

Specified by:
equals in interface ICircle
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Hashcode.

Overrides:
hashCode in class java.lang.Object

getOrigin

public IPoint getOrigin()
Description copied from interface: ICircle
Return origin as an IPoint.

Specified by:
getOrigin in interface ICircle

getRadius

public double getRadius()
Description copied from interface: ICircle
return the radius of the circle.

Specified by:
getRadius in interface ICircle

getX

public double getX()
Description copied from interface: ICircle
Return the x-coordinate value of the circle origin.

Specified by:
getX in interface ICircle

getY

public double getY()
Description copied from interface: ICircle
Return the y-coordinate value of the circle origin.

Specified by:
getY in interface ICircle

boundingRectangle

public IRectangle boundingRectangle()
Description copied from interface: ICircle
return bounding rectangle for this circle.

Specified by:
boundingRectangle in interface ICircle

toString

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

Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.