element
Class Circle

java.lang.Object
  |
  +--element.Rect
        |
        +--element.Oval
              |
              +--element.Circle

public class Circle
extends Oval

Copyright (c) 1997 McGraw-Hill All Rights Reserved.

Permission to use, copy, modify, and distribute this software and its documentation for NON-COMMERCIAL purposes and without fee is hereby granted provided that this copyright notice appears in all copies. Please refer to the file "copyright.html" for further important copyright and licensing information.

MCGRAW-HILL MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. MCGRAW-HILL SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.


Fields inherited from class element.Rect
height, left, top, width
 
Constructor Summary
Circle()
          post: constructs a trivial circle at origin
Circle(Drawable d)
          post: constructs a Circle from a drawable
Circle(int x, int y, int r)
          pre: r >= 0
post: constructs circle with center at (x,y), radius r
Circle(Pt p, int r)
          pre: r >= 0 post: constructs circle with center p, radius r
 
Method Summary
 void clearOn(DrawingWindow d)
          Erase oval from the drawing window d.
 java.lang.Object clone()
          post: returns a distinct copy of the Object
 boolean contains(Pt p)
          post: return true iff point p is within this circle
 void drawOn(DrawingWindow d)
          Draw (in the current mode) the oval on the drawing window
 boolean equals(java.lang.Object other)
          post: returns true if two rects are equal
 void fillOn(DrawingWindow d)
          Draw a filled oval (in the current mode) on drawing window d.
 int hashCode()
          post: returns suitable hash code
 int radius()
          post: returns radius of circle
 void radius(int r)
          pre: r >= 0
post: sets radius of the circle
 java.lang.String toString()
          post: returns a string representation of Object
 
Methods inherited from class element.Rect
bottom, bottom, center, center, extend, height, height, left, left, move, moveTo, moveTo, Rectangle, right, right, top, top, width, width
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Circle

public Circle()
post: constructs a trivial circle at origin

Circle

public Circle(Drawable d)
post: constructs a Circle from a drawable
Parameters:
r -  

Circle

public Circle(int x,
              int y,
              int r)
pre: r >= 0
post: constructs circle with center at (x,y), radius r
Parameters:
x -  
y -  
r -  

Circle

public Circle(Pt p,
              int r)
pre: r >= 0 post: constructs circle with center p, radius r
Parameters:
p -  
r -  
Method Detail

contains

public boolean contains(Pt p)
post: return true iff point p is within this circle
Overrides:
contains in class Oval
Parameters:
p - a point possibly within a circle
Returns:
true iff p is within circle

radius

public int radius()
post: returns radius of circle
Returns:
radius of circle

radius

public void radius(int r)
pre: r >= 0
post: sets radius of the circle
Parameters:
r - new circle radius

fillOn

public void fillOn(DrawingWindow d)
Description copied from class: Oval
Draw a filled oval (in the current mode) on drawing window d.
Overrides:
fillOn in class Oval
Parameters:
d -  

clearOn

public void clearOn(DrawingWindow d)
Description copied from class: Oval
Erase oval from the drawing window d.
Overrides:
clearOn in class Oval
Parameters:
d -  

drawOn

public void drawOn(DrawingWindow d)
Description copied from class: Oval
Draw (in the current mode) the oval on the drawing window
Overrides:
drawOn in class Oval
Parameters:
d -  

hashCode

public int hashCode()
post: returns suitable hash code
Overrides:
hashCode in class Oval
Returns:
 

equals

public boolean equals(java.lang.Object other)
post: returns true if two rects are equal
Overrides:
equals in class Oval
Parameters:
other -  
Returns:
 

clone

public java.lang.Object clone()
post: returns a distinct copy of the Object
Overrides:
clone in class Oval
Returns:
 

toString

public java.lang.String toString()
post: returns a string representation of Object
Overrides:
toString in class Oval
Returns: