Record Class FsmContext<ContextT>
java.lang.Object
java.lang.Record
xbot.common.logic.FsmContext<ContextT>
- Type Parameters:
ContextT- The type of the payload.- Record Components:
payload- The caller-supplied object carrying whatever inputs/outputs the state machine needs. Typically the subsystem or command that owns theFiniteStateMachine.executionsInState- The number of timesFiniteStateMachine.execute(Object)has run against the current state, including this call. Reset to zero whenever the state changes.timeInState- The number of seconds since the current state was entered, perXTimer. Reset to zero whenever the state changes.
public record FsmContext<ContextT>(ContextT payload, long executionsInState, double timeInState)
extends Record
The information passed in to every
FsmState hook and to every FiniteStateMachine hook. A fresh
FsmContext is built for every hook invocation during a single FiniteStateMachine.execute(Object)
cycle, so executionsInState/timeInState always reflect the state that is actually running at the
moment the hook is called.-
Constructor Summary
ConstructorsConstructorDescriptionFsmContext(ContextT payload, long executionsInState, double timeInState) Creates an instance of aFsmContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.longReturns the value of theexecutionsInStaterecord component.final inthashCode()Returns a hash code value for this object.payload()Returns the value of thepayloadrecord component.doubleReturns the value of thetimeInStaterecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
FsmContext
Creates an instance of aFsmContextrecord class.- Parameters:
payload- the value for thepayloadrecord componentexecutionsInState- the value for theexecutionsInStaterecord componenttimeInState- the value for thetimeInStaterecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
payload
-
executionsInState
public long executionsInState()Returns the value of theexecutionsInStaterecord component.- Returns:
- the value of the
executionsInStaterecord component
-
timeInState
public double timeInState()Returns the value of thetimeInStaterecord component.- Returns:
- the value of the
timeInStaterecord component
-