Ball World Problem Set Javadocs

ballworld
Class Shrinker

java.lang.Object
  extended byballworld.Shrinker
All Implemented Interfaces:
Animate, Ball

public class Shrinker
extends java.lang.Object
implements Animate, Ball

A ball that falls and shrinks at the same time.

Version:
$Id: Shrinker.java,v 1.2 2003/09/11 21:35:37 gus Exp $
Author:
(original author unknown), Patrick G. Heck, gus.heck@olin.edu

Constructor Summary
Shrinker()
          Create a default shrinker.
Shrinker(double x, double y)
          Create a shrinker at a given point and give it random velocities
 
Method Summary
 void act()
           
 double getRadius()
          Returns the current radius of the Ball
 double getX()
          Returns the current horizontal location of the Ball
 double getY()
          Returns the current vertical location of the Ball
 void setWorld(World theWorld)
          This method will be called by our setup code shortly after your Ball is created.
 void userClicked(double x, double y)
          Process a click from the mouse.
 void userTyped(char key)
          This method is called if the user selects this particualr ball and then types a key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shrinker

public Shrinker(double x,
                double y)
Create a shrinker at a given point and give it random velocities

Parameters:
x - The x coordinate to start at.
y - The y coordinte to start at

Shrinker

public Shrinker()
Create a default shrinker. This version starts at 0,0 and has no initial velocity.

Method Detail

getX

public double getX()
Description copied from interface: Ball
Returns the current horizontal location of the Ball

Specified by:
getX in interface Ball
Returns:
The horizontal location

getY

public double getY()
Description copied from interface: Ball
Returns the current vertical location of the Ball

Specified by:
getY in interface Ball
Returns:
The vertical location

getRadius

public double getRadius()
Description copied from interface: Ball
Returns the current radius of the Ball

Specified by:
getRadius in interface Ball
Returns:
The radius

setWorld

public void setWorld(World theWorld)
Description copied from interface: Ball
This method will be called by our setup code shortly after your Ball is created. If you would like to use the World object to get information about the world, then you should store the parameter of this method somewhere safe.

Specified by:
setWorld in interface Ball
Parameters:
theWorld - A world object that contains this ball

userClicked

public void userClicked(double x,
                        double y)
Description copied from interface: Ball
Process a click from the mouse. This method is called if the user selects this particular ball and then clicks or drags the mouse somewhere. The atX and atY parameters are the location that the user released the mouse button.

Specified by:
userClicked in interface Ball
Parameters:
x - The x coordinate of the user's click
y - The y coordinate of the user's click

userTyped

public void userTyped(char key)
Description copied from interface: Ball
This method is called if the user selects this particualr ball and then types a key. The key that the user typed is passed as the parameter. Note that not all keys on the keyboard will cause this method to get called -- only those keys that have a printable form. (For instance, the 'J' or space key will trigger this method, but the arrow and function keys may not.)

Specified by:
userTyped in interface Ball
Parameters:
key - The character from the key that the user typed.

act

public void act()
Specified by:
act in interface Animate

Ball World Problem Set Javadocs