Package adams.flow.standalone.rats
Class RatRunnable
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.flow.core.RunnableWithLogging
-
- adams.flow.standalone.rats.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.
-
Constructor Summary
Constructors Constructor Description RatRunnable(Rat owner, boolean paused)
Initializes the runnable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doRun()
Performs the actual execution.Rat
getOwner()
Returns the owning actor.boolean
isPaused()
Returns whether the execution has been suspended.void
pauseExecution()
Pauses the execution.protected void
postRun()
Hook method after the run finished.void
resumeExecution()
Resumes the execution.void
stopExecution()
Stops the execution.protected String
transmit(Object data)
Transmits the data.-
Methods inherited from class adams.flow.core.RunnableWithLogging
isRunning, isStopped, preRun, run, setLoggingLevel
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
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 actorpaused
- 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 classadams.flow.core.RunnableWithLogging
-
postRun
protected void postRun()
Hook method after the run finished.- Overrides:
postRun
in classadams.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 interfaceadams.core.Stoppable
- Overrides:
stopExecution
in classadams.flow.core.RunnableWithLogging
-
-