org.eclipse.amp.escape.ide
Class EclipseEscapeRunner

java.lang.Object
  extended by org.ascape.runtime.Runner
      extended by org.ascape.runtime.NonGraphicRunner
          extended by org.eclipse.amp.escape.ide.EclipseEscapeRunner
All Implemented Interfaces:
java.io.Serializable, java.lang.Runnable, IEngine

public class EclipseEscapeRunner
extends org.ascape.runtime.NonGraphicRunner
implements IEngine

The Class EclipseEscapeRunner.

See Also:
Serialized Form

Field Summary
static long KILL_AFTER_NO_RESPONSE_TIME
           
 
Constructor Summary
EclipseEscapeRunner()
           
 
Method Summary
 void close()
          Close.
 void closeFinally()
          Close finally.
 void control(EngineControl control)
          Control.
 org.eclipse.core.resources.IProject getExecutingProject()
           
 org.eclipse.core.runtime.IStatus getFinishStatus()
          Gets the finish status.
 int getIterationsPerRedraw()
           
 IModel getModel()
          Gets the model.
 org.eclipse.core.runtime.IProgressMonitor getMonitor()
          Gets the monitor.
 org.ascape.model.Scape getScape()
          Gets the scape.
 ITimeGranularity getUpdateGranularity()
          Returns the update granularity.
 boolean isCloseOnStop()
          Should the model exit upon a stop command?
 void notify(org.ascape.model.event.ScapeEvent event, org.ascape.model.event.ScapeListener listener)
           
 void observationComplete(ILifeCycleListener observer)
          Observation complete.
 void open(org.eclipse.core.resources.IResource modelResource, java.lang.String modelClassName, java.lang.String modelName)
          Open.
 void open(org.eclipse.core.resources.IResource projectResource, java.lang.String modelClassName, java.lang.String modelName, java.lang.String[] args)
          Open.
 void open(org.eclipse.core.resources.IResource projectResource, java.lang.String modelClassName, java.lang.String modelName, java.lang.String[] args, boolean block)
          Open.
 void respondControl(org.ascape.model.event.ControlEvent control)
           
 void setCloseOnStop(boolean closeOnStop)
          Specifies whether the runner should exit upon a model stop.
 void setFinishStatus(org.eclipse.core.runtime.IStatus finishStatus)
          Sets the finish status.
 void setIterationsPerRedraw(int iterations)
           
 void setMonitor(org.eclipse.core.runtime.IProgressMonitor modelMonitor)
          Sets the monitor.
 void setUpdateGranularity(ITimeGranularity granularity)
          Sets the update granularity.
 void start()
           
 
Methods inherited from class org.ascape.runtime.NonGraphicRunner
closeAndOpenSavedFinally, main, saveChoose
 
Methods inherited from class org.ascape.runtime.Runner
assignEnvironmentParameter, assignEnvironmentParameters, closeAndOpenNew, closeAndOpenNewFinally, closeAndOpenSaved, createEnvironment, exit, getData, getDescription, getEarliestPeriod, getEnvironment, getHome, getHTMLDescription, getIteration, getLatestPeriod, getModelThread, getPausePeriod, getPeriod, getPeriodName, getRestartingViews, getRootScape, getStartPeriod, getStopPeriod, instanceFromName, isAutoRestart, isBeginningDeserializedRun, isCloseAndOpenNewRequested, isCloseAndOpenSavedRequested, isCloseRequested, isDisplayGraphics, isInMainLoop, isMultiWinEnvironment, isOpenRequested, isPaused, isQuitRequested, isRestartRequested, isRunning, isSaveRequested, isServeGraphics, isStartOnOpen, isStep, isValidPeriod, launch, open, open, open, open, open, open, open, open, open, open, open, openChoose, openChoose, openImplementation, openInstance, openSavedChoose, openSavedRun, openSavedRun, openSavedRun, pause, quit, quitFinally, requestRestart, restart, resume, run, run, save, setAutoRestart, setBeginningDeserializedRun, setCloseAndOpenNewRequested, setCloseAndOpenSavedRequested, setCloseRequested, setDescription, setDisplayGraphics, setEarliestPeriod, setEnvironment, setHome, setHTMLDescription, setInMainLoop, setInternalRunning, setIteration, setLatestPeriod, setMultiWinEnvironment, setOpenRequested, setPaused, setPausePeriod, setPeriod, setPeriodName, setQuitRequested, setRestartingViews, setRestartRequested, setRootScape, setRunning, setSaveRequested, setServeGraphics, setStartOnOpen, setStartPeriod, setStep, setStopPeriod, stop, testRun, waitForViewsUpdate, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.amp.axf.core.IEngine
getModelThread, isCloseRequested, isPaused, isRunning, stop
 

Field Detail

KILL_AFTER_NO_RESPONSE_TIME

public static final long KILL_AFTER_NO_RESPONSE_TIME
See Also:
Constant Field Values
Constructor Detail

EclipseEscapeRunner

public EclipseEscapeRunner()
Method Detail

open

public void open(org.eclipse.core.resources.IResource modelResource,
                 java.lang.String modelClassName,
                 java.lang.String modelName)
Open.

Parameters:
modelResource - the model resource
modelClassName - the model class name
modelName - the model name

open

public void open(org.eclipse.core.resources.IResource projectResource,
                 java.lang.String modelClassName,
                 java.lang.String modelName,
                 java.lang.String[] args)
Open. Wait until execution has stopped to return.

Parameters:
projectResource - the project resource
modelClassName - the model class name
modelName - the model name
args - the args

open

public void open(org.eclipse.core.resources.IResource projectResource,
                 java.lang.String modelClassName,
                 java.lang.String modelName,
                 java.lang.String[] args,
                 boolean block)
Open.

Parameters:
projectResource - the project resource
modelClassName - the model class name
modelName - the model name
args - the args
block - true if this method should only return on execution completion.

start

public void start()
Overrides:
start in class org.ascape.runtime.Runner
See Also:
Runner.start()

close

public void close()
Description copied from interface: IEngine
Close.

Specified by:
close in interface IEngine
Overrides:
close in class org.ascape.runtime.Runner
See Also:
Runner.close()

closeFinally

public void closeFinally()
Description copied from interface: IEngine
Close finally.

Specified by:
closeFinally in interface IEngine
Overrides:
closeFinally in class org.ascape.runtime.Runner
See Also:
Runner.closeFinally()

getFinishStatus

public org.eclipse.core.runtime.IStatus getFinishStatus()
Gets the finish status.

Returns:
the finish status

setFinishStatus

public void setFinishStatus(org.eclipse.core.runtime.IStatus finishStatus)
Sets the finish status.

Parameters:
finishStatus - the new finish status

getModel

public IModel getModel()
Description copied from interface: IEngine
Gets the model.

Specified by:
getModel in interface IEngine
Returns:
the model
See Also:
IEngine.getModel()

getIterationsPerRedraw

public int getIterationsPerRedraw()
See Also:
org.eclipse.amp.axf.core.IEngine#getIterationsPerRedraw()

respondControl

public void respondControl(org.ascape.model.event.ControlEvent control)
Overrides:
respondControl in class org.ascape.runtime.Runner
See Also:
Runner.respondControl(org.ascape.model.event.ControlEvent)

control

public void control(EngineControl control)
Description copied from interface: IEngine
Control.

Specified by:
control in interface IEngine
Parameters:
control - the model control
See Also:
IEngine.control(org.eclipse.amp.axf.core.EngineControl)

notify

public void notify(org.ascape.model.event.ScapeEvent event,
                   org.ascape.model.event.ScapeListener listener)
Overrides:
notify in class org.ascape.runtime.Runner
See Also:
Runner.notify(org.ascape.model.event.ScapeEvent, org.ascape.model.event.ScapeListener)

setIterationsPerRedraw

public void setIterationsPerRedraw(int iterations)
See Also:
org.eclipse.amp.axf.core.IEngine#setIterationsPerRedraw(int)

getScape

public org.ascape.model.Scape getScape()
Gets the scape.

Returns:
the scape

getMonitor

public org.eclipse.core.runtime.IProgressMonitor getMonitor()
Gets the monitor.

Returns:
the monitor

setMonitor

public void setMonitor(org.eclipse.core.runtime.IProgressMonitor modelMonitor)
Sets the monitor.

Parameters:
modelMonitor - the new monitor

observationComplete

public void observationComplete(ILifeCycleListener observer)
Description copied from interface: IEngine
Observation complete.

Specified by:
observationComplete in interface IEngine
Parameters:
observer - the observer
See Also:
IEngine.observationComplete(org.eclipse.amp.axf.core.ILifeCycleListener)

getUpdateGranularity

public ITimeGranularity getUpdateGranularity()
Description copied from interface: IEngine
Returns the update granularity.

Specified by:
getUpdateGranularity in interface IEngine
Returns:
See Also:
IEngine.getUpdateGranularity()

setUpdateGranularity

public void setUpdateGranularity(ITimeGranularity granularity)
Description copied from interface: IEngine
Sets the update granularity. This defines how often observers expect to receive state change notifications. Regardless of this value, engines should always provide life-cycle notifications.

Specified by:
setUpdateGranularity in interface IEngine
Parameters:
granularity -
See Also:
IEngine.setUpdateGranularity(org.eclipse.amp.axf.time.ITimeGranularity)

getExecutingProject

public org.eclipse.core.resources.IProject getExecutingProject()

isCloseOnStop

public boolean isCloseOnStop()
Should the model exit upon a stop command?

Returns:
whether to complete run on model stop; default is false
See Also:
setCloseOnStop(boolean)

setCloseOnStop

public void setCloseOnStop(boolean closeOnStop)
Specifies whether the runner should exit upon a model stop. The default behavior is false, which leaves the model open (and typically able to restart) until explicitly closed. For batch runs we don't want the model to stay open as that requires a view notification and response to close it. It's probably cleaner to allow the runner to exit immediately rather than wait for a listener to trigger one. Note that the model will not stop in the case where a restart has been requested, and listener's will be notified of a model stop before actually closing. This gives output control listeners -- for a parameter sweep control, for example -- an opportunity to set restart to request a restart. It also implies that it makes no sense to have autoRestart true if this value is also true. Since auto-restart is by default true, be sure to set it to false. This setting can be safely changed during a model run.

Parameters:
closeOnStop - whether to complete run on model stop; default is false