| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectsysModel.env.AGlobalEnv
public abstract class AGlobalEnv
Abstract global environment class.
Note: All subclasses must provide a one-parameter constructor that just takes in an ICmdFactory for dynamic access to parse() and makeEnvFactory().
| Nested Class Summary | |
|---|---|
|  class | AGlobalEnv.ALocalEnvAbstract bsae class of the environment local to a fish. | 
| protected  class | AGlobalEnv.BreedLambdaLambda to execute a breed. | 
| static interface | AGlobalEnv.ILocalEnvVisitorVisitor to opererate on a local environment. | 
| Field Summary | |
|---|---|
| protected  LRStruct | _breedLambdasList of breed commands issued. | 
| protected  ICmdFactory | _cmdFactoryCommand factory for lambdas given to the simulation driver. | 
| protected  LRStruct | _moveLambdasList of move commands issued. | 
| protected  ISecurityAdapter | _securityManagerSecurity manager that controls the actions of the fish. | 
| protected  java.awt.Color | _waterColorColor of the water. | 
| protected static java.awt.Color | OCEAN_BLUEColor of the ocean. | 
| Constructor Summary | |
|---|---|
| AGlobalEnv(ICmdFactory cmdFactory,
           ISecurityAdapter sm)Construct a new abstract global environment. | |
| Method Summary | |
|---|---|
| protected  ILambda | addFish(AGlobalEnv.ALocalEnv localEnv,
        AFish fish)Add the fish to the global environment. | 
| protected abstract  void | addFishToInternalData(AGlobalEnv.ALocalEnv localEnv,
                      AFish fish)Add the fish to the environment's internal data structure. | 
| protected  void | deactivateBreedLambdas()Deactivate move commands and clear list. | 
| protected  void | deactivateMoveLambdas()Deactivate move commands and clear list. | 
| protected  void | drawBackground(java.awt.Graphics2D g2,
               java.awt.geom.Point2D.Double p1,
               java.awt.geom.Point2D.Double p2)Draw ocean background. | 
| protected abstract  ILambda | editFish(AGlobalEnv.ALocalEnv localEnv,
         IFishFactory fishFactory,
         int button)Edit the fish. | 
| abstract  java.awt.Dimension | getDisplaySize()Get size of the display. | 
| abstract  java.awt.geom.Point2D.Double | getPanDelta(java.awt.geom.Point2D.Double delta)Ask the model how much to pan, given where the user scrolled. | 
| abstract  ILambda | getToolTipText(java.awt.geom.Point2D.Double p)Get a tool tip description for a specific place in the environment. | 
| abstract  java.awt.geom.Point2D.Double | getViewPosition(java.awt.geom.Point2D.Double pos)Ask the model where to scroll, given where the user has scrolled. | 
|  ILambda | makeDrawCmd(java.awt.Graphics2D g2,
            java.awt.Component comp,
            java.awt.geom.Point2D.Double p1,
            java.awt.geom.Point2D.Double p2)Draw the environment in the region requested in model coordinates. | 
|  ILambda | makeEditCmd(java.awt.geom.Point2D.Double p,
            IFishFactory fishFactory,
            int button)Edit a location. | 
