Fix local transition logic

- Add missing creating of a local transition
- Fix logic how entry/exit is not called with local
- Add tests comparing functionality with external
- Fixes #248
- Fixes #249
This commit is contained in:
Janne Valkealahti
2016-09-11 10:25:05 +01:00
parent e6f10b60f5
commit 25e190c57d
10 changed files with 975 additions and 6 deletions

View File

@@ -78,6 +78,7 @@ import org.springframework.statemachine.support.tree.TreeTraverser;
import org.springframework.statemachine.support.tree.Tree.Node;
import org.springframework.statemachine.transition.DefaultExternalTransition;
import org.springframework.statemachine.transition.DefaultInternalTransition;
import org.springframework.statemachine.transition.DefaultLocalTransition;
import org.springframework.statemachine.transition.InitialTransition;
import org.springframework.statemachine.transition.Transition;
import org.springframework.statemachine.transition.TransitionKind;
@@ -716,6 +717,15 @@ public abstract class AbstractStateMachineFactory<S, E> extends LifecycleObjectS
transitionData.getSecurityRule(), transitionData.getErrorAction());
transitions.add(transition);
} else if (transitionData.getKind() == TransitionKind.LOCAL) {
// TODO can we do this?
if (stateMap.get(source) == null || stateMap.get(target) == null) {
continue;
}
DefaultLocalTransition<S, E> transition = new DefaultLocalTransition<S, E>(stateMap.get(source),
stateMap.get(target), transitionData.getActions(), event, transitionData.getGuard(), trigger,
transitionData.getSecurityRule(), transitionData.getErrorAction());
transitions.add(transition);
} else if (transitionData.getKind() == TransitionKind.INTERNAL) {
DefaultInternalTransition<S, E> transition = new DefaultInternalTransition<S, E>(stateMap.get(source),
transitionData.getActions(), event, transitionData.getGuard(), trigger,

View File

@@ -207,6 +207,17 @@ public class StateMachineState<S, E> extends AbstractState<S, E> {
((StateMachineState<S, E>) immediateDeepParent).getSubmachine().getStateMachineAccessor()
.doWithRegion(new StateMachineFunction<StateMachineAccess<S, E>>() {
@Override
public void apply(StateMachineAccess<S, E> function) {
function.setInitialEnabled(false);
}
});
}
if (immediateDeepParent == null && getSubmachine().getStates().contains(target) && !isInitial(target)
&& StateMachineUtils.isSubstate(context.getTransition().getSource(), context.getTransition().getTarget())) {
getSubmachine().getStateMachineAccessor().doWithRegion(
new StateMachineFunction<StateMachineAccess<S, E>>() {
@Override
public void apply(StateMachineAccess<S, E> function) {
function.setInitialEnabled(false);

View File

@@ -867,7 +867,6 @@ public abstract class AbstractStateMachine<S, E> extends StateMachineObjectSuppo
synchronized void setCurrentState(State<S, E> state, Message<E> message, Transition<S, E> transition, boolean exit,
StateMachine<S, E> stateMachine, Collection<State<S, E>> sources, Collection<State<S, E>> targets) {
State<S, E> findDeep = findDeepParent(state);
boolean isTargetSubOf = false;
if (transition != null) {
@@ -1026,6 +1025,12 @@ public abstract class AbstractStateMachine<S, E> extends StateMachineObjectSuppo
boolean isSubOfSource = StateMachineUtils.isSubstate(transition.getSource(), currentState);
boolean isSubOfTarget = StateMachineUtils.isSubstate(transition.getTarget(), currentState);
if (transition.getKind() == TransitionKind.LOCAL && StateMachineUtils.isSubstate(transition.getSource(), transition.getTarget()) && transition.getSource() == currentState) {
return;
} else if (transition.getKind() == TransitionKind.LOCAL && StateMachineUtils.isSubstate(transition.getTarget(), transition.getSource()) && transition.getTarget() == currentState) {
return;
}
// TODO: this and entry below should be done via a separate
// voter of some sort which would reveal transition path
// we could make a choice on.
@@ -1083,15 +1088,26 @@ public abstract class AbstractStateMachine<S, E> extends StateMachineObjectSuppo
boolean isSubOfSource = StateMachineUtils.isSubstate(transition.getSource(), currentState);
boolean isSubOfTarget = StateMachineUtils.isSubstate(transition.getTarget(), currentState);
if (transition.getKind() == TransitionKind.LOCAL && StateMachineUtils.isSubstate(transition.getSource(), transition.getTarget())
&& transition.getSource() == currentState) {
return;
} else if (transition.getKind() == TransitionKind.LOCAL && StateMachineUtils.isSubstate(transition.getTarget(), transition.getSource())
&& transition.getTarget() == currentState) {
return;
}
if (currentState == transition.getSource() && currentState == transition.getTarget()) {
} else if (!isSubOfSource && !isSubOfTarget && currentState == transition.getTarget()) {
} else if (isComingFromOtherSubmachine) {
} else if (!isSubOfSource && !isSubOfTarget && findDeep2 == null) {
} else if (isSubOfSource && !isSubOfTarget && currentState == transition.getTarget()) {
if (isDirectSubstate(transition.getSource(), transition.getTarget())) {
if (isDirectSubstate(transition.getSource(), transition.getTarget()) && transition.getKind() != TransitionKind.LOCAL
&& isInitial(transition.getTarget())) {
return;
}
} else if (!isSubOfSource && !isSubOfTarget && (transition.getSource() == currentState && StateMachineUtils.isSubstate(currentState, transition.getTarget()))) {
} else if (!isSubOfSource && !isSubOfTarget
&& (transition.getSource() == currentState && StateMachineUtils.isSubstate(currentState, transition.getTarget()))) {
} else if (!isSubOfSource && !isSubOfTarget) {
return;
}
@@ -1102,6 +1118,10 @@ public abstract class AbstractStateMachine<S, E> extends StateMachineObjectSuppo
state.entry(stateContext);
}
private static <S, E> boolean isInitial(State<S, E> state) {
return state.getPseudoState() != null && state.getPseudoState().getKind() == PseudoStateKind.INITIAL;
}
private static <S, E> boolean isDirectSubstate(State<S, E> left, State<S, E> right) {
// Checks if right hand side is a direct substate of a left hand side.
if (left != null && left.isSubmachineState()) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,15 +19,22 @@ import java.util.Collection;
import org.springframework.statemachine.action.Action;
import org.springframework.statemachine.guard.Guard;
import org.springframework.statemachine.security.SecurityRule;
import org.springframework.statemachine.state.State;
import org.springframework.statemachine.trigger.Trigger;
public class DefaultLocalTransition<S, E> extends AbstractLocalTransition<S, E> {
public DefaultLocalTransition(State<S,E> source, State<S,E> target, Collection<Action<S, E>> actions, E event, Guard<S, E> guard, Trigger<S, E> trigger) {
public DefaultLocalTransition(State<S, E> source, State<S, E> target, Collection<Action<S, E>> actions, E event, Guard<S, E> guard,
Trigger<S, E> trigger) {
super(source, target, actions, event, guard, trigger);
}
public DefaultLocalTransition(State<S, E> source, State<S, E> target, Collection<Action<S, E>> actions, E event,
Guard<S, E> guard, Trigger<S, E> trigger, SecurityRule securityRule, Action<S, E> errorAction) {
super(source, target, actions, event, guard, trigger, securityRule, errorAction);
}
@Override
public String toString() {
return "DefaultLocalTransition [getSource()=" + getSource() + ", getTarget()=" + getTarget() + "]";

View File

@@ -351,7 +351,7 @@ public class SubStateMachineTests extends AbstractStateMachineTests {
assertThat(entryActionS111.stateContexts.size(), is(2));
assertThat(exitActionS111.stateContexts.size(), is(1));
assertThat(entryActionS11.stateContexts.size(), is(2));
assertThat(entryActionS11.stateContexts.size(), is(1));
assertThat(exitActionS11.stateContexts.size(), is(1));
assertThat(entryActionS1.stateContexts.size(), is(1));
assertThat(exitActionS1.stateContexts.size(), is(0));

View File

@@ -0,0 +1,335 @@
/*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.statemachine.transition;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.statemachine.AbstractStateMachineTests;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineSystemConstants;
import org.springframework.statemachine.config.EnableStateMachine;
import org.springframework.statemachine.config.StateMachineConfigurerAdapter;
import org.springframework.statemachine.config.builders.StateMachineStateConfigurer;
import org.springframework.statemachine.config.builders.StateMachineTransitionConfigurer;
import org.springframework.statemachine.listener.StateMachineListenerAdapter;
import org.springframework.statemachine.state.State;
@SuppressWarnings("unchecked")
public class LocalTransitionTests extends AbstractStateMachineTests {
@Test
public void testExternalSuperDoesEntryExitToSub() {
context.register(Config1.class);
context.refresh();
assertTrue(context.containsBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE));
StateMachine<String, String> machine =
context.getBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE, StateMachine.class);
assertThat(machine, notNullValue());
TestListener listener = new TestListener();
machine.addStateListener(listener);
machine.start();
machine.sendEvent("E1");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
machine.sendEvent("E20");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S21"));
assertThat(listener.exited.size(), is(2));
assertThat(listener.entered.size(), is(2));
assertThat(listener.exited, containsInAnyOrder("S2", "S21"));
assertThat(listener.entered, containsInAnyOrder("S2", "S21"));
}
@Test
public void testLocalSuperDoesNotEntryExitToSub() {
context.register(Config1.class);
context.refresh();
assertTrue(context.containsBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE));
StateMachine<String, String> machine =
context.getBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE, StateMachine.class);
assertThat(machine, notNullValue());
TestListener listener = new TestListener();
machine.addStateListener(listener);
machine.start();
machine.sendEvent("E1");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
machine.sendEvent("E30");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S21"));
assertThat(listener.exited.size(), is(1));
assertThat(listener.entered.size(), is(1));
assertThat(listener.exited, containsInAnyOrder("S21"));
assertThat(listener.entered, containsInAnyOrder("S21"));
}
@Test
public void testExternalToNonInitialSuperDoesEntryExitToSub() {
context.register(Config1.class);
context.refresh();
assertTrue(context.containsBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE));
StateMachine<String, String> machine =
context.getBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE, StateMachine.class);
assertThat(machine, notNullValue());
TestListener listener = new TestListener();
machine.addStateListener(listener);
machine.start();
machine.sendEvent("E1");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
machine.sendEvent("E21");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S22"));
assertThat(listener.exited.size(), is(2));
assertThat(listener.entered.size(), is(2));
assertThat(listener.exited, containsInAnyOrder("S2", "S21"));
assertThat(listener.entered, containsInAnyOrder("S2", "S22"));
}
@Test
public void testLocalToNonInitialSuperDoesNotEntryExitToSub() {
context.register(Config1.class);
context.refresh();
assertTrue(context.containsBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE));
StateMachine<String, String> machine =
context.getBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE, StateMachine.class);
assertThat(machine, notNullValue());
TestListener listener = new TestListener();
machine.addStateListener(listener);
machine.start();
machine.sendEvent("E1");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
machine.sendEvent("E31");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S22"));
assertThat(listener.exited.size(), is(1));
assertThat(listener.entered.size(), is(1));
assertThat(listener.exited, containsInAnyOrder("S21"));
assertThat(listener.entered, containsInAnyOrder("S22"));
}
@Test
public void testExternalSuperDoesEntryExitToParent() {
context.register(Config1.class);
context.refresh();
assertTrue(context.containsBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE));
StateMachine<String, String> machine =
context.getBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE, StateMachine.class);
assertThat(machine, notNullValue());
TestListener listener = new TestListener();
machine.addStateListener(listener);
machine.start();
machine.sendEvent("E1");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
machine.sendEvent("E22");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S21"));
assertThat(listener.exited.size(), is(2));
assertThat(listener.entered.size(), is(2));
assertThat(listener.exited, containsInAnyOrder("S2", "S21"));
assertThat(listener.entered, containsInAnyOrder("S2", "S21"));
}
@Test
public void testLocalSuperDoesNotEntryExitToParent() {
context.register(Config1.class);
context.refresh();
assertTrue(context.containsBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE));
StateMachine<String, String> machine =
context.getBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE, StateMachine.class);
assertThat(machine, notNullValue());
TestListener listener = new TestListener();
machine.addStateListener(listener);
machine.start();
machine.sendEvent("E1");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
machine.sendEvent("E32");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S21"));
assertThat(listener.exited.size(), is(1));
assertThat(listener.entered.size(), is(1));
assertThat(listener.exited, containsInAnyOrder("S21"));
assertThat(listener.entered, containsInAnyOrder("S21"));
}
@Test
public void testExternalToNonInitialSuperDoesEntryExitToParent() {
context.register(Config1.class);
context.refresh();
assertTrue(context.containsBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE));
StateMachine<String, String> machine =
context.getBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE, StateMachine.class);
assertThat(machine, notNullValue());
TestListener listener = new TestListener();
machine.addStateListener(listener);
machine.start();
machine.sendEvent("E1");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
machine.sendEvent("E21");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S22"));
assertThat(listener.exited.size(), is(2));
assertThat(listener.entered.size(), is(2));
assertThat(listener.exited, containsInAnyOrder("S2", "S21"));
assertThat(listener.entered, containsInAnyOrder("S2", "S22"));
listener.reset();
machine.sendEvent("E23");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S22"));
assertThat(listener.exited.size(), is(2));
assertThat(listener.entered.size(), is(2));
assertThat(listener.exited, containsInAnyOrder("S2", "S22"));
assertThat(listener.entered, containsInAnyOrder("S2", "S22"));
}
@Test
public void testLocalToNonInitialSuperDoesNotEntryExitToParent() {
context.register(Config1.class);
context.refresh();
assertTrue(context.containsBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE));
StateMachine<String, String> machine =
context.getBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE, StateMachine.class);
assertThat(machine, notNullValue());
TestListener listener = new TestListener();
machine.addStateListener(listener);
machine.start();
machine.sendEvent("E1");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
machine.sendEvent("E31");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S22"));
assertThat(listener.exited.size(), is(1));
assertThat(listener.entered.size(), is(1));
assertThat(listener.exited, containsInAnyOrder("S21"));
assertThat(listener.entered, containsInAnyOrder("S22"));
listener.reset();
machine.sendEvent("E33");
assertThat(machine.getState().getIds(), containsInAnyOrder("S2", "S22"));
assertThat(listener.exited.size(), is(1));
assertThat(listener.entered.size(), is(1));
assertThat(listener.exited, containsInAnyOrder("S22"));
assertThat(listener.entered, containsInAnyOrder("S22"));
}
@Configuration
@EnableStateMachine
static class Config1 extends StateMachineConfigurerAdapter<String, String> {
@Override
public void configure(StateMachineStateConfigurer<String, String> states) throws Exception {
states
.withStates()
.initial("S1")
.state("S2")
.and()
.withStates()
.parent("S2")
.initial("S21")
.state("S22");
}
@Override
public void configure(StateMachineTransitionConfigurer<String, String> transitions) throws Exception {
transitions
.withExternal()
.source("S1")
.target("S2")
.event("E1")
.and()
.withExternal()
.source("S2")
.target("S21")
.event("E20")
.and()
.withExternal()
.source("S2")
.target("S22")
.event("E21")
.and()
.withExternal()
.source("S21")
.target("S2")
.event("E22")
.and()
.withExternal()
.source("S22")
.target("S2")
.event("E23")
.and()
.withLocal()
.source("S2")
.target("S21")
.event("E30")
.and()
.withLocal()
.source("S2")
.target("S22")
.event("E31")
.and()
.withLocal()
.source("S21")
.target("S2")
.event("E32")
.and()
.withLocal()
.source("S22")
.target("S2")
.event("E33");
}
}
private static class TestListener extends StateMachineListenerAdapter<String, String> {
final ArrayList<String> entered = new ArrayList<>();
final ArrayList<String> exited = new ArrayList<>();
@Override
public void stateEntered(State<String, String> state) {
entered.add(state.getId());
}
@Override
public void stateExited(State<String, String> state) {
exited.add(state.getId());
}
public void reset() {
entered.clear();
exited.clear();
}
}
@Override
protected AnnotationConfigApplicationContext buildContext() {
return new AnnotationConfigApplicationContext();
}
}

View File

@@ -22,6 +22,7 @@ import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -45,7 +46,9 @@ import org.springframework.statemachine.config.model.StateMachineModel;
import org.springframework.statemachine.config.model.StateMachineModelFactory;
import org.springframework.statemachine.config.model.TransitionData;
import org.springframework.statemachine.guard.Guard;
import org.springframework.statemachine.listener.StateMachineListenerAdapter;
import org.springframework.statemachine.state.PseudoStateKind;
import org.springframework.statemachine.state.State;
import org.springframework.statemachine.transition.TransitionKind;
import org.springframework.util.ObjectUtils;
@@ -676,6 +679,198 @@ public class UmlStateMachineModelFactoryTests extends AbstractUmlTests {
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S3"));
}
@Test
@SuppressWarnings("unchecked")
public void testSimpleLocaltransitionExternalSuperDoesEntryExitToSub() {
context.register(Config23.class);
context.refresh();
StateMachine<String, String> stateMachine = context.getBean(StateMachine.class);
assertThat(stateMachine, notNullValue());
TestListener listener = new TestListener();
stateMachine.addStateListener(listener);
stateMachine.start();
stateMachine.sendEvent("E1");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
stateMachine.sendEvent("E20");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S21"));
assertThat(listener.exited.size(), is(2));
assertThat(listener.entered.size(), is(2));
assertThat(listener.exited, containsInAnyOrder("S2", "S21"));
assertThat(listener.entered, containsInAnyOrder("S2", "S21"));
}
@Test
@SuppressWarnings("unchecked")
public void testSimpleLocaltransitionLocalSuperDoesNotEntryExitToSub() {
context.register(Config23.class);
context.refresh();
StateMachine<String, String> stateMachine = context.getBean(StateMachine.class);
assertThat(stateMachine, notNullValue());
TestListener listener = new TestListener();
stateMachine.addStateListener(listener);
stateMachine.start();
stateMachine.sendEvent("E1");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
stateMachine.sendEvent("E30");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S21"));
assertThat(listener.exited.size(), is(1));
assertThat(listener.entered.size(), is(1));
assertThat(listener.exited, containsInAnyOrder("S21"));
assertThat(listener.entered, containsInAnyOrder("S21"));
}
@Test
@SuppressWarnings("unchecked")
public void testSimpleLocaltransitionExternalToNonInitialSuperDoesEntryExitToSub() {
context.register(Config23.class);
context.refresh();
StateMachine<String, String> stateMachine = context.getBean(StateMachine.class);
assertThat(stateMachine, notNullValue());
TestListener listener = new TestListener();
stateMachine.addStateListener(listener);
stateMachine.start();
stateMachine.sendEvent("E1");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
stateMachine.sendEvent("E21");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S22"));
assertThat(listener.exited.size(), is(2));
assertThat(listener.entered.size(), is(2));
assertThat(listener.exited, containsInAnyOrder("S2", "S21"));
assertThat(listener.entered, containsInAnyOrder("S2", "S22"));
}
@Test
@SuppressWarnings("unchecked")
public void testSimpleLocaltransitionLocalToNonInitialSuperDoesNotEntryExitToSub() {
context.register(Config23.class);
context.refresh();
StateMachine<String, String> stateMachine = context.getBean(StateMachine.class);
assertThat(stateMachine, notNullValue());
TestListener listener = new TestListener();
stateMachine.addStateListener(listener);
stateMachine.start();
stateMachine.sendEvent("E1");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
stateMachine.sendEvent("E31");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S22"));
assertThat(listener.exited.size(), is(1));
assertThat(listener.entered.size(), is(1));
assertThat(listener.exited, containsInAnyOrder("S21"));
assertThat(listener.entered, containsInAnyOrder("S22"));
}
@Test
@SuppressWarnings("unchecked")
public void testSimpleLocaltransitionExternalSuperDoesEntryExitToParent() {
context.register(Config23.class);
context.refresh();
StateMachine<String, String> stateMachine = context.getBean(StateMachine.class);
assertThat(stateMachine, notNullValue());
TestListener listener = new TestListener();
stateMachine.addStateListener(listener);
stateMachine.start();
stateMachine.sendEvent("E1");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
stateMachine.sendEvent("E22");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S21"));
assertThat(listener.exited.size(), is(2));
assertThat(listener.entered.size(), is(2));
assertThat(listener.exited, containsInAnyOrder("S2", "S21"));
assertThat(listener.entered, containsInAnyOrder("S2", "S21"));
}
@Test
@SuppressWarnings("unchecked")
public void testSimpleLocaltransitionLocalSuperDoesNotEntryExitToParent() {
context.register(Config23.class);
context.refresh();
StateMachine<String, String> stateMachine = context.getBean(StateMachine.class);
assertThat(stateMachine, notNullValue());
TestListener listener = new TestListener();
stateMachine.addStateListener(listener);
stateMachine.start();
stateMachine.sendEvent("E1");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
stateMachine.sendEvent("E32");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S21"));
assertThat(listener.exited.size(), is(1));
assertThat(listener.entered.size(), is(1));
assertThat(listener.exited, containsInAnyOrder("S21"));
assertThat(listener.entered, containsInAnyOrder("S21"));
}
@Test
@SuppressWarnings("unchecked")
public void testSimpleLocaltransitionExternalToNonInitialSuperDoesEntryExitToParent() {
context.register(Config23.class);
context.refresh();
StateMachine<String, String> stateMachine = context.getBean(StateMachine.class);
assertThat(stateMachine, notNullValue());
TestListener listener = new TestListener();
stateMachine.addStateListener(listener);
stateMachine.start();
stateMachine.sendEvent("E1");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
stateMachine.sendEvent("E21");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S22"));
assertThat(listener.exited.size(), is(2));
assertThat(listener.entered.size(), is(2));
assertThat(listener.exited, containsInAnyOrder("S2", "S21"));
assertThat(listener.entered, containsInAnyOrder("S2", "S22"));
listener.reset();
stateMachine.sendEvent("E23");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S22"));
assertThat(listener.exited.size(), is(2));
assertThat(listener.entered.size(), is(2));
assertThat(listener.exited, containsInAnyOrder("S2", "S22"));
assertThat(listener.entered, containsInAnyOrder("S2", "S22"));
}
@Test
@SuppressWarnings("unchecked")
public void testSimpleLocaltransitionLocalToNonInitialSuperDoesNotEntryExitToParent() {
context.register(Config23.class);
context.refresh();
StateMachine<String, String> stateMachine = context.getBean(StateMachine.class);
assertThat(stateMachine, notNullValue());
TestListener listener = new TestListener();
stateMachine.addStateListener(listener);
stateMachine.start();
stateMachine.sendEvent("E1");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S21"));
listener.reset();
stateMachine.sendEvent("E31");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S22"));
assertThat(listener.exited.size(), is(1));
assertThat(listener.entered.size(), is(1));
assertThat(listener.exited, containsInAnyOrder("S21"));
assertThat(listener.entered, containsInAnyOrder("S22"));
listener.reset();
stateMachine.sendEvent("E33");
assertThat(stateMachine.getState().getIds(), containsInAnyOrder("S2", "S22"));
assertThat(listener.exited.size(), is(1));
assertThat(listener.entered.size(), is(1));
assertThat(listener.exited, containsInAnyOrder("S22"));
assertThat(listener.entered, containsInAnyOrder("S22"));
}
@Configuration
@EnableStateMachine
public static class Config2 extends StateMachineConfigurerAdapter<String, String> {
@@ -1113,6 +1308,23 @@ public class UmlStateMachineModelFactoryTests extends AbstractUmlTests {
}
}
@Configuration
@EnableStateMachine
public static class Config23 extends StateMachineConfigurerAdapter<String, String> {
@Override
public void configure(StateMachineModelConfigurer<String, String> model) throws Exception {
model
.withModel()
.factory(modelFactory());
}
@Bean
public StateMachineModelFactory<String, String> modelFactory() {
return new UmlStateMachineModelFactory("classpath:org/springframework/statemachine/uml/simple-localtransition.uml");
}
}
public static class LatchAction implements Action<String, String> {
CountDownLatch latch = new CountDownLatch(1);
@Override
@@ -1163,4 +1375,25 @@ public class UmlStateMachineModelFactoryTests extends AbstractUmlTests {
return ObjectUtils.nullSafeEquals(match, context.getMessageHeaders().get("junction", String.class));
}
}
private static class TestListener extends StateMachineListenerAdapter<String, String> {
final ArrayList<String> entered = new ArrayList<>();
final ArrayList<String> exited = new ArrayList<>();
@Override
public void stateEntered(State<String, String> state) {
entered.add(state.getId());
}
@Override
public void stateExited(State<String, String> state) {
exited.add(state.getId());
}
public void reset() {
entered.clear();
exited.clear();
}
}
}

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>

View File

@@ -0,0 +1,288 @@
<?xml version="1.0" encoding="UTF-8"?>
<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_oSG3IHdMEeatx8P6oLVEqg" type="PapyrusUMLStateMachineDiagram" name="StateMachine Diagram" measurementUnit="Pixel">
<children xmi:type="notation:Shape" xmi:id="_oSG3IXdMEeatx8P6oLVEqg" type="2000">
<children xmi:type="notation:DecorationNode" xmi:id="_oSG3IndMEeatx8P6oLVEqg" type="2001">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_oSG3I3dMEeatx8P6oLVEqg" width="700" height="23"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_oSG3JHdMEeatx8P6oLVEqg" type="2002">
<children xmi:type="notation:Shape" xmi:id="_oSG3JXdMEeatx8P6oLVEqg" type="3000">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_oSG3JndMEeatx8P6oLVEqg" source="RegionAnnotationKey">
<details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_oSG3J3dMEeatx8P6oLVEqg" key="RegionZoneKey" value=""/>
</eAnnotations>
<children xmi:type="notation:DecorationNode" xmi:id="_oSG3KHdMEeatx8P6oLVEqg" type="3002">
<children xmi:type="notation:Shape" xmi:id="_rw5SMHdMEeatx8P6oLVEqg" type="6000">
<children xmi:type="notation:DecorationNode" xmi:id="_rw55QHdMEeatx8P6oLVEqg" type="6001"/>
<children xmi:type="notation:DecorationNode" xmi:id="_rw55QXdMEeatx8P6oLVEqg" type="19003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_rw55QndMEeatx8P6oLVEqg" x="40"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_rw55Q3dMEeatx8P6oLVEqg" type="6002">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_rw55RHdMEeatx8P6oLVEqg"/>
</children>
<element xmi:type="uml:State" href="simple-localtransition.uml#_rwwvUHdMEeatx8P6oLVEqg"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_rw5SMXdMEeatx8P6oLVEqg" x="97" y="56"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_s1eUoHdMEeatx8P6oLVEqg" type="6000">
<children xmi:type="notation:DecorationNode" xmi:id="_s1e7sHdMEeatx8P6oLVEqg" type="6001">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_tzy-EHdMEeatx8P6oLVEqg" width="347" height="23"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_s1e7sXdMEeatx8P6oLVEqg" type="19003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_s1e7sndMEeatx8P6oLVEqg" x="40"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_s1e7s3dMEeatx8P6oLVEqg" type="6002">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_ueSFgHdMEeatx8P6oLVEqg" source="PapyrusCSSForceValue">
<details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_ueSFgXdMEeatx8P6oLVEqg" key="visible" value="true"/>
</eAnnotations>
<children xmi:type="notation:Shape" xmi:id="_ueT6sHdMEeatx8P6oLVEqg" type="3000">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_ueUhwHdMEeatx8P6oLVEqg" source="RegionAnnotationKey">
<details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_ueUhwXdMEeatx8P6oLVEqg" key="RegionZoneKey" value=""/>
</eAnnotations>
<children xmi:type="notation:DecorationNode" xmi:id="_ueT6sndMEeatx8P6oLVEqg" type="3002">
<children xmi:type="notation:Shape" xmi:id="_ueVv4HdMEeatx8P6oLVEqg" type="6000">
<children xmi:type="notation:DecorationNode" xmi:id="_ueVv4ndMEeatx8P6oLVEqg" type="6001">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_-6eJ4Hf2EeaNC8vytGlUeA" width="60"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_ueVv43dMEeatx8P6oLVEqg" type="19003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_ueVv5HdMEeatx8P6oLVEqg" x="40"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_ueVv5XdMEeatx8P6oLVEqg" type="6002">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_ueVv5ndMEeatx8P6oLVEqg" y="-1" width="60"/>
</children>
<element xmi:type="uml:State" href="simple-localtransition.uml#_ueVI0HdMEeatx8P6oLVEqg"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_ueVv4XdMEeatx8P6oLVEqg" x="80" y="49" width="60"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_wkxQ4HdMEeatx8P6oLVEqg" type="6000">
<children xmi:type="notation:DecorationNode" xmi:id="_wkxQ4ndMEeatx8P6oLVEqg" type="6001">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="__OwX0Hf2EeaNC8vytGlUeA" width="60"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_wkxQ43dMEeatx8P6oLVEqg" type="19003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_wkxQ5HdMEeatx8P6oLVEqg" x="40"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_wkxQ5XdMEeatx8P6oLVEqg" type="6002">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_wkxQ5ndMEeatx8P6oLVEqg" y="-1" width="60"/>
</children>
<element xmi:type="uml:State" href="simple-localtransition.uml#_wkoG8HdMEeatx8P6oLVEqg"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_wkxQ4XdMEeatx8P6oLVEqg" x="218" y="49" width="60"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_21tDcHdMEeatx8P6oLVEqg" type="8000">
<children xmi:type="notation:DecorationNode" xmi:id="_21tqgHdMEeatx8P6oLVEqg" type="8001">
<layoutConstraint xmi:type="notation:Location" xmi:id="_21tqgXdMEeatx8P6oLVEqg" x="25" y="3"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_21tqgndMEeatx8P6oLVEqg" type="8002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_21tqg3dMEeatx8P6oLVEqg" x="25" y="-10"/>
</children>
<element xmi:type="uml:Pseudostate" href="simple-localtransition.uml#_21b9sHdMEeatx8P6oLVEqg"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_21tDcXdMEeatx8P6oLVEqg" x="18" y="55"/>
</children>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_ueT6s3dMEeatx8P6oLVEqg"/>
</children>
<element xmi:type="uml:Region" href="simple-localtransition.uml#_ueSskHdMEeatx8P6oLVEqg"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_ueT6sXdMEeatx8P6oLVEqg" width="347" height="158"/>
</children>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_s1e7tHdMEeatx8P6oLVEqg" y="23" width="347" height="158"/>
</children>
<element xmi:type="uml:State" href="simple-localtransition.uml#_s1YOAHdMEeatx8P6oLVEqg"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_s1eUoXdMEeatx8P6oLVEqg" x="272" y="52" width="347" height="181"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_1UUJMHdMEeatx8P6oLVEqg" type="8000">
<children xmi:type="notation:DecorationNode" xmi:id="_1UUwQHdMEeatx8P6oLVEqg" type="8001">
<layoutConstraint xmi:type="notation:Location" xmi:id="_1UUwQXdMEeatx8P6oLVEqg" x="25" y="3"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_1UUwQndMEeatx8P6oLVEqg" type="8002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_1UUwQ3dMEeatx8P6oLVEqg" x="25" y="-10"/>
</children>
<element xmi:type="uml:Pseudostate" href="simple-localtransition.uml#_1UJxIHdMEeatx8P6oLVEqg"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_1UUJMXdMEeatx8P6oLVEqg" x="30" y="68"/>
</children>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_oSG3KXdMEeatx8P6oLVEqg"/>
</children>
<element xmi:type="uml:Region" href="simple-localtransition.uml#_oSFpAHdMEeatx8P6oLVEqg"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_oSG3KndMEeatx8P6oLVEqg" width="700" height="287"/>
</children>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_oSG3K3dMEeatx8P6oLVEqg" y="23" width="700" height="287"/>
</children>
<element xmi:type="uml:StateMachine" href="simple-localtransition.uml#_oR5bwHdMEeatx8P6oLVEqg"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_oSG3LHdMEeatx8P6oLVEqg" x="30" y="30" width="700" height="310"/>
</children>
<styles xmi:type="notation:StringValueStyle" xmi:id="_oSG3LXdMEeatx8P6oLVEqg" name="diagram_compatibility_version" stringValue="1.1.0"/>
<styles xmi:type="notation:DiagramStyle" xmi:id="_oSG3LndMEeatx8P6oLVEqg"/>
<styles xmi:type="style:PapyrusViewStyle" xmi:id="_oSG3L3dMEeatx8P6oLVEqg">
<owner xmi:type="uml:Model" href="simple-localtransition.uml#_oRX3UHdMEeatx8P6oLVEqg"/>
</styles>
<element xmi:type="uml:StateMachine" href="simple-localtransition.uml#_oR5bwHdMEeatx8P6oLVEqg"/>
<edges xmi:type="notation:Connector" xmi:id="_2WlegHdMEeatx8P6oLVEqg" type="7000" source="_1UUJMHdMEeatx8P6oLVEqg" target="_rw5SMHdMEeatx8P6oLVEqg">
<children xmi:type="notation:DecorationNode" xmi:id="_2Wleg3dMEeatx8P6oLVEqg" type="7001">
<layoutConstraint xmi:type="notation:Location" xmi:id="_2WlehHdMEeatx8P6oLVEqg"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_2WlehXdMEeatx8P6oLVEqg" type="7002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_2WlehndMEeatx8P6oLVEqg"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_2Wleh3dMEeatx8P6oLVEqg" type="7003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_2WleiHdMEeatx8P6oLVEqg" y="60"/>
</children>
<styles xmi:type="notation:FontStyle" xmi:id="_2WlegXdMEeatx8P6oLVEqg"/>
<element xmi:type="uml:Transition" href="simple-localtransition.uml#_2VEbkHdMEeatx8P6oLVEqg"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_2WlegndMEeatx8P6oLVEqg" points="[2, -1, -53, 0]$[51, -2, -4, -1]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_2XD_oHdMEeatx8P6oLVEqg" id="(1.0,0.4)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_2XEmsHdMEeatx8P6oLVEqg" id="(0.0,0.425531914893617)"/>
</edges>
<edges xmi:type="notation:Connector" xmi:id="_3w9KwHdMEeatx8P6oLVEqg" type="7000" source="_21tDcHdMEeatx8P6oLVEqg" target="_ueVv4HdMEeatx8P6oLVEqg">
<children xmi:type="notation:DecorationNode" xmi:id="_3w9x0HdMEeatx8P6oLVEqg" type="7001">
<layoutConstraint xmi:type="notation:Location" xmi:id="_3w9x0XdMEeatx8P6oLVEqg"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_3w9x0ndMEeatx8P6oLVEqg" type="7002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_3w9x03dMEeatx8P6oLVEqg"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_3w9x1HdMEeatx8P6oLVEqg" type="7003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_3w9x1XdMEeatx8P6oLVEqg" y="60"/>
</children>
<styles xmi:type="notation:FontStyle" xmi:id="_3w9KwXdMEeatx8P6oLVEqg"/>
<element xmi:type="uml:Transition" href="simple-localtransition.uml#_3wwWcHdMEeatx8P6oLVEqg"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_3w9KwndMEeatx8P6oLVEqg" points="[6, 5, -36, 33]$[78, 16, 36, 44]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_3xeIIHdMEeatx8P6oLVEqg" id="(1.0,0.45)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_3xf9UHdMEeatx8P6oLVEqg" id="(0.0,0.3191489361702128)"/>
</edges>
<edges xmi:type="notation:Connector" xmi:id="_4zXC8HdMEeatx8P6oLVEqg" type="7000" source="_rw5SMHdMEeatx8P6oLVEqg" target="_s1eUoHdMEeatx8P6oLVEqg">
<children xmi:type="notation:DecorationNode" xmi:id="_4zXqAHdMEeatx8P6oLVEqg" type="7001">
<layoutConstraint xmi:type="notation:Location" xmi:id="_4zXqAXdMEeatx8P6oLVEqg"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_4zXqAndMEeatx8P6oLVEqg" type="7002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_4zXqA3dMEeatx8P6oLVEqg" x="-6" y="-8"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_4zXqBHdMEeatx8P6oLVEqg" type="7003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_4zXqBXdMEeatx8P6oLVEqg" y="60"/>
</children>
<styles xmi:type="notation:FontStyle" xmi:id="_4zXC8XdMEeatx8P6oLVEqg"/>
<element xmi:type="uml:Transition" href="simple-localtransition.uml#_4zKOoHdMEeatx8P6oLVEqg"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_4zXC8ndMEeatx8P6oLVEqg" points="[9, 1, -161, -27]$[148, 21, -22, -7]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_4z51gHdMEeatx8P6oLVEqg" id="(1.0,0.5106382978723404)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_4z51gXdMEeatx8P6oLVEqg" id="(0.0,0.15822784810126583)"/>
</edges>
<edges xmi:type="notation:Connector" xmi:id="_SazycHf2EeaNC8vytGlUeA" type="7000" source="_s1eUoHdMEeatx8P6oLVEqg" target="_ueVv4HdMEeatx8P6oLVEqg">
<children xmi:type="notation:DecorationNode" xmi:id="_Sa1AkHf2EeaNC8vytGlUeA" type="7001">
<layoutConstraint xmi:type="notation:Location" xmi:id="_Sa1AkXf2EeaNC8vytGlUeA"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_Sa1noHf2EeaNC8vytGlUeA" type="7002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_Sa1noXf2EeaNC8vytGlUeA" x="-23" y="17"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_Sa1nonf2EeaNC8vytGlUeA" type="7003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_Sa1no3f2EeaNC8vytGlUeA" y="60"/>
</children>
<styles xmi:type="notation:FontStyle" xmi:id="_SazycXf2EeaNC8vytGlUeA"/>
<element xmi:type="uml:Transition" href="simple-localtransition.uml#_SadNIHf2EeaNC8vytGlUeA"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_Sazycnf2EeaNC8vytGlUeA" points="[0, -13, 1, -88]$[-5, 73, -4, -2]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_SbhkIHf2EeaNC8vytGlUeA" id="(0.2478386167146974,0.0)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_SbhkIXf2EeaNC8vytGlUeA" id="(0.175,0.0)"/>
</edges>
<edges xmi:type="notation:Connector" xmi:id="_X01yMHf2EeaNC8vytGlUeA" type="7000" source="_s1eUoHdMEeatx8P6oLVEqg" target="_wkxQ4HdMEeatx8P6oLVEqg">
<children xmi:type="notation:DecorationNode" xmi:id="_X01yM3f2EeaNC8vytGlUeA" type="7001">
<layoutConstraint xmi:type="notation:Location" xmi:id="_X01yNHf2EeaNC8vytGlUeA"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_X02ZQHf2EeaNC8vytGlUeA" type="7002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_X02ZQXf2EeaNC8vytGlUeA" x="10" y="-21"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_X02ZQnf2EeaNC8vytGlUeA" type="7003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_X02ZQ3f2EeaNC8vytGlUeA" y="60"/>
</children>
<styles xmi:type="notation:FontStyle" xmi:id="_X01yMXf2EeaNC8vytGlUeA"/>
<element xmi:type="uml:Transition" href="simple-localtransition.uml#_X0raIHf2EeaNC8vytGlUeA"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_X01yMnf2EeaNC8vytGlUeA" points="[-2, -4, -16, -72]$[16, 70, 2, 2]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_X1WIgHf2EeaNC8vytGlUeA" id="(0.7262247838616714,0.0)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_X1WIgXf2EeaNC8vytGlUeA" id="(0.8,0.0)"/>
</edges>
<edges xmi:type="notation:Connector" xmi:id="_cyrlMHf2EeaNC8vytGlUeA" type="7000" source="_ueVv4HdMEeatx8P6oLVEqg" target="_s1eUoHdMEeatx8P6oLVEqg">
<children xmi:type="notation:DecorationNode" xmi:id="_cyrlM3f2EeaNC8vytGlUeA" type="7001">
<layoutConstraint xmi:type="notation:Location" xmi:id="_cyrlNHf2EeaNC8vytGlUeA"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_cyrlNXf2EeaNC8vytGlUeA" type="7002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_cyrlNnf2EeaNC8vytGlUeA" x="-11" y="20"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_cyrlN3f2EeaNC8vytGlUeA" type="7003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_cyrlOHf2EeaNC8vytGlUeA" y="60"/>
</children>
<styles xmi:type="notation:FontStyle" xmi:id="_cyrlMXf2EeaNC8vytGlUeA"/>
<element xmi:type="uml:Transition" href="simple-localtransition.uml#_cygmEHf2EeaNC8vytGlUeA"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_cyrlMnf2EeaNC8vytGlUeA" points="[-1, -2, 1, 64]$[-10, -74, -8, -8]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_czL7gHf2EeaNC8vytGlUeA" id="(0.825,0.0)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_czL7gXf2EeaNC8vytGlUeA" id="(0.3256484149855908,0.0)"/>
</edges>
<edges xmi:type="notation:Connector" xmi:id="_fTmCwHf2EeaNC8vytGlUeA" type="7000" source="_wkxQ4HdMEeatx8P6oLVEqg" target="_s1eUoHdMEeatx8P6oLVEqg">
<children xmi:type="notation:DecorationNode" xmi:id="_fTmp0Xf2EeaNC8vytGlUeA" type="7001">
<layoutConstraint xmi:type="notation:Location" xmi:id="_fTmp0nf2EeaNC8vytGlUeA"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_fTmp03f2EeaNC8vytGlUeA" type="7002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_fTmp1Hf2EeaNC8vytGlUeA" x="-13" y="-19"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_fTmp1Xf2EeaNC8vytGlUeA" type="7003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_fTmp1nf2EeaNC8vytGlUeA" y="60"/>
</children>
<styles xmi:type="notation:FontStyle" xmi:id="_fTmCwXf2EeaNC8vytGlUeA"/>
<element xmi:type="uml:Transition" href="simple-localtransition.uml#_fTackHf2EeaNC8vytGlUeA"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_fTmp0Hf2EeaNC8vytGlUeA" points="[-1, -4, 2, 63]$[3, -76, 6, -9]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_fUI1UHf2EeaNC8vytGlUeA" id="(0.2,0.0)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_fUI1UXf2EeaNC8vytGlUeA" id="(0.6512968299711815,0.0)"/>
</edges>
<edges xmi:type="notation:Connector" xmi:id="_x_RewHf2EeaNC8vytGlUeA" type="7000" source="_ueVv4HdMEeatx8P6oLVEqg" target="_s1eUoHdMEeatx8P6oLVEqg">
<children xmi:type="notation:DecorationNode" xmi:id="_x_SF0Hf2EeaNC8vytGlUeA" type="7001">
<layoutConstraint xmi:type="notation:Location" xmi:id="_x_SF0Xf2EeaNC8vytGlUeA"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_x_SF0nf2EeaNC8vytGlUeA" type="7002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_x_SF03f2EeaNC8vytGlUeA" x="-6" y="26"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_x_SF1Hf2EeaNC8vytGlUeA" type="7003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_x_SF1Xf2EeaNC8vytGlUeA" y="60"/>
</children>
<styles xmi:type="notation:FontStyle" xmi:id="_x_RewXf2EeaNC8vytGlUeA"/>
<element xmi:type="uml:Transition" href="simple-localtransition.uml#_x_FRgHf2EeaNC8vytGlUeA"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_x_Rewnf2EeaNC8vytGlUeA" points="[-1, 8, 0, -58]$[-8, 72, -7, 6]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_x_0RUHf2EeaNC8vytGlUeA" id="(0.075,1.0)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_x_0RUXf2EeaNC8vytGlUeA" id="(0.27089337175792505,1.0)"/>
</edges>
<edges xmi:type="notation:Connector" xmi:id="_4QT_AHf2EeaNC8vytGlUeA" type="7000" source="_s1eUoHdMEeatx8P6oLVEqg" target="_ueVv4HdMEeatx8P6oLVEqg">
<children xmi:type="notation:DecorationNode" xmi:id="_4QT_A3f2EeaNC8vytGlUeA" type="7001">
<layoutConstraint xmi:type="notation:Location" xmi:id="_4QT_BHf2EeaNC8vytGlUeA"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_4QT_BXf2EeaNC8vytGlUeA" type="7002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_4QT_Bnf2EeaNC8vytGlUeA" x="-1" y="20"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_4QT_B3f2EeaNC8vytGlUeA" type="7003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_4QT_CHf2EeaNC8vytGlUeA" y="60"/>
</children>
<styles xmi:type="notation:FontStyle" xmi:id="_4QT_AXf2EeaNC8vytGlUeA"/>
<element xmi:type="uml:Transition" href="simple-localtransition.uml#_4QHKsHf2EeaNC8vytGlUeA"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_4QT_Anf2EeaNC8vytGlUeA" points="[0, 3, 4, 68]$[-2, -60, 2, 5]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_4Q3_sHf2EeaNC8vytGlUeA" id="(0.3631123919308357,1.0)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_4Q3_sXf2EeaNC8vytGlUeA" id="(0.7166666666666667,1.0)"/>
</edges>
<edges xmi:type="notation:Connector" xmi:id="_5KWlYHf2EeaNC8vytGlUeA" type="7000" source="_wkxQ4HdMEeatx8P6oLVEqg" target="_s1eUoHdMEeatx8P6oLVEqg">
<children xmi:type="notation:DecorationNode" xmi:id="_5KWlY3f2EeaNC8vytGlUeA" type="7001">
<layoutConstraint xmi:type="notation:Location" xmi:id="_5KWlZHf2EeaNC8vytGlUeA"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_5KWlZXf2EeaNC8vytGlUeA" type="7002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_5KWlZnf2EeaNC8vytGlUeA" x="-5" y="22"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_5KWlZ3f2EeaNC8vytGlUeA" type="7003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_5KWlaHf2EeaNC8vytGlUeA" y="60"/>
</children>
<styles xmi:type="notation:FontStyle" xmi:id="_5KWlYXf2EeaNC8vytGlUeA"/>
<element xmi:type="uml:Transition" href="simple-localtransition.uml#_5KLmQHf2EeaNC8vytGlUeA"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_5KWlYnf2EeaNC8vytGlUeA" points="[-6, -32, 218, 87]$[123, 19, 347, 138]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_5K5X8Hf2EeaNC8vytGlUeA" id="(0.2,1.0)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_5K5X8Xf2EeaNC8vytGlUeA" id="(0.7060518731988472,1.0)"/>
</edges>
<edges xmi:type="notation:Connector" xmi:id="_946mQHf2EeaNC8vytGlUeA" type="7000" source="_s1eUoHdMEeatx8P6oLVEqg" target="_wkxQ4HdMEeatx8P6oLVEqg">
<children xmi:type="notation:DecorationNode" xmi:id="_947NUHf2EeaNC8vytGlUeA" type="7001">
<layoutConstraint xmi:type="notation:Location" xmi:id="_947NUXf2EeaNC8vytGlUeA"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_947NUnf2EeaNC8vytGlUeA" type="7002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_947NU3f2EeaNC8vytGlUeA" x="-1" y="16"/>
</children>
<children xmi:type="notation:DecorationNode" xmi:id="_947NVHf2EeaNC8vytGlUeA" type="7003">
<layoutConstraint xmi:type="notation:Location" xmi:id="_947NVXf2EeaNC8vytGlUeA" y="60"/>
</children>
<styles xmi:type="notation:FontStyle" xmi:id="_946mQXf2EeaNC8vytGlUeA"/>
<element xmi:type="uml:Transition" href="simple-localtransition.uml#_94sj0Hf2EeaNC8vytGlUeA"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_946mQnf2EeaNC8vytGlUeA" points="[347, 150, 72, 31]$[272, 117, -3, -2]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_95q0MHf2EeaNC8vytGlUeA" id="(0.7953890489913544,1.0)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_95q0MXf2EeaNC8vytGlUeA" id="(0.9333333333333333,1.0)"/>
</edges>
</notation:Diagram>

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_oRX3UHdMEeatx8P6oLVEqg" name="RootElement">
<packagedElement xmi:type="uml:StateMachine" xmi:id="_oR5bwHdMEeatx8P6oLVEqg" name="StateMachine">
<region xmi:type="uml:Region" xmi:id="_oSFpAHdMEeatx8P6oLVEqg" name="Region1">
<transition xmi:type="uml:Transition" xmi:id="_2VEbkHdMEeatx8P6oLVEqg" source="_1UJxIHdMEeatx8P6oLVEqg" target="_rwwvUHdMEeatx8P6oLVEqg"/>
<transition xmi:type="uml:Transition" xmi:id="_4zKOoHdMEeatx8P6oLVEqg" source="_rwwvUHdMEeatx8P6oLVEqg" target="_s1YOAHdMEeatx8P6oLVEqg">
<trigger xmi:type="uml:Trigger" xmi:id="__RO5gHf1EeaNC8vytGlUeA" event="_grqeYHf1EeaNC8vytGlUeA"/>
</transition>
<transition xmi:type="uml:Transition" xmi:id="_SadNIHf2EeaNC8vytGlUeA" source="_s1YOAHdMEeatx8P6oLVEqg" target="_ueVI0HdMEeatx8P6oLVEqg">
<trigger xmi:type="uml:Trigger" xmi:id="_WoOOEHf2EeaNC8vytGlUeA" event="_jTrpgHf1EeaNC8vytGlUeA"/>
</transition>
<transition xmi:type="uml:Transition" xmi:id="_X0raIHf2EeaNC8vytGlUeA" source="_s1YOAHdMEeatx8P6oLVEqg" target="_wkoG8HdMEeatx8P6oLVEqg">
<trigger xmi:type="uml:Trigger" xmi:id="_ZjRC4Hf2EeaNC8vytGlUeA" event="_mFgQ4Hf1EeaNC8vytGlUeA"/>
</transition>
<transition xmi:type="uml:Transition" xmi:id="_4QHKsHf2EeaNC8vytGlUeA" kind="local" source="_s1YOAHdMEeatx8P6oLVEqg" target="_ueVI0HdMEeatx8P6oLVEqg">
<trigger xmi:type="uml:Trigger" xmi:id="_H2MuwHf3EeaNC8vytGlUeA" event="_u-rRAHf1EeaNC8vytGlUeA"/>
</transition>
<transition xmi:type="uml:Transition" xmi:id="_94sj0Hf2EeaNC8vytGlUeA" kind="local" source="_s1YOAHdMEeatx8P6oLVEqg" target="_wkoG8HdMEeatx8P6oLVEqg">
<trigger xmi:type="uml:Trigger" xmi:id="_Lv8ngHf3EeaNC8vytGlUeA" event="_xzHHgHf1EeaNC8vytGlUeA"/>
</transition>
<subvertex xmi:type="uml:State" xmi:id="_rwwvUHdMEeatx8P6oLVEqg" name="S1"/>
<subvertex xmi:type="uml:State" xmi:id="_s1YOAHdMEeatx8P6oLVEqg" name="S2">
<region xmi:type="uml:Region" xmi:id="_ueSskHdMEeatx8P6oLVEqg" name="Region1">
<transition xmi:type="uml:Transition" xmi:id="_3wwWcHdMEeatx8P6oLVEqg" source="_21b9sHdMEeatx8P6oLVEqg" target="_ueVI0HdMEeatx8P6oLVEqg"/>
<transition xmi:type="uml:Transition" xmi:id="_cygmEHf2EeaNC8vytGlUeA" source="_ueVI0HdMEeatx8P6oLVEqg" target="_s1YOAHdMEeatx8P6oLVEqg">
<trigger xmi:type="uml:Trigger" xmi:id="_e0KUwHf2EeaNC8vytGlUeA" event="_ojTJAHf1EeaNC8vytGlUeA"/>
</transition>
<transition xmi:type="uml:Transition" xmi:id="_fTackHf2EeaNC8vytGlUeA" source="_wkoG8HdMEeatx8P6oLVEqg" target="_s1YOAHdMEeatx8P6oLVEqg">
<trigger xmi:type="uml:Trigger" xmi:id="_izWHIHf2EeaNC8vytGlUeA" event="_sbNOsHf1EeaNC8vytGlUeA"/>
</transition>
<transition xmi:type="uml:Transition" xmi:id="_x_FRgHf2EeaNC8vytGlUeA" kind="local" source="_ueVI0HdMEeatx8P6oLVEqg" target="_s1YOAHdMEeatx8P6oLVEqg">
<trigger xmi:type="uml:Trigger" xmi:id="_OmJ_oHf3EeaNC8vytGlUeA" event="_1TkWgHf1EeaNC8vytGlUeA"/>
</transition>
<transition xmi:type="uml:Transition" xmi:id="_5KLmQHf2EeaNC8vytGlUeA" kind="local" source="_wkoG8HdMEeatx8P6oLVEqg" target="_s1YOAHdMEeatx8P6oLVEqg">
<trigger xmi:type="uml:Trigger" xmi:id="_RQrsMHf3EeaNC8vytGlUeA" event="_4m_PEHf1EeaNC8vytGlUeA"/>
</transition>
<subvertex xmi:type="uml:State" xmi:id="_ueVI0HdMEeatx8P6oLVEqg" name="S21"/>
<subvertex xmi:type="uml:State" xmi:id="_wkoG8HdMEeatx8P6oLVEqg" name="S22"/>
<subvertex xmi:type="uml:Pseudostate" xmi:id="_21b9sHdMEeatx8P6oLVEqg" name=""/>
</region>
</subvertex>
<subvertex xmi:type="uml:Pseudostate" xmi:id="_1UJxIHdMEeatx8P6oLVEqg" name=""/>
</region>
</packagedElement>
<packagedElement xmi:type="uml:Signal" xmi:id="_QTogAHf1EeaNC8vytGlUeA" name="E1"/>
<packagedElement xmi:type="uml:Signal" xmi:id="_SjmXgHf1EeaNC8vytGlUeA" name="E20"/>
<packagedElement xmi:type="uml:Signal" xmi:id="_UIyMoHf1EeaNC8vytGlUeA" name="E21"/>
<packagedElement xmi:type="uml:Signal" xmi:id="_ViGwAHf1EeaNC8vytGlUeA" name="E22"/>
<packagedElement xmi:type="uml:Signal" xmi:id="_XO5pAHf1EeaNC8vytGlUeA" name="E23"/>
<packagedElement xmi:type="uml:Signal" xmi:id="_Y3HkAHf1EeaNC8vytGlUeA" name="E30"/>
<packagedElement xmi:type="uml:Signal" xmi:id="_aFUcgHf1EeaNC8vytGlUeA" name="E31"/>
<packagedElement xmi:type="uml:Signal" xmi:id="_crMSkHf1EeaNC8vytGlUeA" name="E32"/>
<packagedElement xmi:type="uml:Signal" xmi:id="_eME2gHf1EeaNC8vytGlUeA" name="E33"/>
<packagedElement xmi:type="uml:SignalEvent" xmi:id="_grqeYHf1EeaNC8vytGlUeA" name="SignalEventE1" signal="_QTogAHf1EeaNC8vytGlUeA"/>
<packagedElement xmi:type="uml:SignalEvent" xmi:id="_jTrpgHf1EeaNC8vytGlUeA" name="SignalEventE20" signal="_SjmXgHf1EeaNC8vytGlUeA"/>
<packagedElement xmi:type="uml:SignalEvent" xmi:id="_mFgQ4Hf1EeaNC8vytGlUeA" name="SignalEventE21" signal="_UIyMoHf1EeaNC8vytGlUeA"/>
<packagedElement xmi:type="uml:SignalEvent" xmi:id="_ojTJAHf1EeaNC8vytGlUeA" name="SignalEventE22" signal="_ViGwAHf1EeaNC8vytGlUeA"/>
<packagedElement xmi:type="uml:SignalEvent" xmi:id="_sbNOsHf1EeaNC8vytGlUeA" name="SignalEventE23" signal="_XO5pAHf1EeaNC8vytGlUeA"/>
<packagedElement xmi:type="uml:SignalEvent" xmi:id="_u-rRAHf1EeaNC8vytGlUeA" name="SignalEventE30" signal="_Y3HkAHf1EeaNC8vytGlUeA"/>
<packagedElement xmi:type="uml:SignalEvent" xmi:id="_xzHHgHf1EeaNC8vytGlUeA" name="SignalEventE31" signal="_aFUcgHf1EeaNC8vytGlUeA"/>
<packagedElement xmi:type="uml:SignalEvent" xmi:id="_1TkWgHf1EeaNC8vytGlUeA" name="SignalEventE32" signal="_crMSkHf1EeaNC8vytGlUeA"/>
<packagedElement xmi:type="uml:SignalEvent" xmi:id="_4m_PEHf1EeaNC8vytGlUeA" name="SignalEventE33" signal="_eME2gHf1EeaNC8vytGlUeA"/>
</uml:Model>