public abstract class AbstractFSM<S,D> extends java.lang.Object implements FSM<S,D>
Finite State Machine actor abstract base class.
This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.
FSM.$minus$greater$, FSM.CurrentState<S>, FSM.CurrentState$, FSM.Event<D>, FSM.Event$, FSM.Failure, FSM.Failure$, FSM.LogEntry<S,D>, FSM.LogEntry$, FSM.Normal$, FSM.NullFunction$, FSM.Reason, FSM.Shutdown$, FSM.SilentState<S,D>, FSM.State<S,D>, FSM.State$, FSM.StateTimeout$, FSM.StopEvent<S,D>, FSM.StopEvent$, FSM.SubscribeTransitionCallBack, FSM.SubscribeTransitionCallBack$, FSM.TimeoutMarker, FSM.TimeoutMarker$, FSM.Timer, FSM.Timer$, FSM.TransformHelper, FSM.Transition<S>, FSM.Transition$, FSM.UnsubscribeTransitionCallBack, FSM.UnsubscribeTransitionCallBack$
Actor.emptyBehavior$, Actor.ignoringBehavior$
Constructor and Description |
---|
AbstractFSM() |
Modifier and Type | Method and Description |
---|---|
static FSM.$minus$greater$ |
$minus$greater() |
protected abstract static void |
akka$actor$Actor$_setter_$context_$eq(ActorContext x$1) |
protected abstract static void |
akka$actor$Actor$_setter_$self_$eq(ActorRef x$1) |
static void |
akka$actor$ActorLogging$$_log_$eq(LoggingAdapter x$1) |
static LoggingAdapter |
akka$actor$ActorLogging$$_log() |
protected abstract static void |
akka$actor$FSM$_setter_$$minus$greater_$eq(FSM.$minus$greater$ x$1) |
protected abstract static void |
akka$actor$FSM$_setter_$akka$actor$FSM$$handleEventDefault_$eq(scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>> x$1) |
protected abstract static void |
akka$actor$FSM$_setter_$akka$actor$FSM$$stateFunctions_$eq(scala.collection.mutable.Map<S,scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>>> x$1) |
protected abstract static void |
akka$actor$FSM$_setter_$akka$actor$FSM$$stateTimeouts_$eq(scala.collection.mutable.Map<S,scala.Option<scala.concurrent.duration.FiniteDuration>> x$1) |
protected abstract static void |
akka$actor$FSM$_setter_$akka$actor$FSM$$timerGen_$eq(scala.collection.Iterator<java.lang.Object> x$1) |
protected abstract static void |
akka$actor$FSM$_setter_$akka$actor$FSM$$timers_$eq(scala.collection.mutable.Map<java.lang.String,FSM.Timer> x$1) |
protected abstract static void |
akka$actor$FSM$_setter_$Event_$eq(FSM.Event$ x$1) |
protected abstract static void |
akka$actor$FSM$_setter_$StateTimeout_$eq(FSM.StateTimeout$ x$1) |
protected abstract static void |
akka$actor$FSM$_setter_$StopEvent_$eq(FSM.StopEvent$ x$1) |
static void |
akka$actor$FSM$$currentState_$eq(FSM.State<S,D> x$1) |
static FSM.State<S,D> |
akka$actor$FSM$$currentState() |
static void |
akka$actor$FSM$$generation_$eq(long x$1) |
static long |
akka$actor$FSM$$generation() |
static void |
akka$actor$FSM$$handleEvent_$eq(scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>> x$1) |
static scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>> |
akka$actor$FSM$$handleEvent() |
static scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>> |
akka$actor$FSM$$handleEventDefault() |
static void |
akka$actor$FSM$$nextState_$eq(FSM.State<S,D> x$1) |
static FSM.State<S,D> |
akka$actor$FSM$$nextState() |
static scala.collection.mutable.Map<S,scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>>> |
akka$actor$FSM$$stateFunctions() |
static scala.collection.mutable.Map<S,scala.Option<scala.concurrent.duration.FiniteDuration>> |
akka$actor$FSM$$stateTimeouts() |
static void |
akka$actor$FSM$$terminateEvent_$eq(scala.PartialFunction<FSM.StopEvent<S,D>,scala.runtime.BoxedUnit> x$1) |
static scala.PartialFunction<FSM.StopEvent<S,D>,scala.runtime.BoxedUnit> |
akka$actor$FSM$$terminateEvent() |
static void |
akka$actor$FSM$$timeoutFuture_$eq(scala.Option<Cancellable> x$1) |
static scala.Option<Cancellable> |
akka$actor$FSM$$timeoutFuture() |
static scala.collection.Iterator<java.lang.Object> |
akka$actor$FSM$$timerGen() |
static scala.collection.mutable.Map<java.lang.String,FSM.Timer> |
akka$actor$FSM$$timers() |
static void |
akka$actor$FSM$$transitionEvent_$eq(scala.collection.immutable.List<scala.PartialFunction<scala.Tuple2<S,S>,scala.runtime.BoxedUnit>> x$1) |
static scala.collection.immutable.List<scala.PartialFunction<scala.Tuple2<S,S>,scala.runtime.BoxedUnit>> |
akka$actor$FSM$$transitionEvent() |
protected abstract static void |
akka$routing$Listeners$_setter_$listeners_$eq(java.util.Set<ActorRef> x$1) |
static void |
applyState(FSM.State<S,D> nextState) |
protected static void |
aroundPostRestart(java.lang.Throwable reason) |
protected static void |
aroundPostStop() |
protected static void |
aroundPreRestart(java.lang.Throwable reason,
scala.Option<java.lang.Object> message) |
protected static void |
aroundPreStart() |
protected static void |
aroundReceive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive,
java.lang.Object msg) |
static void |
cancelTimer(java.lang.String name) |
ActorContext |
context()
Stores the context for this actor, including self, and sender.
|
static boolean |
debugEvent() |
FSM.Event$ |
Event() |
protected static void |
gossip(java.lang.Object msg,
ActorRef sender) |
protected static ActorRef |
gossip$default$2(java.lang.Object msg) |
FSM.State<S,D> |
goTo(S nextStateName)
Produce transition to other state.
|
static void |
initialize() |
static boolean |
isStateTimerActive() |
static boolean |
isTimerActive(java.lang.String name) |
protected static scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
listenerManagement() |
protected java.util.Set<ActorRef> |
listeners() |
static LoggingAdapter |
log() |
protected static void |
logTermination(FSM.Reason reason) |
static void |
makeTransition(FSM.State<S,D> nextState) |
FSMStateFunctionBuilder<S,D> |
matchAnyEvent(FI.Apply2<java.lang.Object,D,FSM.State<S,D>> apply)
Create an
FSMStateFunctionBuilder with the first case statement set. |
<DT extends D> |
matchData(java.lang.Class<DT> dataType,
FI.TypedPredicate<DT> predicate,
FI.UnitApply<DT> apply)
Create a
UnitPFBuilder with the first case statement set. |
<DT extends D> |
matchData(java.lang.Class<DT> dataType,
FI.UnitApply<DT> apply)
Create a
UnitPFBuilder with the first case statement set. |
<ET,DT extends D> |
matchEvent(java.lang.Class<ET> eventType,
java.lang.Class<DT> dataType,
FI.Apply2<ET,DT,FSM.State<S,D>> apply)
Create an
FSMStateFunctionBuilder with the first case statement set. |
<ET,DT extends D> |
matchEvent(java.lang.Class<ET> eventType,
java.lang.Class<DT> dataType,
FI.TypedPredicate2<ET,DT> predicate,
FI.Apply2<ET,DT,FSM.State<S,D>> apply)
Create an
FSMStateFunctionBuilder with the first case statement set. |
<ET> FSMStateFunctionBuilder<S,D> |
matchEvent(java.lang.Class<ET> eventType,
FI.Apply2<ET,D,FSM.State<S,D>> apply)
Create an
FSMStateFunctionBuilder with the first case statement set. |
<ET> FSMStateFunctionBuilder<S,D> |
matchEvent(java.lang.Class<ET> eventType,
FI.TypedPredicate2<ET,D> predicate,
FI.Apply2<ET,D,FSM.State<S,D>> apply)
Create an
FSMStateFunctionBuilder with the first case statement set. |
FSMStateFunctionBuilder<S,D> |
matchEvent(FI.TypedPredicate2<java.lang.Object,D> predicate,
FI.Apply2<java.lang.Object,D,FSM.State<S,D>> apply)
Create an
FSMStateFunctionBuilder with the first case statement set. |
<DT extends D> |
matchEvent(java.util.List<java.lang.Object> eventMatches,
java.lang.Class<DT> dataType,
FI.Apply2<java.lang.Object,DT,FSM.State<S,D>> apply)
Create an
FSMStateFunctionBuilder with the first case statement set. |
FSMStateFunctionBuilder<S,D> |
matchEvent(java.util.List<java.lang.Object> eventMatches,
FI.Apply2<java.lang.Object,D,FSM.State<S,D>> apply)
Create an
FSMStateFunctionBuilder with the first case statement set. |
<E,DT extends D> |
matchEventEquals(E event,
java.lang.Class<DT> dataType,
FI.Apply2<E,DT,FSM.State<S,D>> apply)
Create an
FSMStateFunctionBuilder with the first case statement set. |
<E> FSMStateFunctionBuilder<S,D> |
matchEventEquals(E event,
FI.Apply2<E,D,FSM.State<S,D>> apply)
Create an
FSMStateFunctionBuilder with the first case statement set. |
FSMTransitionHandlerBuilder<S> |
matchState(S fromState,
S toState,
FI.UnitApply2<S,S> apply)
Create an
FSMTransitionHandlerBuilder with the first case statement set. |
FSMTransitionHandlerBuilder<S> |
matchState(S fromState,
S toState,
FI.UnitApplyVoid apply)
Create an
FSMTransitionHandlerBuilder with the first case statement set. |
<RT extends FSM.Reason> |
matchStop(java.lang.Class<RT> reasonType,
FI.TypedPredicate<RT> predicate,
FI.UnitApply3<RT,S,D> apply)
Create an
FSMStopBuilder with the first case statement set. |
<RT extends FSM.Reason> |
matchStop(java.lang.Class<RT> reasonType,
FI.UnitApply3<RT,S,D> apply)
Create an
FSMStopBuilder with the first case statement set. |
FSMStopBuilder<S,D> |
matchStop(FSM.Reason reason,
FI.UnitApply2<S,D> apply)
Create an
FSMStopBuilder with the first case statement set. |
static D |
nextStateData() |
FSM.Reason |
Normal()
Default reason if calling
stop() . |
static <S,D> scala.PartialFunction<S,D> |
NullFunction()
A partial function value which does not match anything and can be used to
“reset”
whenUnhandled and onTermination handlers. |
void |
onTermination(FSMStopBuilder<S,D> stopBuilder)
Set handler which is called upon termination of this FSM actor.
|
void |
onTransition(FI.UnitApply2<S,S> transitionHandler)
Add a handler which is called upon each state transition, i.e.
|
void |
onTransition(FSMTransitionHandlerBuilder<S> transitionHandlerBuilder)
Add a handler which is called upon each state transition, i.e.
|
static void |
postRestart(java.lang.Throwable reason) |
static void |
postStop() |
static void |
preRestart(java.lang.Throwable reason,
scala.Option<java.lang.Object> message) |
static void |
preStart() |
static void |
processEvent(FSM.Event<D> event,
java.lang.Object source) |
static scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receive() |
ActorRef |
self()
The 'self' field holds the ActorRef for this actor.
|
static ActorRef |
sender() |
static void |
setStateTimeout(S state,
scala.Option<scala.concurrent.duration.FiniteDuration> timeout) |
void |
setTimer(java.lang.String name,
java.lang.Object msg,
scala.concurrent.duration.FiniteDuration timeout)
Schedule named timer to deliver message after given delay, possibly repeating.
|
static boolean |
setTimer$default$4() |
FSM.Reason |
Shutdown()
Reason given when someone was calling
system.stop(fsm) from outside;
also applies to Stop supervision directive. |
void |
startWith(S stateName,
D stateData)
Set initial state.
|
void |
startWith(S stateName,
D stateData,
scala.concurrent.duration.FiniteDuration timeout)
Set initial state.
|
static scala.Option<scala.concurrent.duration.FiniteDuration> |
startWith$default$3() |
static D |
stateData() |
static S |
stateName() |
FSM.StateTimeout$ |
StateTimeout()
This case object is received in case of a state timeout.
|
static FSM.State<S,D> |
stay() |
static FSM.State<S,D> |
stop() |
static FSM.State<S,D> |
stop(FSM.Reason reason) |
static FSM.State<S,D> |
stop(FSM.Reason reason,
D stateData) |
FSM.StopEvent$ |
StopEvent() |
static SupervisorStrategy |
supervisorStrategy() |
static scala.PartialFunction<scala.Tuple2<S,S>,scala.runtime.BoxedUnit> |
total2pf(scala.Function2<S,S,scala.runtime.BoxedUnit> transitionHandler) |
static FSM.TransformHelper |
transform(scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>> func) |
static void |
unhandled(java.lang.Object message) |
void |
when(S stateName,
scala.concurrent.duration.FiniteDuration stateTimeout,
FSMStateFunctionBuilder<S,D> stateFunctionBuilder)
Insert a new StateFunction at the end of the processing chain for the
given state.
|
void |
when(S stateName,
FSMStateFunctionBuilder<S,D> stateFunctionBuilder)
Insert a new StateFunction at the end of the processing chain for the
given state.
|
void |
when(S stateName,
scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>> stateFunction)
Insert a new StateFunction at the end of the processing chain for the
given state.
|
static scala.concurrent.duration.FiniteDuration |
when$default$2() |
void |
whenUnhandled(FSMStateFunctionBuilder<S,D> stateFunctionBuilder)
Set handler which is called upon reception of unhandled messages.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyState, cancelTimer, debugEvent, handleTransition, initialize, isStateTimerActive, isTimerActive, logTermination, makeTransition, nextStateData, onTermination, onTransition, postStop, processEvent, processMsg, receive, register, setStateTimeout, setTimer, startWith, stateData, stateName, stay, stop, stop, stop, terminate, total2pf, transform, when, whenUnhandled
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, postRestart, preRestart, preStart, sender, supervisorStrategy, unhandled
gossip, listenerManagement
log
public static <S,D> scala.PartialFunction<S,D> NullFunction()
whenUnhandled
and onTermination
handlers.
onTermination(FSM.NullFunction())
public static final ActorRef sender()
protected static void aroundReceive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive, java.lang.Object msg)
protected static void aroundPreStart()
protected static void aroundPostStop()
protected static void aroundPreRestart(java.lang.Throwable reason, scala.Option<java.lang.Object> message)
protected static void aroundPostRestart(java.lang.Throwable reason)
public static SupervisorStrategy supervisorStrategy()
public static void preStart() throws java.lang.Exception
java.lang.Exception
public static void preRestart(java.lang.Throwable reason, scala.Option<java.lang.Object> message) throws java.lang.Exception
java.lang.Exception
public static void postRestart(java.lang.Throwable reason) throws java.lang.Exception
java.lang.Exception
public static void unhandled(java.lang.Object message)
protected abstract static void akka$actor$Actor$_setter_$context_$eq(ActorContext x$1)
protected abstract static void akka$actor$Actor$_setter_$self_$eq(ActorRef x$1)
protected static scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> listenerManagement()
protected static void gossip(java.lang.Object msg, ActorRef sender)
protected static ActorRef gossip$default$2(java.lang.Object msg)
protected abstract static void akka$routing$Listeners$_setter_$listeners_$eq(java.util.Set<ActorRef> x$1)
public static LoggingAdapter akka$actor$ActorLogging$$_log()
public static void akka$actor$ActorLogging$$_log_$eq(LoggingAdapter x$1)
public static LoggingAdapter log()
public static FSM.$minus$greater$ $minus$greater()
public static final FSM.State<S,D> stay()
public static final FSM.State<S,D> stop()
public static final FSM.State<S,D> stop(FSM.Reason reason)
public static final FSM.State<S,D> stop(FSM.Reason reason, D stateData)
public static final FSM.TransformHelper transform(scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>> func)
public static final void cancelTimer(java.lang.String name)
public static final boolean isTimerActive(java.lang.String name)
public static final void setStateTimeout(S state, scala.Option<scala.concurrent.duration.FiniteDuration> timeout)
public static final boolean isStateTimerActive()
public static final scala.PartialFunction<scala.Tuple2<S,S>,scala.runtime.BoxedUnit> total2pf(scala.Function2<S,S,scala.runtime.BoxedUnit> transitionHandler)
public static final void initialize()
public static final S stateName()
public static final D stateData()
public static final D nextStateData()
public static boolean debugEvent()
public static FSM.State<S,D> akka$actor$FSM$$currentState()
public static void akka$actor$FSM$$currentState_$eq(FSM.State<S,D> x$1)
public static scala.Option<Cancellable> akka$actor$FSM$$timeoutFuture()
public static void akka$actor$FSM$$timeoutFuture_$eq(scala.Option<Cancellable> x$1)
public static FSM.State<S,D> akka$actor$FSM$$nextState()
public static void akka$actor$FSM$$nextState_$eq(FSM.State<S,D> x$1)
public static long akka$actor$FSM$$generation()
public static void akka$actor$FSM$$generation_$eq(long x$1)
public static scala.collection.mutable.Map<java.lang.String,FSM.Timer> akka$actor$FSM$$timers()
public static scala.collection.Iterator<java.lang.Object> akka$actor$FSM$$timerGen()
public static scala.collection.mutable.Map<S,scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>>> akka$actor$FSM$$stateFunctions()
public static scala.collection.mutable.Map<S,scala.Option<scala.concurrent.duration.FiniteDuration>> akka$actor$FSM$$stateTimeouts()
public static scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>> akka$actor$FSM$$handleEventDefault()
public static scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>> akka$actor$FSM$$handleEvent()
public static void akka$actor$FSM$$handleEvent_$eq(scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>> x$1)
public static scala.PartialFunction<FSM.StopEvent<S,D>,scala.runtime.BoxedUnit> akka$actor$FSM$$terminateEvent()
public static void akka$actor$FSM$$terminateEvent_$eq(scala.PartialFunction<FSM.StopEvent<S,D>,scala.runtime.BoxedUnit> x$1)
public static scala.collection.immutable.List<scala.PartialFunction<scala.Tuple2<S,S>,scala.runtime.BoxedUnit>> akka$actor$FSM$$transitionEvent()
public static void akka$actor$FSM$$transitionEvent_$eq(scala.collection.immutable.List<scala.PartialFunction<scala.Tuple2<S,S>,scala.runtime.BoxedUnit>> x$1)
public static scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
public static void processEvent(FSM.Event<D> event, java.lang.Object source)
public static void applyState(FSM.State<S,D> nextState)
public static void makeTransition(FSM.State<S,D> nextState)
public static void postStop()
protected static void logTermination(FSM.Reason reason)
public static final scala.concurrent.duration.FiniteDuration when$default$2()
public static final scala.Option<scala.concurrent.duration.FiniteDuration> startWith$default$3()
public static final boolean setTimer$default$4()
protected abstract static void akka$actor$FSM$_setter_$Event_$eq(FSM.Event$ x$1)
protected abstract static void akka$actor$FSM$_setter_$StopEvent_$eq(FSM.StopEvent$ x$1)
protected abstract static void akka$actor$FSM$_setter_$$minus$greater_$eq(FSM.$minus$greater$ x$1)
protected abstract static void akka$actor$FSM$_setter_$StateTimeout_$eq(FSM.StateTimeout$ x$1)
protected abstract static void akka$actor$FSM$_setter_$akka$actor$FSM$$timers_$eq(scala.collection.mutable.Map<java.lang.String,FSM.Timer> x$1)
protected abstract static void akka$actor$FSM$_setter_$akka$actor$FSM$$timerGen_$eq(scala.collection.Iterator<java.lang.Object> x$1)
protected abstract static void akka$actor$FSM$_setter_$akka$actor$FSM$$stateFunctions_$eq(scala.collection.mutable.Map<S,scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>>> x$1)
protected abstract static void akka$actor$FSM$_setter_$akka$actor$FSM$$stateTimeouts_$eq(scala.collection.mutable.Map<S,scala.Option<scala.concurrent.duration.FiniteDuration>> x$1)
protected abstract static void akka$actor$FSM$_setter_$akka$actor$FSM$$handleEventDefault_$eq(scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>> x$1)
public FSM.Event$ Event()
public FSM.StopEvent$ StopEvent()
public FSM.StateTimeout$ StateTimeout()
FSM
StateTimeout
in interface FSM<S,D>
protected java.util.Set<ActorRef> listeners()
public ActorContext context()
Actor
forward
.
WARNING: Only valid within the Actor itself, so do not close over it and publish it to other threads!
ActorContext
is the Scala API. getContext
returns a
UntypedActorContext
, which is the Java API of the actor
context.
public final ActorRef self()
Actor
self ! message
public final void when(S stateName, scala.PartialFunction<FSM.Event<D>,FSM.State<S,D>> stateFunction)
stateName
- designator for the statestateFunction
- partial function describing response to inputpublic final void when(S stateName, FSMStateFunctionBuilder<S,D> stateFunctionBuilder)
stateName
- designator for the statestateFunctionBuilder
- partial function builder describing response to inputpublic final void when(S stateName, scala.concurrent.duration.FiniteDuration stateTimeout, FSMStateFunctionBuilder<S,D> stateFunctionBuilder)
stateName
- designator for the statestateTimeout
- default state timeout for this statestateFunctionBuilder
- partial function builder describing response to inputpublic final void startWith(S stateName, D stateData)
initialize()
method.
If different state is needed after a restart this method, followed by initialize()
, can
be used in the actor life cycle hooks Actor.preStart()
and Actor.postRestart(java.lang.Throwable)
.
stateName
- initial state designatorstateData
- initial state datapublic final void startWith(S stateName, D stateData, scala.concurrent.duration.FiniteDuration timeout)
initialize()
method.
If different state is needed after a restart this method, followed by initialize()
, can
be used in the actor life cycle hooks Actor.preStart()
and Actor.postRestart(java.lang.Throwable)
.
stateName
- initial state designatorstateData
- initial state datatimeout
- state timeout for the initial state, overriding the default timeout for that statepublic final void onTransition(FSMTransitionHandlerBuilder<S> transitionHandlerBuilder)
Multiple handlers may be installed, and every one of them will be called, not only the first one matching.
transitionHandlerBuilder
- (undocumented)public final void onTransition(FI.UnitApply2<S,S> transitionHandler)
Multiple handlers may be installed, and every one of them will be called, not only the first one matching.
transitionHandler
- (undocumented)public final void whenUnhandled(FSMStateFunctionBuilder<S,D> stateFunctionBuilder)
The current state may be queried using stateName
.
stateFunctionBuilder
- (undocumented)public final void onTermination(FSMStopBuilder<S,D> stopBuilder)
stopBuilder
- (undocumented)public final <ET,DT extends D> FSMStateFunctionBuilder<S,D> matchEvent(java.lang.Class<ET> eventType, java.lang.Class<DT> dataType, FI.TypedPredicate2<ET,DT> predicate, FI.Apply2<ET,DT,FSM.State<S,D>> apply)
FSMStateFunctionBuilder
with the first case statement set.
A case statement that matches on an event and data type and a predicate.
eventType
- the event type to match ondataType
- the data type to match onpredicate
- a predicate to evaluate on the matched typesapply
- an action to apply to the event and state data if there is a matchpublic final <ET,DT extends D> FSMStateFunctionBuilder<S,D> matchEvent(java.lang.Class<ET> eventType, java.lang.Class<DT> dataType, FI.Apply2<ET,DT,FSM.State<S,D>> apply)
FSMStateFunctionBuilder
with the first case statement set.
A case statement that matches on an event and data type.
eventType
- the event type to match ondataType
- the data type to match onapply
- an action to apply to the event and state data if there is a matchpublic final <ET> FSMStateFunctionBuilder<S,D> matchEvent(java.lang.Class<ET> eventType, FI.TypedPredicate2<ET,D> predicate, FI.Apply2<ET,D,FSM.State<S,D>> apply)
FSMStateFunctionBuilder
with the first case statement set.
A case statement that matches if the event type and predicate matches.
eventType
- the event type to match onpredicate
- a predicate that will be evaluated on the data and the eventapply
- an action to apply to the event and state data if there is a matchpublic final <ET> FSMStateFunctionBuilder<S,D> matchEvent(java.lang.Class<ET> eventType, FI.Apply2<ET,D,FSM.State<S,D>> apply)
FSMStateFunctionBuilder
with the first case statement set.
A case statement that matches if the event type matches.
eventType
- the event type to match onapply
- an action to apply to the event and state data if there is a matchpublic final FSMStateFunctionBuilder<S,D> matchEvent(FI.TypedPredicate2<java.lang.Object,D> predicate, FI.Apply2<java.lang.Object,D,FSM.State<S,D>> apply)
FSMStateFunctionBuilder
with the first case statement set.
A case statement that matches if the predicate matches.
predicate
- a predicate that will be evaluated on the data and the eventapply
- an action to apply to the event and state data if there is a matchpublic final <DT extends D> FSMStateFunctionBuilder<S,D> matchEvent(java.util.List<java.lang.Object> eventMatches, java.lang.Class<DT> dataType, FI.Apply2<java.lang.Object,DT,FSM.State<S,D>> apply)
FSMStateFunctionBuilder
with the first case statement set.
A case statement that matches on the data type and if any of the event types in the list match or any of the event instances in the list compares equal.
eventMatches
- a list of types or instances to match againstdataType
- the data type to match onapply
- an action to apply to the event and state data if there is a matchpublic final FSMStateFunctionBuilder<S,D> matchEvent(java.util.List<java.lang.Object> eventMatches, FI.Apply2<java.lang.Object,D,FSM.State<S,D>> apply)
FSMStateFunctionBuilder
with the first case statement set.
A case statement that matches if any of the event types in the list match or any of the event instances in the list compares equal.
eventMatches
- a list of types or instances to match againstapply
- an action to apply to the event and state data if there is a matchpublic final <E,DT extends D> FSMStateFunctionBuilder<S,D> matchEventEquals(E event, java.lang.Class<DT> dataType, FI.Apply2<E,DT,FSM.State<S,D>> apply)
FSMStateFunctionBuilder
with the first case statement set.
A case statement that matches on the data type and if the event compares equal.
event
- an event to compare equal againstdataType
- the data type to match onapply
- an action to apply to the event and state data if there is a matchpublic final <E> FSMStateFunctionBuilder<S,D> matchEventEquals(E event, FI.Apply2<E,D,FSM.State<S,D>> apply)
FSMStateFunctionBuilder
with the first case statement set.
A case statement that matches if the event compares equal.
event
- an event to compare equal againstapply
- an action to apply to the event and state data if there is a matchpublic final FSMStateFunctionBuilder<S,D> matchAnyEvent(FI.Apply2<java.lang.Object,D,FSM.State<S,D>> apply)
FSMStateFunctionBuilder
with the first case statement set.
A case statement that matches on any type of event.
apply
- an action to apply to the event and state data if there is a matchpublic final FSMTransitionHandlerBuilder<S> matchState(S fromState, S toState, FI.UnitApplyVoid apply)
FSMTransitionHandlerBuilder
with the first case statement set.
A case statement that matches on a from state and a to state.
fromState
- the from state to match ontoState
- the to state to match onapply
- an action to apply when the states matchpublic final FSMTransitionHandlerBuilder<S> matchState(S fromState, S toState, FI.UnitApply2<S,S> apply)
FSMTransitionHandlerBuilder
with the first case statement set.
A case statement that matches on a from state and a to state.
fromState
- the from state to match ontoState
- the to state to match onapply
- an action to apply when the states matchpublic final FSMStopBuilder<S,D> matchStop(FSM.Reason reason, FI.UnitApply2<S,D> apply)
FSMStopBuilder
with the first case statement set.
A case statement that matches on an FSM.Reason
.
reason
- the reason for the terminationapply
- an action to apply to the event and state data if there is a matchpublic final <RT extends FSM.Reason> FSMStopBuilder<S,D> matchStop(java.lang.Class<RT> reasonType, FI.UnitApply3<RT,S,D> apply)
FSMStopBuilder
with the first case statement set.
A case statement that matches on a reason type.
reasonType
- the reason type to match onapply
- an action to apply to the reason, event and state data if there is a matchpublic final <RT extends FSM.Reason> FSMStopBuilder<S,D> matchStop(java.lang.Class<RT> reasonType, FI.TypedPredicate<RT> predicate, FI.UnitApply3<RT,S,D> apply)
FSMStopBuilder
with the first case statement set.
A case statement that matches on a reason type and a predicate.
reasonType
- the reason type to match onapply
- an action to apply to the reason, event and state data if there is a matchpredicate
- a predicate that will be evaluated on the reason if the type matchespublic final <DT extends D> UnitPFBuilder<D> matchData(java.lang.Class<DT> dataType, FI.UnitApply<DT> apply)
UnitPFBuilder
with the first case statement set.
dataType
- a type to match the argument againstapply
- an action to apply to the argument if the type matchespublic final <DT extends D> UnitPFBuilder<D> matchData(java.lang.Class<DT> dataType, FI.TypedPredicate<DT> predicate, FI.UnitApply<DT> apply)
UnitPFBuilder
with the first case statement set.
dataType
- a type to match the argument againstpredicate
- a predicate that will be evaluated on the argument if the type matchesapply
- an action to apply to the argument if the type and predicate matchespublic final FSM.State<S,D> goTo(S nextStateName)
nextStateName
- state designator for the next statepublic final void setTimer(java.lang.String name, java.lang.Object msg, scala.concurrent.duration.FiniteDuration timeout)
name
- identifier to be used with cancelTimer()msg
- message to be deliveredtimeout
- delay of first message delivery and between subsequent messagespublic FSM.Reason Normal()
stop()
.public FSM.Reason Shutdown()
system.stop(fsm)
from outside;
also applies to Stop
supervision directive.