| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectsysModel.SimDriver
public class SimDriver
Simulation control coordinating interaction between view, simulation engine and environment.
| Field Summary | |
|---|---|
| private  ICmdFactory | _cmdFactoryCommand factory for use in the environment. | 
| private  IEditAdapter | _editAdapterEdit adapter. | 
| private  AGlobalEnv | _envEnvironment. | 
| private  ILambda | _iterationCommandCommand executed after the simulation finishes an iteration. | 
| private  MBSSecurityManager | _securityManagerSecurity manager. | 
| private  ILambda | _seedCommandCommand to set the seed when a new environment is loaded or created. | 
| private  SimEngine | _simEngineSimulation engine. | 
| private  int | _simulationSpeedSimulation speed. | 
| private  ILambda | _startCommandCommand executed before the simulation starts running. | 
| private  javax.swing.Timer | _timerProcessing timer. | 
| Constructor Summary | |
|---|---|
| SimDriver()Construct a new model. | |
| Method Summary | |
|---|---|
|  boolean | createEnvironment(AEnvFactory factory)Create environment from factory. | 
|  void | draw(java.awt.Graphics2D g,
     java.awt.Component comp,
     java.awt.geom.Point2D.Double p1,
     java.awt.geom.Point2D.Double p2)Draw model in this region. | 
|  void | edit(java.awt.geom.Point2D.Double p,
     int button)Edit a field. | 
|  ICmdFactory | getCmdFactory()Get the simulation engine. | 
|  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. | 
|  ISecurityAdapter | getSecurityAdapter()Return the security adapter. | 
|  java.lang.String | 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. | 
|  boolean | loadEnvironment(java.lang.String filename)Load environment from file. | 
|  void | returnHome(IScrollAdapter sa)The action to be executed if the display should return home. | 
|  boolean | saveEnvironment(java.lang.String filename)Save environment to file. | 
|  void | setAdapters(IEditAdapter ea)Set adapters. | 
|  void | setIterationLambda(ILambda itCmd)Set simulation iteration command. | 
|  void | setSeedLambda(ILambda seedCmd)Set the seed command. | 
|  void | setSpeed(int speed)Change the simulation speed. | 
|  void | setStartLambda(ILambda startCmd)Set simulation start command. | 
|  void | start()Start simulation. | 
|  void | step()Make a simulation step. | 
|  void | stop()Stop simulation. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
private AGlobalEnv _env
private SimEngine _simEngine
private ILambda _seedCommand
private ILambda _startCommand
private ILambda _iterationCommand
private int _simulationSpeed
private javax.swing.Timer _timer
private IEditAdapter _editAdapter
private MBSSecurityManager _securityManager
private ICmdFactory _cmdFactory
| Constructor Detail | 
|---|
public SimDriver()
| Method Detail | 
|---|
public ICmdFactory getCmdFactory()
public void setAdapters(IEditAdapter ea)
ea - makeEditCmd adapter to usepublic boolean loadEnvironment(java.lang.String filename)
filename - filename
public boolean saveEnvironment(java.lang.String filename)
filename - filename
public boolean createEnvironment(AEnvFactory factory)
factory - factory
public void setSeedLambda(ILambda seedCmd)
seedCmd - command to setpublic void step()
public void start()
public void stop()
public void setSpeed(int speed)
speed - simulation speedpublic void setStartLambda(ILambda startCmd)
startCmd - start commandpublic void setIterationLambda(ILambda itCmd)
itCmd - start command
public void draw(java.awt.Graphics2D g,
                 java.awt.Component comp,
                 java.awt.geom.Point2D.Double p1,
                 java.awt.geom.Point2D.Double p2)
g - graphics objectcomp - component to drawFish onp1 - top left corner of the regionp2 - bottom right corner of the region
public void edit(java.awt.geom.Point2D.Double p,
                 int button)
p - coordinates in model coordinate unitsbutton - mouse button pressedpublic void returnHome(IScrollAdapter sa)
sa - scroll adapterpublic java.awt.Dimension getDisplaySize()
public 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 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 java.lang.String getToolTipText(java.awt.geom.Point2D.Double p)
p - mouse coordinates
public ISecurityAdapter getSecurityAdapter()
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||