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.RunnableWithLoggingRunnable 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 booleanm_HasActorswhether we have any actors to apply to the data.protected Ratm_Ownerthe owning Rat.protected booleanm_Pausedwhether 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 voiddoRun()Performs the actual execution.RatgetOwner()Returns the owning actor.booleanisPaused()Returns whether the execution has been suspended.voidpauseExecution()Pauses the execution.protected voidpostRun()Hook method after the run finished.voidresumeExecution()Resumes the execution.voidstopExecution()Stops the execution.protected Stringtransmit(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:
doRunin classadams.flow.core.RunnableWithLogging
-
postRun
protected void postRun()
Hook method after the run finished.- Overrides:
postRunin 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:
stopExecutionin interfaceadams.core.Stoppable- Overrides:
stopExecutionin classadams.flow.core.RunnableWithLogging
-
-