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.Object
A 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 protected
StateMetadata(StateMachine parent, T previousState, boolean isFirstRun)
Create StateMetadata
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StateMachine
getParent()
Get theStateMachine
object that this state belongs toT
getPreviousStateKey()
Get the key of the last state to run.boolean
isFirstRun()
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 parentStateMachine
previousState
- The previous state keyisFirstRun
- Is this the first run of the action?
-
-
Method Detail
-
getParent
@Nonnull public StateMachine getParent()
Get theStateMachine
object 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
-
-