public class CoreMotor extends Object implements ActivityDefObserver, Motor, Stoppable
ActivityMotor is a Runnable which runs in one of an activity's many threads. It is the iteration harness for individual cycles of an activity. Each ActivityMotor instance is responsible for taking input from a LongSupplier and applying the provided LongConsumer to it on each cycle. These two parameters are called input and action, respectively.
| Constructor and Description |
|---|
CoreMotor(ActivityDef activityDef,
long slotId,
Input input)
Create an ActivityMotor.
|
CoreMotor(ActivityDef activityDef,
long slotId,
Input input,
Action action)
Create an ActivityMotor.
|
| Modifier and Type | Method and Description |
|---|---|
Action |
getAction() |
Input |
getInput() |
long |
getSlotId()
get the slotId which this motor is assigned to within the activity instance.
|
SlotStateTracker |
getSlotStateTracker()
Get a description of the current slot run status.
|
void |
onActivityDefUpdate(ActivityDef activityDef) |
void |
requestStop()
Ask this component to stop cycling.
|
void |
run() |
Motor |
setAction(Action action)
Set the action for this ActivityMotor.
|
Motor |
setInput(Input input)
Set the input for this ActivityMotor.
|
String |
toString() |
public CoreMotor(ActivityDef activityDef, long slotId, Input input)
activityDef - The activity def that this motor will be associated with.slotId - The enumeration of the motor, as assigned by its executor.input - A LongSupplier which provides the cycle number inputs.public CoreMotor(ActivityDef activityDef, long slotId, Input input, Action action)
activityDef - The activity def that this motor is based on.slotId - The enumeration of the motor, as assigned by its executor.input - A LongSupplier which provides the cycle number inputs.action - An LongConsumer which is applied to the input for each cycle.public long getSlotId()
Motorpublic SlotStateTracker getSlotStateTracker()
MotorgetSlotStateTracker in interface MotorRunState enumpublic void onActivityDefUpdate(ActivityDef activityDef)
onActivityDefUpdate in interface ActivityDefObserverpublic void requestStop()
StoppablerequestStop in interface StoppableCopyright © 2017. All rights reserved.