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>

public class LocalRun<S extends org.eclipse.emf.ecore.EObject,M extends Model> extends Run<S>
  • Field Details

  • 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 is Run.Status.NOT_STARTED.
      Parameters:
      scenario - EMF scenario (instance inherited from EObject that 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 inside run() 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

      protected Engine engine()
    • run

      public void run()
      Description copied from class: Run
      Starts the run and blocks until the run is completed.
      Specified by:
      run in class Run<S extends org.eclipse.emf.ecore.EObject>
    • result

      public Optional<SimulationRunResult> result()
      Description copied from class: Run
      Returns the run result, if any, or an empty Optional.

      Can be called from any external thread, including RCP UI thread

      Specified by:
      result in class Run<S extends org.eclipse.emf.ecore.EObject>
      Returns:
      run result
    • completedFraction

      public double completedFraction()
      Description copied from class: Run
      Returns 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:
      completedFraction in class Run<S extends org.eclipse.emf.ecore.EObject>
      Returns:
      simulation completion fraction