| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectsysModel.fish.AFish
public abstract class AFish
Behavior-controlled fish. *
| Field Summary | |
|---|---|
| protected  java.awt.Color | _fishColorColor of the fish. | 
| protected  IFishDisplay | _fishDisplayDisplay for the fish. | 
| private  AGlobalEnv.ALocalEnv | _localEnvThe local environment of the fish. | 
| protected  double | _probOfBreedingThe probability that this fish attempts to breed this timestep. | 
| protected  double | _probOfDyingThe probability that this fish will die in this timestep. | 
| Constructor Summary | |
|---|---|
| AFish(java.awt.Color fishColor,
           IFishDisplay fishDisplay)Create a new fish. | |
| Method Summary | |
|---|---|
|  void | act()Execute a simulation step. | 
| protected  void | age()Execute the aging part of a simulation step. | 
| protected  void | breed()Execute the breeding part of a simulation step. | 
|  java.lang.Object | clone()Return a clone this instance. | 
|  void | die()Let the fish die, remove it from the environment and the simulation. | 
|  void | draw(java.awt.Graphics2D g,
         java.awt.Component comp)Draw the fish on the graphics object. | 
|  java.awt.Color | getColor()Get the fish's color. | 
| protected abstract  void | move()Execute the movement part of a simulation step. | 
|  void | paint(java.awt.Graphics2D g,
           java.awt.Component comp)Draw the fish. | 
|  void | setLocalEnvironment(AGlobalEnv.ALocalEnv localEnv)Set the local environment of this fish. | 
|  void | setProbOfBreeding(double p)Set probability of breeding. | 
|  void | setProbOfDying(double p)Set probability of dying. | 
|  java.lang.String | toString()Return a string representation of this fish. | 
|  java.lang.Object | tryBreedFwd(IBlockedCommand blockedCmd,
                       IOpenCommand openCmd)Attempt to breed the fish forward, which may or may not be successful. | 
|  java.lang.Object | tryMoveFwd(IBlockedCommand blockedCmd,
                     IOpenCommand openCmd)Attempt to move the fish forward, which may or may not be successful. | 
|  void | turnLeft()Turn the fish Pi/2 radians to the left. | 
|  void | turnLeft(double radians)Turn the fish radians to the left. | 
|  void | turnRight()Turn the fish Pi/2 radians to the right. | 
|  void | turnRight(double radians)Turn the fish radians to the right. | 
|  void | update(java.util.Observable o,
             java.lang.Object arg)This method is called whenever the observed object is changed. | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
private AGlobalEnv.ALocalEnv _localEnv
protected double _probOfBreeding
protected double _probOfDying
protected java.awt.Color _fishColor
protected IFishDisplay _fishDisplay
| Constructor Detail | 
|---|
public AFish(java.awt.Color fishColor,
             IFishDisplay fishDisplay)
fishColor - fish colorfishDisplay - fish display| Method Detail | 
|---|
public final void setLocalEnvironment(AGlobalEnv.ALocalEnv localEnv)
localEnv - local environment
public final java.lang.Object tryMoveFwd(IBlockedCommand blockedCmd,
                                         IOpenCommand openCmd)
blockedCmd - lambda to apply if blockedopenCmd - lambda to apply if open
public final java.lang.Object tryBreedFwd(IBlockedCommand blockedCmd,
                                          IOpenCommand openCmd)
blockedCmd - lambda to apply if blockedopenCmd - lambda to apply if open
public final void draw(java.awt.Graphics2D g,
                       java.awt.Component comp)
g - graphics object to drawFish oncomp - component to drawFish onpublic final void turnRight(double radians)
radians - radians to turnpublic final void turnLeft(double radians)
radians - radians to turnpublic final void turnRight()
public final void turnLeft()
public final void die()
public final void act()
protected void breed()
protected void age()
public java.lang.Object clone()
clone in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectprotected abstract void move()
public void paint(java.awt.Graphics2D g,
                  java.awt.Component comp)
g - graphics object to drawFish on.comp - the component to drawFish onpublic java.awt.Color getColor()
public final void update(java.util.Observable o,
                         java.lang.Object arg)
update in interface java.util.Observero - the observable objectarg - lambda to executepublic void setProbOfDying(double p)
p - the probabilitypublic void setProbOfBreeding(double p)
p - the probability| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||