element
Class Oval

java.lang.Object
  |
  +--element.Rect
        |
        +--element.Oval
Direct Known Subclasses:
Arc, Circle

public class Oval
extends Rect

Implements an oval object. An oval is the unique elipse that fits within a particular rectangle.


Fields inherited from class element.Rect
height, left, top, width
 
Constructor Summary
Oval()
          Constructs a trivial oval at the origin.
Oval(int x, int y, int w, int h)
          Construct an oval bounded by the rectangle with upper-left (x,y), width w, and height h
Oval(Oval r)
          Makes a copy of an existing oval.
Oval(Pt p, Pt q)
          Construct an oval within a rectangle defined by two points.
Oval(Rect r)
          Construct an oval bounded by an existing rectangle.
 
Method Summary
 void clearOn(DrawingWindow d)
          Erase oval from the drawing window d.
 java.lang.Object clone()
          return a distinct copy of this oval
 boolean contains(Pt p)
          Returns true if p is contained within oval.
 void drawOn(DrawingWindow d)
          Draw (in the current mode) the oval on the drawing window
 boolean equals(java.lang.Object other)
          Return true iff this oval equals the other
 void fillOn(DrawingWindow d)
          Draw a filled oval (in the current mode) on drawing window d.
 int hashCode()
          Return an integer for use as a hash code
 java.lang.String toString()
          Construct a string representation of this oval
 
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

Oval

public Oval()
Constructs a trivial oval at the origin.

Oval

public Oval(Oval r)
Makes a copy of an existing oval.
Parameters:
the - existing oval

Oval

public Oval(Pt p,
            Pt q)
Construct an oval within a rectangle defined by two points.
Parameters:
p - one bounding point
q - another bounding point

Oval

public Oval(Rect r)
Construct an oval bounded by an existing rectangle.
Parameters:
r - the bounding rectangle

Oval

public Oval(int x,
            int y,
            int w,
            int h)
Construct an oval bounded by the rectangle with upper-left (x,y), width w, and height h
Parameters:
x - left of bounding rectangle
y - top of bounding rectangle
w - width of oval
h - height of oval
Method Detail

contains

public boolean contains(Pt p)
Returns true if p is contained within oval.
Overrides:
contains in class Rect
Parameters:
p - the point to be considered
Returns:
true iff p is contained within the oval.

fillOn

public void fillOn(DrawingWindow d)
Draw a filled oval (in the current mode) on drawing window d.
Overrides:
fillOn in class Rect
Parameters:
d - the target drawing window.
See Also:
DrawingWindow.fill(element.Drawable), DrawingWindow.paintMode(), DrawingWindow.invertMode()

clearOn

public void clearOn(DrawingWindow d)
Erase oval from the drawing window d.
Overrides:
clearOn in class Rect
Parameters:
d - the target drawing window
See Also:
DrawingWindow.clear(element.Drawable)

drawOn

public void drawOn(DrawingWindow d)
Draw (in the current mode) the oval on the drawing window
Overrides:
drawOn in class Rect
Parameters:
d - the target drawing window
See Also:
DrawingWindow.paintMode(), DrawingWindow.invertMode(), DrawingWindow.draw(element.Drawable)

hashCode

public int hashCode()
Return an integer for use as a hash code
Overrides:
hashCode in class Rect
Returns:
a hash code

equals

public boolean equals(java.lang.Object other)
Return true iff this oval equals the other
Overrides:
equals in class Rect
Parameters:
other - another valid oval
Returns:
true if the two are equal valued, false otherwise

clone

public java.lang.Object clone()
return a distinct copy of this oval
Overrides:
clone in class Rect
Returns:
a distinct copy of this oval

toString

public java.lang.String toString()
Construct a string representation of this oval
Overrides:
toString in class Rect
Returns:
a string representation of this oval