fishbowl
Class Fish
java.lang.Object
cse115.graphics.AbstractGraphic
cse115.graphics.AbstractColorableGraphic
cse115.graphics.Polygon
fishbowl.Fish
- All Implemented Interfaces:
- CenterLocatable, Colorable, ColorableGraphic, Graphic, Locatable, Rotatable, Sizeable, Observer
- Direct Known Subclasses:
- Fish
public class Fish
- extends Polygon
- implements Observer
A Fish that moves when told to.
Created: Thu Sep 29 15:00:55 2005
- Version:
- 1.3
- Author:
- Carl Alphonce
Constructor Summary |
Fish()
Creates a new Fish instance. |
Methods inherited from class cse115.graphics.AbstractGraphic |
addMouseListener, addMouseMotionListener, contains, getBounds, getCenterLocation, getContainer, getDimension, getMouseListeners, getMouseMotionListeners, getRotation, intersects, rotate, setCenterLocation, setContainer, setRotation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Fish
public Fish()
- Creates a new
Fish
instance.
getSize
public Integer getSize()
- Returns the size of the Fish.
- Returns:
- the size of the Fish.
setSize
public void setSize(Integer size)
- Sets the size of the Fish.
- Parameters:
size
- the new size of the Fish (must be greater than 0).
update
public void update()
- Update the position and orientation of the fish based on the
velocity. If the fish hits a wall, it reverses velocity in the
appropriate direction and points in the appropriate direction
too.
getVector
public Vector getVector()
setVector
public void setVector(Vector v)
getDx
public Integer getDx()
getDy
public Integer getDy()
update
public void update(Observable o,
Object arg)
- Specified by:
update
in interface Observer