|
|||||||||
| 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 |
_cmdFactory
Command factory for use in the environment. |
private IEditAdapter |
_editAdapter
Edit adapter. |
private AGlobalEnv |
_env
Environment. |
private ILambda |
_iterationCommand
Command executed after the simulation finishes an iteration. |
private MBSSecurityManager |
_securityManager
Security manager. |
private ILambda |
_seedCommand
Command to set the seed when a new environment is loaded or created. |
private SimEngine |
_simEngine
Simulation engine. |
private int |
_simulationSpeed
Simulation speed. |
private ILambda |
_startCommand
Command executed before the simulation starts running. |
private javax.swing.Timer |
_timer
Processing 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 | ||||||||