sysModel.fish.tests
Class Test_AFish.TestGlobalEnv

java.lang.Object
  extended by sysModel.env.AGlobalEnv
      extended by sysModel.fish.tests.Test_AFish.TestGlobalEnv
Enclosing class:
Test_AFish

private final class Test_AFish.TestGlobalEnv
extends AGlobalEnv


Nested Class Summary
 
Nested classes/interfaces inherited from class sysModel.env.AGlobalEnv
AGlobalEnv.ALocalEnv, AGlobalEnv.BreedLambda, AGlobalEnv.ILocalEnvVisitor
 
Field Summary
 
Fields inherited from class sysModel.env.AGlobalEnv
_breedLambdas, _cmdFactory, _moveLambdas, _securityManager, _waterColor, OCEAN_BLUE
 
Constructor Summary
Test_AFish.TestGlobalEnv(ICmdFactory cmdFactory, ISecurityAdapter sm)
           
 
Method Summary
protected  void addFishToInternalData(AGlobalEnv.ALocalEnv localEnv, AFish fish)
          Add the fish to the environment's internal data structure.
protected  ILambda editFish(AGlobalEnv.ALocalEnv localEnv, IFishFactory fishFactory, int button)
          Edit the fish.
 java.awt.Dimension getDisplaySize()
          Get size of the display.
 java.awt.geom.Point2D.Double getPanDelta(java.awt.geom.Point2D.Double delta)
          Ask the model how much to pan, given where the user scrolled.
 ILambda getToolTipText(java.awt.geom.Point2D.Double p)
          Get a tool tip description for a specific place in the environment.
 java.awt.geom.Point2D.Double getViewPosition(java.awt.geom.Point2D.Double pos)
          Ask the model where to scroll, given where the user has scrolled.
 AEnvFactory makeEnvFactory()
          Create the environment settings class for an environment.
 AGlobalEnv.ALocalEnv makeLocalEnv(java.awt.geom.Point2D.Double p)
          Create a local environment for the position.
protected  AGlobalEnv parseEnvironment(Lexer l)
          Factory method for parsing the parameters for an environment and then creating it.
protected  void parseFish(Lexer l)
          Parse fish and add them to the environment.
protected  void printHeader(java.io.PrintWriter pw)
          Print file header.
protected  void removeFishFromInternalData(AGlobalEnv.ALocalEnv localEnv)
          Remove the fish to the environment's internal data structure.
 void returnHome(IScrollAdapter sa)
          The action to be executed if the display should return home.
 
Methods inherited from class sysModel.env.AGlobalEnv
addFish, deactivateBreedLambdas, deactivateMoveLambdas, drawBackground, makeDrawCmd, makeEditCmd, makeStepCmd, parse, removeFish, save
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Test_AFish.TestGlobalEnv

public Test_AFish.TestGlobalEnv(ICmdFactory cmdFactory,
                                ISecurityAdapter sm)
Method Detail

editFish

protected ILambda editFish(AGlobalEnv.ALocalEnv localEnv,
                           IFishFactory fishFactory,
                           int button)
Description copied from class: AGlobalEnv
Edit the fish.

Specified by:
editFish in class AGlobalEnv
Parameters:
localEnv - local environment
Returns:
lambda for the simulation control to execute

addFishToInternalData

protected void addFishToInternalData(AGlobalEnv.ALocalEnv localEnv,
                                     AFish fish)
Description copied from class: AGlobalEnv
Add the fish to the environment's internal data structure.

Specified by:
addFishToInternalData in class AGlobalEnv
Parameters:
localEnv - local environment
fish - fish to add

removeFishFromInternalData

protected void removeFishFromInternalData(AGlobalEnv.ALocalEnv localEnv)
Description copied from class: AGlobalEnv
Remove the fish to the environment's internal data structure.

Specified by:
removeFishFromInternalData in class AGlobalEnv
Parameters:
localEnv - local environment

parseEnvironment

protected AGlobalEnv parseEnvironment(Lexer l)
Description copied from class: AGlobalEnv
Factory method for parsing the parameters for an environment and then creating it.

Specified by:
parseEnvironment in class AGlobalEnv
Parameters:
l - lexer
Returns:
new global environment

parseFish

protected void parseFish(Lexer l)
Description copied from class: AGlobalEnv
Parse fish and add them to the environment.

Specified by:
parseFish in class AGlobalEnv
Parameters:
l - parser to read from

makeLocalEnv

public AGlobalEnv.ALocalEnv makeLocalEnv(java.awt.geom.Point2D.Double p)
Description copied from class: AGlobalEnv
Create a local environment for the position.

Specified by:
makeLocalEnv in class AGlobalEnv
Parameters:
p - position
Returns:
local environment

makeEnvFactory

public AEnvFactory makeEnvFactory()
Description copied from class: AGlobalEnv
Create the environment settings class for an environment. Factory method.

Specified by:
makeEnvFactory in class AGlobalEnv
Returns:
environment settings class

printHeader

protected void printHeader(java.io.PrintWriter pw)
Description copied from class: AGlobalEnv
Print file header.

Specified by:
printHeader in class AGlobalEnv
Parameters:
pw - PrintWriter to use

getDisplaySize

public java.awt.Dimension getDisplaySize()
Description copied from class: AGlobalEnv
Get size of the display.

Specified by:
getDisplaySize in class AGlobalEnv
Returns:
size of the display in model coordinate units.

returnHome

public void returnHome(IScrollAdapter sa)
Description copied from class: AGlobalEnv
The action to be executed if the display should return home.

Specified by:
returnHome in class AGlobalEnv
Parameters:
sa - scroll adapter

getViewPosition

public java.awt.geom.Point2D.Double getViewPosition(java.awt.geom.Point2D.Double pos)
Description copied from class: AGlobalEnv
Ask the model where to scroll, given where the user has scrolled. If the environment just acts like a normal panal, it should return pos without modification. If the environment recenters, it should return a position in the middle of the pan area. All coordinates are in model coordinate units.

Specified by:
getViewPosition in class AGlobalEnv
Parameters:
pos - position where the user scrolled to
Returns:
position where the environment wants the view to be
See Also:
IDisplayAdapter.getPanDelta(java.awt.geom.Point2D.Double)

getPanDelta

public java.awt.geom.Point2D.Double getPanDelta(java.awt.geom.Point2D.Double delta)
Description copied from class: AGlobalEnv
Ask the model how much to pan, given where the user scrolled. If the environment just acts like a normal panal, it should return (0,0). If the environment recenters, it should return delta without modification. All coordinates are in model coordinate units.

Specified by:
getPanDelta in class AGlobalEnv
Parameters:
delta - how far the user scrolled
Returns:
how far the panel should scroll
See Also:
IDisplayAdapter.getViewPosition(java.awt.geom.Point2D.Double)

getToolTipText

public ILambda getToolTipText(java.awt.geom.Point2D.Double p)
Description copied from class: AGlobalEnv
Get a tool tip description for a specific place in the environment.

Specified by:
getToolTipText in class AGlobalEnv
Parameters:
p - mouse coordinates
Returns:
lambda for the simulation controller to execute. Must return the tooltip string.