Class LifecycleController

Object
LifecycleController

class LifecycleController extends Object
Helper to manage lifecycle listeners and dispatch lifecycle notifications as well as loading and unloading modules and models.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final EvoLudo
    Owning engine used to query modules and dispatch events.
    List of listeners for module/model load/unload lifecycle events.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a controller bound to the supplied engine.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add a lifecycle listener to the list of listeners that get notified when the model reaches lifecycle milestones.
    void
    Called whenever a new model has finished loading.
    void
    Called whenever a new model has finished loading.
    void
    Called whenever a new module has finished loading.
    void
    Called after the state of the model has been restored either through drag'n'drop with the GWT GUI or through the --restore command line argument.
    void
    Called whenever the current module has finished unloading.
    void
    Set model type and loads the corresponding frameworks for individual based simulations or numerical integration of ODE/SDE/PDE models.
    boolean
    loadModule(String newModuleKey)
    Load new module with key newModuleKey.
    void
    Remove the lifecycle listener from the list of listeners that get notified when the model reaches lifecycle milestones.
    void
    Unload model framework.
    void
    unloadModel(boolean quiet)
    Unload model framework and, if requested, notifies all registered LifecycleListeners.
    void
    Unload current module to free up resources.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • engine

      private final EvoLudo engine
      Owning engine used to query modules and dispatch events.
    • lifecycleListeners

      protected List<LifecycleListener> lifecycleListeners
      List of listeners for module/model load/unload lifecycle events.
  • Constructor Details

    • LifecycleController

      public LifecycleController(EvoLudo engine)
      Create a controller bound to the supplied engine.
      Parameters:
      engine - EvoLudo runtime to interact with
  • Method Details

    • addListener

      public void addListener(LifecycleListener newListener)
      Add a lifecycle listener to the list of listeners that get notified when the model reaches lifecycle milestones.
      Parameters:
      newListener - the new lifecycle listener
      See Also:
    • removeListener

      public void removeListener(LifecycleListener obsoleteListener)
      Remove the lifecycle listener from the list of listeners that get notified when the model reaches lifecycle milestones.
      Parameters:
      obsoleteListener - the listener to remove from list of lifecycle listeners
      See Also:
    • fireModuleLoaded

      public void fireModuleLoaded()
      Called whenever a new module has finished loading. Notifies all registered LifecycleListeners.
      See Also:
    • fireModuleUnloaded

      public void fireModuleUnloaded()
      Called whenever the current module has finished unloading. Notifies all registered LifecycleListeners.
      See Also:
    • fireModuleRestored

      public void fireModuleRestored()
      Called after the state of the model has been restored either through drag'n'drop with the GWT GUI or through the --restore command line argument. Notifies all registered LifecycleListeners.
      See Also:
    • fireModelLoaded

      public void fireModelLoaded()
      Called whenever a new model has finished loading. Notifies all registered LifecycleListeners.
      See Also:
    • fireModelUnloaded

      public void fireModelUnloaded()
      Called whenever a new model has finished loading. Notifies all registered LifecycleListeners.
      See Also:
    • loadModule

      public boolean loadModule(String newModuleKey)
      Load new module with key newModuleKey. If necessary first unload current module.
      Parameters:
      newModuleKey - the key of the module to load
      Returns:
      false if newModuleKey not found and no active module present; true otherwise
      See Also:
    • unloadModule

      public void unloadModule()
      Unload current module to free up resources.

      Implementation note:

      Called from loadModule(String) to first unload the active module or triggered by GWT's EvoLudoWeb.onUnload(), i.e. when unloading the GWT application.
      See Also:
    • loadModel

      public void loadModel(ModelType type)
      Set model type and loads the corresponding frameworks for individual based simulations or numerical integration of ODE/SDE/PDE models.
      Parameters:
      type - the type of Model to load
      See Also:
    • unloadModel

      public void unloadModel()
      Unload model framework. Notifies all registered LifecycleListeners.
      See Also:
    • unloadModel

      public void unloadModel(boolean quiet)
      Unload model framework and, if requested, notifies all registered LifecycleListeners.
      Parameters:
      quiet - set to true to skip notifying listeners
      See Also: