Class StateMetadata<T>
- java.lang.Object
-
- io.github.frc5024.libkontrol.statemachines.StateMetadata<T>
-
- Type Parameters:
T-StateMachine's key datatype
public class StateMetadata<T> extends java.lang.ObjectA container for metadata about a state. These are sent to every state's action consumer to provide information about how and when it is being called.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedStateMetadata(StateMachine parent, T previousState, boolean isFirstRun)Create StateMetadata
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StateMachinegetParent()Get theStateMachineobject that this state belongs toTgetPreviousStateKey()Get the key of the last state to run.booleanisFirstRun()Is this the first loop of this action?
-
-
-
Constructor Detail
-
StateMetadata
protected StateMetadata(@Nonnull StateMachine parent, @Nullable T previousState, boolean isFirstRun)Create StateMetadata- Parameters:
parent- State's parentStateMachinepreviousState- The previous state keyisFirstRun- Is this the first run of the action?
-
-
Method Detail
-
getParent
@Nonnull public StateMachine getParent()
Get theStateMachineobject that this state belongs to- Returns:
- Paren
StateMachine
-
getPreviousStateKey
@Nullable public T getPreviousStateKey()
Get the key of the last state to run. Null if this is the first state to be executed.- Returns:
- Last key
-
isFirstRun
public boolean isFirstRun()
Is this the first loop of this action?- Returns:
- Is first loop
-
-