Update docs

- Relates to #194
This commit is contained in:
Janne Valkealahti
2016-04-22 13:35:38 +01:00
parent 1adca702f6
commit 3d41bef524
3 changed files with 56 additions and 9 deletions

View File

@@ -110,12 +110,23 @@ sub-machines.
A pseudo state which allows to make a transition choice based of i.e.
event headers or extended state variables.
*Junction State*::
A pseudo state which is relatively similar to choice state but allows
multiple incoming transitions while choice only allows one incoming
transition.
*Fork State*::
A pseudo state which gives a controlled entry into a regions.
*Join State*::
A pseudo state which gives a controlled exit from a regions.
*Entry Point*::
A pseudo state which allows a controlled entry into a submachine.
*Exit Point*::
A pseudo state which allows a controlled exit from a submachine.
*Region*::
A region is an orthogonal part of either a composite state or a state
machine. It contains states and transitions.
@@ -183,6 +194,14 @@ simple if/elseif/else structure is used to make sure that at least one
branch is selected. Otherwise state machine might end up in a deadlock
and configuration would be ill-formed.
===== Junction
*Junction pseudostate* is functionally similar than choice as both are
implemented with if/elseif/else structure. Only real difference is
that junction allows multiple incoming transitions while choice only
allows one. Thus difference is purely academic but have some
differences i.e. when state machine is designed using real UI modeling
framework.
===== History
*History pseudostate* can be used to remember a last active state
configuration. After state machine has been exited, history state can
@@ -198,6 +217,17 @@ makes things much simpler. What is left for user to do is simply do a
transition into a history state and state machine will hand the needed
logic to go back to its last known recorded state.
In cases where a Transition terminates on a history state when the state
has not been entered before (i.e., no prior history) or it had reached its
End State, there is an option to force a transition to a specific substate,
using the default history mechanism. This is a Transition that originates
in the history state and terminates on a specific Vertex (the default history
state) of the Region containing the history state. This Transition is only
taken if execution leads to the history tate and the state had never been
active before. Otherwise, the normal history entry into the Region is executed.
If no default history transition is defined, then standard default entry of
the region is performed.
===== Fork
*Fork pseudostate* can be used to do an explicit entry into one or more regions.

View File

@@ -238,6 +238,14 @@ You need to choose its state identifier and `History.SHALLOW` or
include::samples/DocsConfigurationSampleTests.java[tags=snippetR]
----
Also as shown above, optionally it is possible to define a default
transition from a history state into a state vertex in a same machine.
This transition takes place as a default if for example machine has
never been entered, thus no history would be available. If default
state transition is not defined, then normal entry into a region is
done. This default transition is also used if machine's history is
a final state.
==== Choice State
Choice needs to be defined in both states and transitions to work
properly. Mark particular state as choice state by using `choice()`

View File

@@ -537,16 +537,25 @@ public class DocsConfigurationSampleTests extends AbstractStateMachineTests {
public void configure(StateMachineStateConfigurer<States3, Events> states)
throws Exception {
states
.withStates()
.initial(States3.S1)
.state(States3.S2)
.and()
.withStates()
.parent(States3.S2)
.initial(States3.S2I)
.state(States3.S21)
.state(States3.S22)
.history(States3.SH, History.SHALLOW);
.initial(States3.S1)
.state(States3.S2)
.and()
.withStates()
.parent(States3.S2)
.initial(States3.S2I)
.state(States3.S21)
.state(States3.S22)
.history(States3.SH, History.SHALLOW);
}
@Override
public void configure(StateMachineTransitionConfigurer<States3, Events> transitions)
throws Exception {
transitions
.withHistory()
.source(States3.SH)
.target(States3.S22);
}
}