fishbowl
Class Fish

java.lang.Object
  extended by graphics.AbstractGraphic
      extended by graphics.AbstractColorableGraphic
          extended by graphics.Polygon
              extended by fishbowl.Fish
All Implemented Interfaces:
CenterLocatable, IColorable, IColorableGraphic, IGraphic, ILocatable, IRotatable, ISizeable, Observer

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 graphics.Polygon
actualPaint, addPoint, getShape, removePoint, setDimension, setLocation
 
Methods inherited from class graphics.AbstractColorableGraphic
getColor, paint, setColor
 
Methods inherited from class graphics.AbstractGraphic
addMouseListener, addMouseMotionListener, contains, getBounds, getCenterLocation, getContainer, getDimension, getLocation, getMouseListeners, getMouseMotionListeners, getRotation, intersects, move, rotate, setCenterLocation, setContainer, setMovement, setRotation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface graphics.IGraphic
addMouseListener, addMouseMotionListener, contains, getBounds, getContainer, getMouseListeners, getMouseMotionListeners, intersects, setContainer, setMovement
 
Methods inherited from interface graphics.ISizeable
getDimension
 
Methods inherited from interface graphics.CenterLocatable
getCenterLocation, setCenterLocation
 
Methods inherited from interface graphics.ILocatable
getLocation, move
 
Methods inherited from interface graphics.IRotatable
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

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