Class StateHandler<T>
- java.lang.Object
-
- io.github.frc5024.libkontrol.statemachines.StateHandler<T>
-
public class StateHandler<T> extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description StateHandler(T key, StateMachine<T> parent, java.util.function.Consumer<StateMetadata<T>> action)
Create a StateHandler for a given state
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
call(boolean isNew, T lastStateKey)
Call the action function
-
-
-
Constructor Detail
-
StateHandler
public StateHandler(@Nonnull T key, @Nonnull StateMachine<T> parent, @Nonnull java.util.function.Consumer<StateMetadata<T>> action)
Create a StateHandler for a given state- Parameters:
key
- The key for this state (it's name)parent
- The state machine that owns this objectaction
- The action to be performed during this state
-
-
Method Detail
-
call
public void call(boolean isNew, @Nullable T lastStateKey)
Call the action function- Parameters:
isNew
- Is this the first run?lastStateKey
- Key of the last state to run
-
-