infpp.oceanlife
Class Fish

java.lang.Object
  extended by java.lang.Thread
      extended by infpp.oceanlife.OceanObject
          extended by infpp.oceanlife.Fish
All Implemented Interfaces:
java.io.Serializable, java.lang.Runnable

public class Fish
extends OceanObject

Implements objects of the type fish. The coordinates and the icon are given from the super class "OceanObject". The movement direction is defined here.

Author:
tdu, akue
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  int dir0
          Sets the width of the x-direction of the bubble's movement.
private  int dir1
          Sets the amplitude of the x-direction of the bubble's movement.
private  int dir2
          Sets the width of the y-direction of the bubble's movement.
private  int dir3
          Sets the amplitude of the y-direction of the bubble's movement.
 javax.swing.ImageIcon fishIcon
          the icon to use for the fish
 
Fields inherited from class infpp.oceanlife.OceanObject
COLLISION_LEFT_BOUND, COLLISION_LOWER_BOUND, COLLISION_RIGHT_BOUND, COLLISION_UPPER_BOUND, currentOcean, direction, id, myID, NO_COLLISION
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Fish(int x, int y, javax.swing.ImageIcon fishIcon, Ocean currentOcean)
           
 
Method Summary
 javax.swing.ImageIcon getFishIcon()
           
 void setFishIcon(javax.swing.ImageIcon fishIcon)
           
 java.lang.String toString()
           
protected  void updateDirection()
           
 
Methods inherited from class infpp.oceanlife.OceanObject
getDimensionsOfIcon, getObjectIcon, getObjectID, getObjectIDString, getPosition, getPositionX, getPositionY, getUniqueOceanObjectID, isHighlighted, isToDie, objectCollidesWithOceanBounds, run, setHighlighted, setObjectIcon, setPositionWhenAdding, setPositionWhenMoving, setToDie
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fishIcon

public javax.swing.ImageIcon fishIcon
the icon to use for the fish


dir0

private int dir0
Sets the width of the x-direction of the bubble's movement.


dir1

private int dir1
Sets the amplitude of the x-direction of the bubble's movement.


dir2

private int dir2
Sets the width of the y-direction of the bubble's movement.


dir3

private int dir3
Sets the amplitude of the y-direction of the bubble's movement.

Constructor Detail

Fish

public Fish(int x,
            int y,
            javax.swing.ImageIcon fishIcon,
            Ocean currentOcean)
     throws java.lang.Exception
Parameters:
x - the fish's x coordinate
y - the fish's y coordinate
fishIcon - the fish's image icon
currentOcean - the ocean the fish resides in
Throws:
throws - exception for the position
java.lang.Exception
Method Detail

updateDirection

protected void updateDirection()
Overrides:
updateDirection in class OceanObject

toString

public java.lang.String toString()
Overrides:
toString in class OceanObject
Returns:
a string representation of the object.

getFishIcon

public javax.swing.ImageIcon getFishIcon()
Returns:
Returns the fishIcon.

setFishIcon

public void setFishIcon(javax.swing.ImageIcon fishIcon)
Parameters:
fishIcon - the fish icon to set