Class AbstractExperimentRunner<T>

    • Field Detail

      • NOT_RUNNING

        protected static final String NOT_RUNNING
        The message displayed when no experiment is running
        See Also:
        Constant Field Values
      • m_Owner

        protected ExperimenterPanel m_Owner
        the experimenter this runner belongs to.
      • m_Exp

        protected T m_Exp
        the copy of the experiment.
      • m_Running

        protected boolean m_Running
        whether the experiment is still running.
      • m_Aborted

        protected boolean m_Aborted
        whether the user cancelled the experiment.
    • Constructor Detail

      • AbstractExperimentRunner

        public AbstractExperimentRunner​(ExperimenterPanel owner)
                                 throws Exception
        Initializes the thread.
        Parameters:
        owner - the experimenter this runner belongs to
        Throws:
        Exception - if experiment is null or cannot be copied via serialization
    • Method Detail

      • abortExperiment

        public void abortExperiment()
        Aborts the experiment.
      • isRunning

        public boolean isRunning()
        Whether the experiment is still running.
        Returns:
        true if still running
      • logMessage

        public void logMessage​(Throwable t)
        Logs the exception with no dialog.
        Parameters:
        t - the exception
      • logMessage

        public void logMessage​(String msg)
        Logs the message.
        Parameters:
        msg - the log message
      • logError

        public void logError​(Throwable t,
                             String title)
        Logs the exception and also displays an error dialog.
        Parameters:
        t - the exception
        title - the title for the dialog
      • logError

        public void logError​(String msg,
                             String title)
        Logs the error message and also displays an error dialog.
        Parameters:
        msg - the error message
        title - the title for the dialog
      • showStatus

        public void showStatus​(String msg)
        Displays a message.
        Parameters:
        msg - the message to display
      • update

        public void update()
        Updates the owner's state.
      • preRun

        protected void preRun()
                       throws Exception
        Hook method that gets executed before the experiment gets initialized.
        Throws:
        Exception - fails due to some error
      • doInitialize

        protected abstract void doInitialize()
                                      throws Exception
        Initializes the experiment.
        Throws:
        Exception - fails due to some error
      • doRun

        protected abstract void doRun()
                               throws Exception
        Performs the actual running of the experiment.
        Throws:
        Exception - fails due to some error
      • postRun

        protected void postRun​(boolean success)
        Hook method that gets executed after the experiment has finished (successfully or not).
        Parameters:
        success - whether successfully finished (neither error, nor aborted)
      • run

        public void run()
        Starts running the experiment.
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread