Class LocalRun<S extends org.eclipse.emf.ecore.EObject,M extends Model>
java.lang.Object
com.amalgamasimulation.studies.core.Run<S>
com.amalgamasimulation.studies.core.LocalRun<S,M>
-
Nested Class Summary
Nested classes/interfaces inherited from class com.amalgamasimulation.studies.core.Run
Run.Status -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Engineprotected doubleprotected ModelCreator<S, M> protected Function<M, SimulationRunResult> Fields inherited from class com.amalgamasimulation.studies.core.Run
completionActionHandler, result, scenario, seed -
Constructor Summary
ConstructorsConstructorDescriptionLocalRun(ShortId id, S scenario, int seed, ModelCreator<S, M> modelCreator, Function<M, SimulationRunResult> resultGenerator) LocalRun(S scenario, int seed, ModelCreator<S, M> modelCreator, Function<M, SimulationRunResult> resultGenerator) Creates a new instance of a run and assigns a unique id to it. -
Method Summary
Methods inherited from class com.amalgamasimulation.studies.core.Run
elapsedTimeMillis, errorsCount, id, isStopRequested, runCompletionActionHandlerOnce, setCompletionActionHandler, setStatus, setStopMonitor, status, stop
-
Field Details
-
engineEndTime
protected double engineEndTime -
engine
-
modelCreator
-
resultGenerator
-
-
Constructor Details
-
LocalRun
public LocalRun(S scenario, int seed, ModelCreator<S, M> modelCreator, Function<M, SimulationRunResult> resultGenerator) Creates a new instance of a run and assigns a unique id to it. Upon creation, the run's status isRun.Status.NOT_STARTED.- Parameters:
scenario- EMF scenario (instance inherited fromEObjectthat parameterizes the simulation model.seed- random number seed used to initialize random number sequences of the simulation model.modelCreator- functional interface used to create an instance of simulation model. Might be called insiderun()method.resultGenerator- function that creates a result by the model instance when the simulation is correctly or erroneously completed.
-
LocalRun
public LocalRun(ShortId id, S scenario, int seed, ModelCreator<S, M> modelCreator, Function<M, SimulationRunResult> resultGenerator)
-
-
Method Details
-
engine
-
run
public void run()Description copied from class:RunStarts the run and blocks until the run is completed. -
result
Description copied from class:RunReturns the run result, if any, or an empty Optional.Can be called from any external thread, including RCP UI thread
-
completedFraction
public double completedFraction()Description copied from class:RunReturns the current simulation completion fraction as a number between 0.0 and 1.0;Can be called from any external thread, including RCP UI thread
- Specified by:
completedFractionin classRun<S extends org.eclipse.emf.ecore.EObject>- Returns:
- simulation completion fraction
-