TransitionDefinition<E extends Event> class
abstract
Defines FSM transition: the change from one state to another.
Constructors
-
TransitionDefinition(StateDefinition<
State> fromStateDefinition, {GuardCondition<E> condition = noopGuardCondition, SideEffect<E> ? sideEffect, String? conditionLabel, String? sideEffectLabel})
Properties
-
condition
→ GuardCondition<
E> -
The condition that must be met for this TransitionDefinition
to be triggered.
If condition is null then it always evaluates to true and the
event will be triggered. Null conditions are always the last condition
to be evaulated against an event, so any other condition
that returns true
will be fired in preference to a null condition.
final
- conditionLabel → String?
-
An optional label used only on the exported diagrams to
given the condition
a descriptive label. @See label
final
-
fromStateDefinition
→ StateDefinition<
State> -
The state this transition is attached to.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- label → String
-
Returns a transition label for use on exported diagrams. The
label takes the standard UML2 form of:
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sideEffect
→ SideEffect<
E> ? -
The
SideEffect
function to call when this choice is selected as the transition.final - sideEffectLabel → String?
-
An optional label used only on the exported diagrams to
given the sideEffect
a descriptive label. @See label
final
-
targetStates
→ List<
Type> -
list of the target states the will be transitioned into.
no setter
-
triggerEvents
→ List<
Type> -
The list of events that this transition will trigger on.
Whether the events are and/or'ed together is an
implementation detail of the TransitionDefinition implementation.
no setter
Methods
-
canTrigger(
E event) → bool - Used by onJoin and the likes to suppress a trigger if not all pre-conditions have been met.
-
dedupPaths(
List< PartialStatePath> paths) → List<StateDefinition< State> > -
Takes a list of
PartialStatePath
s and returns an ordered list of states from the leaf on the longest branch. It is expected that the partial paths are all relative to a common ancestor. We also dedup the States as we build the path. -
findCommonAncestor(
Graph graph, StatePath fromAncestors, StatePath toAncestors) → StateDefinition< State> ? -
Walks up the tree looking for an ancestor that is common
to the
fromAncestors
andtoAncestors
paths. -
labelForEvent(
Type event) → String - Returns a transition label for use on exported diagrams. The label takes the standard UML2 form of:
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
transitions(
Graph graph, StateDefinition< State> ? from, Event event) → List<TransitionNotification< Event> > - list of transitions that this definition will cause when triggered.
-
trigger(
Graph graph, StateOfMind stateOfMind, TransitionNotification< E> transition, {required bool applySideEffects}) → Future<StateOfMind> -
Applies
transition
to the current statemachine and returns the resultingStateOfMind
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited