public interface ActivityType<A extends Activity>
An ActivityType is the central extension point in EngineBlock for new activity types drivers. It is responsible for naming the activity type, as well as providing the input, activity, and motor instances that will be assembled into an activity.
At the very minimum, a useful implementation of an activity type should provide an action dispenser. Default implementations of input and motor dispensers are provided, and by extension, default inputs and motors.
| Modifier and Type | Method and Description |
|---|---|
default ActionDispenser |
getActionDispenser(A activity)
This method will be called once per action instance.
|
default A |
getActivity(ActivityDef activityDef)
Create an instance of an activity from the activity type.
|
default Activity |
getAssembledActivity(ActivityDef activityDef,
Map<String,Activity> activities)
Create an instance of an activity that ties together all the components into a usable
activity instance.
|
default InputDispenser |
getInputDispenser(A activity)
Return the InputDispenser instance that will be used by the associated activity to create Input factories
for each thread slot.
|
default MotorDispenser |
getMotorDispenser(A activity,
InputDispenser inputDispenser,
ActionDispenser actionDispenser) |
String |
getName()
Return the short name of this activity type.
|
String getName()
default A getActivity(ActivityDef activityDef)
activityDef - the definition that initializes and controls the activity.default Activity getAssembledActivity(ActivityDef activityDef, Map<String,Activity> activities)
activityDef - the definition that initializez and controlls the activity.activities - a map of existing activitiesdefault ActionDispenser getActionDispenser(A activity)
activity - The activity instance that will parameterize the returned ActionDispenser instance.default InputDispenser getInputDispenser(A activity)
activity - the Activity instance which will parameterize this InputDispenserdefault MotorDispenser getMotorDispenser(A activity, InputDispenser inputDispenser, ActionDispenser actionDispenser)
Copyright © 2017. All rights reserved.