public class CoreMotor extends Object implements ActivityDefObserver, Motor, Stoppable, OpResultBuffer.Sink<OpContext>
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
CoreMotor.StrideResultBuffer |
| Constructor and Description |
|---|
CoreMotor(Activity activity,
long slotId,
Input input)
Create an ActivityMotor.
|
CoreMotor(Activity activity,
long slotId,
Input input,
Action action)
Create an ActivityMotor.
|
CoreMotor(Activity activity,
long slotId,
Input input,
Action action,
Output output)
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 |
handle(OpResultBuffer<OpContext> strideResults) |
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.
|
void |
setResultOutput(Output resultOutput) |
String |
toString() |
public CoreMotor(Activity activity, long slotId, Input input)
activity - The activity 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(Activity activity, long slotId, Input input, Action action)
activity - The activity 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 CoreMotor(Activity activity, long slotId, Input input, Action action, Output output)
activity - The activity 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.output - An optional tracker.public long getSlotId()
Motorpublic SlotStateTracker getSlotStateTracker()
MotorgetSlotStateTracker in interface MotorRunState enumpublic void onActivityDefUpdate(ActivityDef activityDef)
onActivityDefUpdate in interface ActivityDefObserverpublic void requestStop()
StoppablerequestStop in interface Stoppablepublic void setResultOutput(Output resultOutput)
public void handle(OpResultBuffer<OpContext> strideResults)
handle in interface OpResultBuffer.Sink<OpContext>Copyright © 2018. All rights reserved.