Class RatRunnable

  • All Implemented Interfaces:
    adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.SizeOfHandler, adams.core.Stoppable, adams.core.StoppableWithFeedback, Serializable, Runnable

    public class RatRunnable
    extends adams.flow.core.RunnableWithLogging
    Runnable class for Rat used in a thread.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean m_HasActors
      whether we have any actors to apply to the data.
      protected Rat m_Owner
      the owning Rat.
      protected boolean m_Paused
      whether the execution has been paused.
      • Fields inherited from class adams.flow.core.RunnableWithLogging

        m_Running, m_Stopped
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Constructor Summary

      Constructors 
      Constructor Description
      RatRunnable​(Rat owner, boolean paused)
      Initializes the runnable.
    • Field Detail

      • m_Owner

        protected Rat m_Owner
        the owning Rat.
      • m_HasActors

        protected boolean m_HasActors
        whether we have any actors to apply to the data.
      • m_Paused

        protected boolean m_Paused
        whether the execution has been paused.
    • Constructor Detail

      • RatRunnable

        public RatRunnable​(Rat owner,
                           boolean paused)
        Initializes the runnable.
        Parameters:
        owner - the owning actor
        paused - whether to start in paused mode
    • Method Detail

      • getOwner

        public Rat getOwner()
        Returns the owning actor.
        Returns:
        the owner
      • transmit

        protected String transmit​(Object data)
        Transmits the data.
        Parameters:
        data - the data to transmit, ignored if null
        Returns:
        null if successful, otherwise error message
      • doRun

        protected void doRun()
        Performs the actual execution.
        Specified by:
        doRun in class adams.flow.core.RunnableWithLogging
      • postRun

        protected void postRun()
        Hook method after the run finished.
        Overrides:
        postRun in class adams.flow.core.RunnableWithLogging
      • pauseExecution

        public void pauseExecution()
        Pauses the execution.
      • resumeExecution

        public void resumeExecution()
        Resumes the execution.
      • isPaused

        public boolean isPaused()
        Returns whether the execution has been suspended.
        Returns:
        true if paused
      • stopExecution

        public void stopExecution()
        Stops the execution.
        Specified by:
        stopExecution in interface adams.core.Stoppable
        Overrides:
        stopExecution in class adams.flow.core.RunnableWithLogging