Package repast.simphony.engine.schedule
Class ThreadedAction
- java.lang.Object
-
- repast.simphony.engine.schedule.AbstractAction
-
- repast.simphony.engine.schedule.ThreadedAction
-
- All Implemented Interfaces:
IAction
,ISchedulableAction
public class ThreadedAction extends AbstractAction
An ISchedulableAction that will run in the background for some specificable number of ticks (the duration). If the ThreadedAction is still running after that number of ticks, the ThreadedAction will behave like a normal foreground action, that is, the the schedule will wait until the ThreadedAction completes before executing the next scheduled actions.- Author:
- Nick Collier
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class repast.simphony.engine.schedule.AbstractAction
AbstractAction.IntervalRescheduler, AbstractAction.OneTimeRescheduler, AbstractAction.Rescheduler
-
-
Field Summary
-
Fields inherited from class repast.simphony.engine.schedule.AbstractAction
frequency, interval, nextTime, nonModelAction, priority, pType, rescheduler
-
-
Constructor Summary
Constructors Constructor Description ThreadedAction(ScheduleParameters param, IAction action, long orderIndex)
Creates a ThreadedAction to execute the specified IAction according to the specified scheduling parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute()
Executes this ThreadedAction.protected void
setFrequency(Frequency type)
Sets the execution frequency.-
Methods inherited from class repast.simphony.engine.schedule.AbstractAction
addForExecution, getNextTime, getOrderIndex, getPriority, getPriorityType, isNonModelAction, reschedule, setIsNonModelAction, setIsNonModelAction
-
-
-
-
Constructor Detail
-
ThreadedAction
public ThreadedAction(ScheduleParameters param, IAction action, long orderIndex)
Creates a ThreadedAction to execute the specified IAction according to the specified scheduling parameters.- Parameters:
param
- the scheduling dataaction
- the action to executeorderIndex
- the index when this was added
-
-
Method Detail
-
setFrequency
protected void setFrequency(Frequency type)
Sets the execution frequency.- Overrides:
setFrequency
in classAbstractAction
- Parameters:
type
- the execution frequency.
-
execute
public void execute()
Executes this ThreadedAction. If the action has not yet started, this will create the background thread and start to run it. If the thread has started this will wait for the thread to complete.
-
-