| abstract  AEnvFactory | makeEnvFactory()Create the environment settings class for an environment. | 
| protected abstract  AGlobalEnv.ALocalEnv | makeLocalEnv(java.awt.geom.Point2D.Double p)Create a local environment for the position. | 
|  ILambda | makeStepCmd()Make the step command for the simulation driver to execute. | 
|  AGlobalEnv | parse(Lexer l)Factory method for parsing a stream of tokens and creating a global environment from it. | 
| protected abstract  AGlobalEnv | parseEnvironment(Lexer l)Factory method for parsing the parameters for an environment and then creating it. | 
| protected abstract  void | parseFish(Lexer l)Parse fish and add them to the environment. | 
| protected abstract  void | printHeader(java.io.PrintWriter pw)Print file header. | 
| protected  ILambda | removeFish(AGlobalEnv.ALocalEnv localEnv)Remove the fish from the global environment. | 
| protected abstract  void | removeFishFromInternalData(AGlobalEnv.ALocalEnv localEnv)Remove the fish to the environment's internal data structure. | 
| abstract  void | returnHome(IScrollAdapter sa)The action to be executed if the display should return home. | 
|  ILambda | save(java.io.PrintWriter pw)Save an environment to a file. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected static final java.awt.Color OCEAN_BLUE
protected LRStruct _moveLambdas
protected LRStruct _breedLambdas
protected ICmdFactory _cmdFactory
protected ISecurityAdapter _securityManager
protected java.awt.Color _waterColor
| Constructor Detail | 
|---|
public AGlobalEnv(ICmdFactory cmdFactory,
                  ISecurityAdapter sm)
cmdFactory - command factory to usesm - security manager to control fish actions| Method Detail | 
|---|
protected void deactivateMoveLambdas()
protected void deactivateBreedLambdas()
public ILambda makeEditCmd(java.awt.geom.Point2D.Double p,
                           IFishFactory fishFactory,
                           int button)
p - positionfishFactory - factory to make a new fishbutton - 
protected ILambda addFish(AGlobalEnv.ALocalEnv localEnv,
                          AFish fish)
localEnv - local environmentfish - fish to add
protected ILambda removeFish(AGlobalEnv.ALocalEnv localEnv)
localEnv - local environment
public ILambda makeDrawCmd(java.awt.Graphics2D g2,
                           java.awt.Component comp,
                           java.awt.geom.Point2D.Double p1,
                           java.awt.geom.Point2D.Double p2)
g2 - the Graphics2D object to use to rendercomp - the component to makeDrawCmd onp1 - top left cornerp2 - bottom right corner
protected void drawBackground(java.awt.Graphics2D g2,
                              java.awt.geom.Point2D.Double p1,
                              java.awt.geom.Point2D.Double p2)
g2 - graphics objectp1 - top left cornerp2 - bottom right cornerpublic ILambda makeStepCmd()
public ILambda save(java.io.PrintWriter pw)
pw - PrintWriter to use for output
public AGlobalEnv parse(Lexer l)
l - lexer to use
protected abstract ILambda editFish(AGlobalEnv.ALocalEnv localEnv,
                                    IFishFactory fishFactory,
                                    int button)
localEnv - local environmentfishFactory - button - 
protected abstract void addFishToInternalData(AGlobalEnv.ALocalEnv localEnv,
                                              AFish fish)
localEnv - local environmentfish - fish to addprotected abstract void removeFishFromInternalData(AGlobalEnv.ALocalEnv localEnv)
localEnv - local environmentprotected abstract AGlobalEnv parseEnvironment(Lexer l)
l - lexer
protected abstract void parseFish(Lexer l)
l - parser to read fromprotected abstract AGlobalEnv.ALocalEnv makeLocalEnv(java.awt.geom.Point2D.Double p)
p - position
public abstract AEnvFactory makeEnvFactory()
protected abstract void printHeader(java.io.PrintWriter pw)
pw - PrintWriter to usepublic abstract java.awt.Dimension getDisplaySize()
public abstract void returnHome(IScrollAdapter sa)
sa - scroll adapterpublic abstract java.awt.geom.Point2D.Double getViewPosition(java.awt.geom.Point2D.Double pos)
pos - position where the user scrolled to
IDisplayAdapter.getPanDelta(java.awt.geom.Point2D.Double)public abstract java.awt.geom.Point2D.Double getPanDelta(java.awt.geom.Point2D.Double delta)
delta - how far the user scrolled
IDisplayAdapter.getViewPosition(java.awt.geom.Point2D.Double)public abstract ILambda getToolTipText(java.awt.geom.Point2D.Double p)
p - mouse coordinates
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||