sysModel.env
Class NoGridEnv.LocalEnvironment

java.lang.Object
  extended by sysModel.env.AGlobalEnv.ALocalEnv
      extended by sysModel.env.NoGridEnv.LocalEnvironment
Enclosing class:
NoGridEnv

protected class NoGridEnv.LocalEnvironment
extends AGlobalEnv.ALocalEnv

Concrete local environment for the square unbounded environment.


Nested Class Summary
private  class NoGridEnv.LocalEnvironment.MoveLambda
          Lambda to execute a move.
 
Field Summary
(package private)  NoGridEnv.Direction _dir
          Direction.
(package private)  NoGridEnv.Location _loc
          Location.
(package private)  ILocalEnvState _state
          State.
 
Constructor Summary
NoGridEnv.LocalEnvironment(NoGridEnv.Location loc, NoGridEnv.Direction dir)
          Construct a new local environment.
 
Method Summary
 NoGridEnv.Direction direction()
          Accessor for the direction.
 void drawFish(AFish fish, java.awt.Graphics2D g, java.awt.Component comp)
          Draw the fish on the graphics object.
 NoGridEnv.Location location()
          Accessor for the location.
protected  AGlobalEnv.ALocalEnv makeMoveFwdLocalEnv()
          Make local environment in forward direction.
protected  ILambda makeMoveLambda(AGlobalEnv.ALocalEnv le)
          Factory method for a move lambda.
 java.lang.String toString()
          String representation of the local environment.
 void turnRight(AFish fish, double radians)
          Turn the fish radians to the right.
 
Methods inherited from class sysModel.env.AGlobalEnv.ALocalEnv
execute, removeFish, setState, tryBreedFwd, tryMoveFwd
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_loc

NoGridEnv.Location _loc
Location.


_dir

NoGridEnv.Direction _dir
Direction.


_state

ILocalEnvState _state
State.

Constructor Detail

NoGridEnv.LocalEnvironment

public NoGridEnv.LocalEnvironment(NoGridEnv.Location loc,
                                  NoGridEnv.Direction dir)
Construct a new local environment.

Parameters:
loc - location
dir - direction
Method Detail

location

public NoGridEnv.Location location()
Accessor for the location.

Returns:
location

direction

public NoGridEnv.Direction direction()
Accessor for the direction.

Returns:
direction

makeMoveFwdLocalEnv

protected AGlobalEnv.ALocalEnv makeMoveFwdLocalEnv()
Make local environment in forward direction. Do not block yourself.

Specified by:
makeMoveFwdLocalEnv in class AGlobalEnv.ALocalEnv
Returns:
new local environment in forward direction

makeMoveLambda

protected ILambda makeMoveLambda(AGlobalEnv.ALocalEnv le)
Factory method for a move lambda.

Specified by:
makeMoveLambda in class AGlobalEnv.ALocalEnv
Parameters:
le - local environment for the target
Returns:
move lambda to execute the move to the target

drawFish

public void drawFish(AFish fish,
                     java.awt.Graphics2D g,
                     java.awt.Component comp)
Draw the fish on the graphics object. The graphics object still has to be translated and rotated properly,

Specified by:
drawFish in class AGlobalEnv.ALocalEnv
Parameters:
fish - AFish to drawFish
g - graphics object to drawFish on
comp - component to drawFish on

turnRight

public void turnRight(AFish fish,
                      double radians)
Turn the fish radians to the right.

Specified by:
turnRight in class AGlobalEnv.ALocalEnv
Parameters:
fish - AFish to turn
radians - radians to turn

toString

public java.lang.String toString()
String representation of the local environment. Should be "(x, y) (dx, dy)".

Overrides:
toString in class java.lang.Object
Returns:
string representation