Enum Class RunState
- All Implemented Interfaces:
Serializable,Comparable<RunState>,Constable
This enum indicates the state of a thread within an activity. The state is kept in an atomic register. Ownership of state changes is shared between a supervising thread and a managed thread. Both can make changes to the state.
These states are ordered such that the highest ordinal state represents the most significant aggregate state of all motors. That is, if any has errored, then the other states do not matter. If any is finished, then stopped motors don't matter, and so on. This makes summarizing aggregate state simply a matter of ordering.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionIf a motor has seen an exception, it goes into errored state before propagating the error.A thread has exhausted its supply of values on the input (AKA cycles), thus has completed its work.A thread is iterating within the main control loop.A thread has been invoked, but is initializing and preparing for its main control loop.The thread has stopped.The thread has been requested to stop.Initial state after creation of a motor. -
Method Summary
-
Enum Constant Details
-
Uninitialized
Initial state after creation of a motor. This is the initial state upon instantiation of a motor, before it is called on to do any active logic besides what occurs in the constructor. -
Starting
A thread has been invoked, but is initializing and preparing for its main control loop. This is signaled by the motor afterRunnable.run(), but before entering the main processing loop. -
Running
A thread is iterating within the main control loop. This is signaled by the motor once initialization in the main loop is complete and immediately before it enters it's main processing loop. -
Stopping
The thread has been requested to stop. This can be set by a managing thread which is not the motor thread, or by the motor thread. In either case, the motor thread is required to observe changes to this and initiate shutdown.
-
Stopped
The thread has stopped. This should only be set by the motor. This state will only be visible to signaling mechanisms so long as the motor is still managed.NOTE: When a motor is stopped or finished, its state will remain visible in state tracking until
Motor.getState().MotorState.removeState()is called. -
Finished
A thread has exhausted its supply of values on the input (AKA cycles), thus has completed its work. This is signaled upon a short read of the input by the motor.
NOTE: When a motor is stopped or finished, its state will remain visible in state tracking until
Motor.getState().MotorState.removeState()is called. -
Errored
If a motor has seen an exception, it goes into errored state before propagating the error.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getCode
-
canTransitionTo
- Parameters:
target- The target state- Returns:
- true if the current state is allowed to transition to the target state
-