fishbowl
Class Fish

java.lang.Object
  extended by cse115.graphics.AbstractGraphic
      extended by cse115.graphics.AbstractColorableGraphic
          extended by cse115.graphics.Polygon
              extended by 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.
 
Method Summary
 Integer getDx()
           
 Integer getDy()
           
 Integer getSize()
          Returns the size of the Fish.
 Vector getVector()
           
 void setSize(Integer size)
          Sets the size of the Fish.
 void setVector(Vector v)
           
 void update()
          Update the position and orientation of the fish based on the velocity.
 void update(Observable o, Object arg)
           
 
Methods inherited from class cse115.graphics.Polygon
actualPaint, addPoint, getLocation, getShape, move, removePoint, setDimension, setLocation
 
Methods inherited from class cse115.graphics.AbstractColorableGraphic
getColor, paint, setColor
 
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
 
Methods inherited from interface cse115.graphics.Graphic
addMouseListener, addMouseMotionListener, contains, getBounds, getMouseListeners, getMouseMotionListeners, intersects, setContainer
 
Methods inherited from interface cse115.graphics.Sizeable
getDimension
 
Methods inherited from interface cse115.graphics.CenterLocatable
getCenterLocation, setCenterLocation
 
Methods inherited from interface cse115.graphics.Rotatable
getRotation, rotate, setRotation
 

Constructor Detail

Fish

public Fish()
Creates a new Fish instance.

Method Detail

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