andreas muelder 7 роки тому
батько
коміт
2a729427da
18 змінених файлів з 1143 додано та 261 видалено
  1. 0 249
      plugins/org.yakindu.sct.model.sruntime/src/org/yakindu/sct/model/sruntime/EventDirection.java
  2. 2 3
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/DefaultExecutionFlowInterpreter.xtend
  3. 53 0
      test-plugins/org.yakindu.sct.generator.java.test/model/model.eventdriven.sgen
  4. 33 0
      test-plugins/org.yakindu.sct.generator.java.test/model/test.eventdriven.sgen
  5. 1 1
      test-plugins/org.yakindu.sct.generator.java.test/model/test.sgen
  6. 2 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/bitexpressions/BitExpressionsStatemachine.java
  7. 2 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/booleanexpressions/BooleanExpressionsStatemachine.java
  8. 312 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/eventdrivenoutevents/EventDrivenOutEventsStatemachine.java
  9. 17 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/eventdrivenoutevents/IEventDrivenOutEventsStatemachine.java
  10. 15 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/localevents/ILocalEventsStatemachine.java
  11. 378 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/localevents/LocalEventsStatemachine.java
  12. 2 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/transitionwithoutcondition/TransitionWithoutConditionStatemachine.java
  13. 3 0
      test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/AllTests.java
  14. 42 0
      test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/EventDrivenOutEvents.java
  15. 42 0
      test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/LocalEvents.java
  16. 220 0
      test-plugins/org.yakindu.sct.test.models/testmodels/SCTUnit/eventdriven/LocalEvents.sct
  17. 2 8
      test-plugins/org.yakindu.sct.test.models/tests/AllTests.sctunit
  18. 17 0
      test-plugins/org.yakindu.sct.test.models/tests/eventdriven/LocalEvents.sctunit

+ 0 - 249
plugins/org.yakindu.sct.model.sruntime/src/org/yakindu/sct/model/sruntime/EventDirection.java

@@ -1,249 +0,0 @@
-/**
- * Copyright (c) 2013 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.model.sruntime;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.emf.common.util.Enumerator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the literals of the enumeration '<em><b>Event Direction</b></em>',
- * and utility methods for working with them.
- * <!-- end-user-doc -->
- * @see org.yakindu.sct.model.sruntime.SRuntimePackage#getEventDirection()
- * @model
- * @generated
- */
-public enum EventDirection implements Enumerator {
-	/**
-	 * The '<em><b>LOCAL</b></em>' literal object.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @see #LOCAL_VALUE
-	 * @generated
-	 * @ordered
-	 */
-	LOCAL(0, "LOCAL", "LOCAL"),
-
-	/**
-	 * The '<em><b>IN</b></em>' literal object.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @see #IN_VALUE
-	 * @generated
-	 * @ordered
-	 */
-	IN(1, "IN", "IN"),
-
-	/**
-	 * The '<em><b>OUT</b></em>' literal object.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @see #OUT_VALUE
-	 * @generated
-	 * @ordered
-	 */
-	OUT(2, "OUT", "OUT");
-
-	/**
-	 * The '<em><b>LOCAL</b></em>' literal value.
-	 * <!-- begin-user-doc -->
-	 * <p>
-	 * If the meaning of '<em><b>LOCAL</b></em>' literal object isn't clear,
-	 * there really should be more of a description here...
-	 * </p>
-	 * <!-- end-user-doc -->
-	 * @see #LOCAL
-	 * @model
-	 * @generated
-	 * @ordered
-	 */
-	public static final int LOCAL_VALUE = 0;
-
-	/**
-	 * The '<em><b>IN</b></em>' literal value.
-	 * <!-- begin-user-doc -->
-	 * <p>
-	 * If the meaning of '<em><b>IN</b></em>' literal object isn't clear,
-	 * there really should be more of a description here...
-	 * </p>
-	 * <!-- end-user-doc -->
-	 * @see #IN
-	 * @model
-	 * @generated
-	 * @ordered
-	 */
-	public static final int IN_VALUE = 1;
-
-	/**
-	 * The '<em><b>OUT</b></em>' literal value.
-	 * <!-- begin-user-doc -->
-	 * <p>
-	 * If the meaning of '<em><b>OUT</b></em>' literal object isn't clear,
-	 * there really should be more of a description here...
-	 * </p>
-	 * <!-- end-user-doc -->
-	 * @see #OUT
-	 * @model
-	 * @generated
-	 * @ordered
-	 */
-	public static final int OUT_VALUE = 2;
-
-	/**
-	 * An array of all the '<em><b>Event Direction</b></em>' enumerators.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	private static final EventDirection[] VALUES_ARRAY =
-		new EventDirection[] {
-			LOCAL,
-			IN,
-			OUT,
-		};
-
-	/**
-	 * A public read-only list of all the '<em><b>Event Direction</b></em>' enumerators.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	public static final List<EventDirection> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
-
-	/**
-	 * Returns the '<em><b>Event Direction</b></em>' literal with the specified literal value.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @param literal the literal.
-	 * @return the matching enumerator or <code>null</code>.
-	 * @generated
-	 */
-	public static EventDirection get(String literal) {
-		for (int i = 0; i < VALUES_ARRAY.length; ++i) {
-			EventDirection result = VALUES_ARRAY[i];
-			if (result.toString().equals(literal)) {
-				return result;
-			}
-		}
-		return null;
-	}
-
-	/**
-	 * Returns the '<em><b>Event Direction</b></em>' literal with the specified name.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @param name the name.
-	 * @return the matching enumerator or <code>null</code>.
-	 * @generated
-	 */
-	public static EventDirection getByName(String name) {
-		for (int i = 0; i < VALUES_ARRAY.length; ++i) {
-			EventDirection result = VALUES_ARRAY[i];
-			if (result.getName().equals(name)) {
-				return result;
-			}
-		}
-		return null;
-	}
-
-	/**
-	 * Returns the '<em><b>Event Direction</b></em>' literal with the specified integer value.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @param value the integer value.
-	 * @return the matching enumerator or <code>null</code>.
-	 * @generated
-	 */
-	public static EventDirection get(int value) {
-		switch (value) {
-			case LOCAL_VALUE: return LOCAL;
-			case IN_VALUE: return IN;
-			case OUT_VALUE: return OUT;
-		}
-		return null;
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	private final int value;
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	private final String name;
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	private final String literal;
-
-	/**
-	 * Only this class can construct instances.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	private EventDirection(int value, String name, String literal) {
-		this.value = value;
-		this.name = name;
-		this.literal = literal;
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	public int getValue() {
-	  return value;
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	public String getName() {
-	  return name;
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	public String getLiteral() {
-	  return literal;
-	}
-
-	/**
-	 * Returns the literal value of the enumerator, which is its string representation.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	@Override
-	public String toString() {
-		return literal;
-	}
-	
-} //EventDirection

+ 2 - 3
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/DefaultExecutionFlowInterpreter.xtend

@@ -33,6 +33,7 @@ import org.yakindu.sct.model.sexec.If
 import org.yakindu.sct.model.sexec.SaveHistory
 import org.yakindu.sct.model.sexec.ScheduleTimeEvent
 import org.yakindu.sct.model.sexec.Sequence
+import org.yakindu.sct.model.sexec.SexecFactory
 import org.yakindu.sct.model.sexec.StateSwitch
 import org.yakindu.sct.model.sexec.Step
 import org.yakindu.sct.model.sexec.Trace
@@ -41,14 +42,12 @@ import org.yakindu.sct.model.sexec.extensions.StateVectorExtensions
 import org.yakindu.sct.model.sexec.transformation.SexecExtensions
 import org.yakindu.sct.model.sgraph.FinalState
 import org.yakindu.sct.model.sgraph.RegularState
-import org.yakindu.sct.model.sruntime.EventDirection
 import org.yakindu.sct.model.sruntime.ExecutionContext
 import org.yakindu.sct.model.sruntime.ExecutionEvent
 import org.yakindu.sct.model.stext.lib.StatechartAnnotations
 import org.yakindu.sct.simulation.core.engine.scheduling.ITimeTaskScheduler
 import org.yakindu.sct.simulation.core.engine.scheduling.ITimeTaskScheduler.TimeTask
 import org.yakindu.sct.simulation.core.util.ExecutionContextExtensions
-import org.yakindu.sct.model.sexec.SexecFactory
 
 /**
  * 
@@ -183,7 +182,7 @@ class DefaultExecutionFlowInterpreter implements IExecutionFlowInterpreter, IEve
 	}
 
 	def protected clearLocalAndInEvents(ExecutionContext executionContext) {
-		executionContext.allEvents.filter[direction == EventDirection.IN || direction == EventDirection.LOCAL].forEach [
+		executionContext.allEvents.filter[direction == Direction.IN || direction == Direction.LOCAL].forEach [
 			if (raised) {
 				raised = false;
 				value = if(type !== null) type.defaultValue else null

+ 53 - 0
test-plugins/org.yakindu.sct.generator.java.test/model/model.eventdriven.sgen

@@ -86,6 +86,59 @@ GeneratorModel for yakindu::java {
 		}
 	}
 
+	statechart eventdriven.localEvents {
+		feature Outlet {
+			targetProject = "org.yakindu.sct.generator.java.test"
+			targetFolder = "src-gen"
+		}
+		
+		feature Naming {
+			basePackage =  "org.yakindu.scr" 
+		}
+
+		feature GeneralFeatures {
+			TimerService = true
+			RuntimeService = true
+		}
+
+		feature FunctionInlining {
+			inlineReactions = false
+			inlineEntryActions = false
+			inlineExitActions = false
+			inlineEnterSequences = false
+			inlineExitSequences = false
+			inlineChoices = false
+			inlineEnterRegion = false
+			inlineExitRegion = false
+			inlineEntries = false
+		}
+	}
+	
+statechart EventDrivenOutEvents {
+		feature Outlet {
+			targetProject = "org.yakindu.sct.generator.java.test"
+			targetFolder = "src-gen"
+		}
+		
+		feature Naming {
+			basePackage =  "org.yakindu.scr" 
+		}
 
+		feature GeneralFeatures {
+			TimerService = true
+			RuntimeService = true
+		}
 
+		feature FunctionInlining {
+			inlineReactions = false
+			inlineEntryActions = false
+			inlineExitActions = false
+			inlineEnterSequences = false
+			inlineExitSequences = false
+			inlineChoices = false
+			inlineEnterRegion = false
+			inlineExitRegion = false
+			inlineEntries = false
+		}
+	}
 }

+ 33 - 0
test-plugins/org.yakindu.sct.generator.java.test/model/test.eventdriven.sgen

@@ -51,4 +51,37 @@ GeneratorModel for sctunit::java {
 		}
 	}
 	
+	test LocalEvents {
+		feature Naming {
+			basePackage = "org.yakindu.sct.generator.java.test"
+		}
+
+		feature Outlet {
+			targetProject = "org.yakindu.sct.generator.java.test"
+			targetFolder = "test-gen"
+		}
+		
+		feature StatechartNaming {
+			basePackage = "org.yakindu.scr"
+			libraryTargetFolder = "src-gen"
+		}
+	}
+	
+	test EventDrivenOutEvents {
+		feature Naming {
+			basePackage = "org.yakindu.sct.generator.java.test"
+		}
+
+		feature Outlet {
+			targetProject = "org.yakindu.sct.generator.java.test"
+			targetFolder = "test-gen"
+		}
+		
+		feature StatechartNaming {
+			basePackage = "org.yakindu.scr"
+			libraryTargetFolder = "src-gen"
+		}
+	}
+	
+	
 }

+ 1 - 1
test-plugins/org.yakindu.sct.generator.java.test/model/test.sgen

@@ -554,7 +554,7 @@ GeneratorModel for sctunit::java {
 			libraryTargetFolder = "src-gen"
 		}
 	}
-
+	
 	test LocalReactions {
 		feature Naming {
 			basePackage = "org.yakindu.sct.generator.java.test"

+ 2 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/bitexpressions/BitExpressionsStatemachine.java

@@ -109,6 +109,8 @@ public class BitExpressionsStatemachine implements IBitExpressionsStatemachine {
 	
 	private int nextStateIndex;
 	
+	
+	
 	public BitExpressionsStatemachine() {
 		sCInterface = new SCInterfaceImpl();
 	}

+ 2 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/booleanexpressions/BooleanExpressionsStatemachine.java

@@ -99,6 +99,8 @@ public class BooleanExpressionsStatemachine implements IBooleanExpressionsStatem
 	
 	private int nextStateIndex;
 	
+	
+	
 	public BooleanExpressionsStatemachine() {
 		sCInterface = new SCInterfaceImpl();
 	}

+ 312 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/eventdrivenoutevents/EventDrivenOutEventsStatemachine.java

@@ -0,0 +1,312 @@
+package org.yakindu.scr.eventdrivenoutevents;
+
+public class EventDrivenOutEventsStatemachine implements IEventDrivenOutEventsStatemachine {
+
+	protected class SCInterfaceImpl implements SCInterface {
+	
+		private boolean e1;
+		
+		public void raiseE1() {
+			e1 = true;
+			runCycle();
+		}
+		
+		private boolean e2;
+		
+		public boolean isRaisedE2() {
+			return e2;
+		}
+		
+		protected void raiseE2() {
+			e2 = true;
+		}
+		
+		protected void clearEvents() {
+			e1 = false;
+		}
+		protected void clearOutEvents() {
+		
+		e2 = false;
+		}
+		
+	}
+	
+	protected SCInterfaceImpl sCInterface;
+	
+	private boolean initialized = false;
+	
+	public enum State {
+		main_region_StateA,
+		main_region_StateB,
+		second_region_StateC,
+		second_region_StateD,
+		$NullState$
+	};
+	
+	private final State[] stateVector = new State[2];
+	
+	private int nextStateIndex;
+	
+	
+	
+	public EventDrivenOutEventsStatemachine() {
+		sCInterface = new SCInterfaceImpl();
+	}
+	
+	public void init() {
+		this.initialized = true;
+		for (int i = 0; i < 2; i++) {
+			stateVector[i] = State.$NullState$;
+		}
+		clearEvents();
+		clearOutEvents();
+	}
+	
+	public void enter() {
+		if (!initialized) {
+			throw new IllegalStateException(
+					"The state machine needs to be initialized first by calling the init() function.");
+		}
+		enterSequence_main_region_default();
+		enterSequence_second_region_default();
+	}
+	
+	public void exit() {
+		exitSequence_main_region();
+		exitSequence_second_region();
+	}
+	
+	/**
+	 * @see IStatemachine#isActive()
+	 */
+	public boolean isActive() {
+		return stateVector[0] != State.$NullState$||stateVector[1] != State.$NullState$;
+	}
+	
+	/** 
+	* Always returns 'false' since this state machine can never become final.
+	*
+	* @see IStatemachine#isFinal()
+	*/
+	public boolean isFinal() {
+		return false;
+	}
+	/**
+	* This method resets the incoming events (time events included).
+	*/
+	protected void clearEvents() {
+		sCInterface.clearEvents();
+	}
+	
+	/**
+	* This method resets the outgoing events.
+	*/
+	protected void clearOutEvents() {
+		sCInterface.clearOutEvents();
+	}
+	
+	/**
+	* Returns true if the given state is currently active otherwise false.
+	*/
+	public boolean isStateActive(State state) {
+	
+		switch (state) {
+		case main_region_StateA:
+			return stateVector[0] == State.main_region_StateA;
+		case main_region_StateB:
+			return stateVector[0] == State.main_region_StateB;
+		case second_region_StateC:
+			return stateVector[1] == State.second_region_StateC;
+		case second_region_StateD:
+			return stateVector[1] == State.second_region_StateD;
+		default:
+			return false;
+		}
+	}
+	
+	public SCInterface getSCInterface() {
+		return sCInterface;
+	}
+	
+	public void raiseE1() {
+		sCInterface.raiseE1();
+	}
+	
+	public boolean isRaisedE2() {
+		return sCInterface.isRaisedE2();
+	}
+	
+	private boolean check_main_region_StateA_tr0_tr0() {
+		return sCInterface.e1;
+	}
+	
+	private boolean check_second_region_StateC_tr0_tr0() {
+		return sCInterface.e2;
+	}
+	
+	private void effect_main_region_StateA_tr0() {
+		exitSequence_main_region_StateA();
+		enterSequence_main_region_StateB_default();
+	}
+	
+	private void effect_second_region_StateC_tr0() {
+		exitSequence_second_region_StateC();
+		enterSequence_second_region_StateD_default();
+	}
+	
+	/* Entry action for state 'StateB'. */
+	private void entryAction_main_region_StateB() {
+		sCInterface.raiseE2();
+	}
+	
+	/* 'default' enter sequence for state StateA */
+	private void enterSequence_main_region_StateA_default() {
+		nextStateIndex = 0;
+		stateVector[0] = State.main_region_StateA;
+	}
+	
+	/* 'default' enter sequence for state StateB */
+	private void enterSequence_main_region_StateB_default() {
+		entryAction_main_region_StateB();
+		nextStateIndex = 0;
+		stateVector[0] = State.main_region_StateB;
+	}
+	
+	/* 'default' enter sequence for state StateC */
+	private void enterSequence_second_region_StateC_default() {
+		nextStateIndex = 1;
+		stateVector[1] = State.second_region_StateC;
+	}
+	
+	/* 'default' enter sequence for state StateD */
+	private void enterSequence_second_region_StateD_default() {
+		nextStateIndex = 1;
+		stateVector[1] = State.second_region_StateD;
+	}
+	
+	/* 'default' enter sequence for region main region */
+	private void enterSequence_main_region_default() {
+		react_main_region__entry_Default();
+	}
+	
+	/* 'default' enter sequence for region second region */
+	private void enterSequence_second_region_default() {
+		react_second_region__entry_Default();
+	}
+	
+	/* Default exit sequence for state StateA */
+	private void exitSequence_main_region_StateA() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+	
+	/* Default exit sequence for state StateB */
+	private void exitSequence_main_region_StateB() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+	
+	/* Default exit sequence for state StateC */
+	private void exitSequence_second_region_StateC() {
+		nextStateIndex = 1;
+		stateVector[1] = State.$NullState$;
+	}
+	
+	/* Default exit sequence for state StateD */
+	private void exitSequence_second_region_StateD() {
+		nextStateIndex = 1;
+		stateVector[1] = State.$NullState$;
+	}
+	
+	/* Default exit sequence for region main region */
+	private void exitSequence_main_region() {
+		switch (stateVector[0]) {
+		case main_region_StateA:
+			exitSequence_main_region_StateA();
+			break;
+		case main_region_StateB:
+			exitSequence_main_region_StateB();
+			break;
+		default:
+			break;
+		}
+	}
+	
+	/* Default exit sequence for region second region */
+	private void exitSequence_second_region() {
+		switch (stateVector[1]) {
+		case second_region_StateC:
+			exitSequence_second_region_StateC();
+			break;
+		case second_region_StateD:
+			exitSequence_second_region_StateD();
+			break;
+		default:
+			break;
+		}
+	}
+	
+	/* The reactions of state StateA. */
+	private void react_main_region_StateA() {
+		if (check_main_region_StateA_tr0_tr0()) {
+			effect_main_region_StateA_tr0();
+		}
+	}
+	
+	/* The reactions of state StateB. */
+	private void react_main_region_StateB() {
+	}
+	
+	/* The reactions of state StateC. */
+	private void react_second_region_StateC() {
+		if (check_second_region_StateC_tr0_tr0()) {
+			effect_second_region_StateC_tr0();
+		}
+	}
+	
+	/* The reactions of state StateD. */
+	private void react_second_region_StateD() {
+	}
+	
+	/* Default react sequence for initial entry  */
+	private void react_main_region__entry_Default() {
+		enterSequence_main_region_StateA_default();
+	}
+	
+	/* Default react sequence for initial entry  */
+	private void react_second_region__entry_Default() {
+		enterSequence_second_region_StateC_default();
+	}
+	
+	public void runCycle() {
+		if (!initialized)
+			throw new IllegalStateException(
+					"The state machine needs to be initialized first by calling the init() function.");
+	
+		clearOutEvents();
+		singleCycle();
+		clearEvents();
+		
+	}
+	
+	protected void singleCycle() {
+		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
+			switch (stateVector[nextStateIndex]) {
+			case main_region_StateA:
+				react_main_region_StateA();
+				break;
+			case main_region_StateB:
+				react_main_region_StateB();
+				break;
+			case second_region_StateC:
+				react_second_region_StateC();
+				break;
+			case second_region_StateD:
+				react_second_region_StateD();
+				break;
+			default:
+				// $NullState$
+			}
+		}
+	}
+}

+ 17 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/eventdrivenoutevents/IEventDrivenOutEventsStatemachine.java

@@ -0,0 +1,17 @@
+package org.yakindu.scr.eventdrivenoutevents;
+
+import org.yakindu.scr.IStatemachine;
+
+public interface IEventDrivenOutEventsStatemachine extends IStatemachine {
+
+	public interface SCInterface {
+	
+		public void raiseE1();
+		
+		public boolean isRaisedE2();
+		
+	}
+	
+	public SCInterface getSCInterface();
+	
+}

+ 15 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/localevents/ILocalEventsStatemachine.java

@@ -0,0 +1,15 @@
+package org.yakindu.scr.localevents;
+
+import org.yakindu.scr.IStatemachine;
+
+public interface ILocalEventsStatemachine extends IStatemachine {
+
+	public interface SCInterface {
+	
+		public void raiseBUTTON_ON();
+		
+	}
+	
+	public SCInterface getSCInterface();
+	
+}

+ 378 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/localevents/LocalEventsStatemachine.java

@@ -0,0 +1,378 @@
+package org.yakindu.scr.localevents;
+import java.util.LinkedList;
+import java.util.Queue;
+
+public class LocalEventsStatemachine implements ILocalEventsStatemachine {
+
+	protected class SCInterfaceImpl implements SCInterface {
+	
+		private boolean bUTTON_ON;
+		
+		public void raiseBUTTON_ON() {
+			bUTTON_ON = true;
+			runCycle();
+		}
+		
+		protected void clearEvents() {
+			bUTTON_ON = false;
+		}
+	}
+	
+	protected SCInterfaceImpl sCInterface;
+	
+	private boolean initialized = false;
+	
+	public enum State {
+		localEvents_r1_A,
+		localEvents_r1_C,
+		localEvents_r2_idle,
+		localEvents_r2_B,
+		localEvents_r2_D,
+		$NullState$
+	};
+	
+	private final State[] stateVector = new State[2];
+	
+	private int nextStateIndex;
+	
+	
+	private Queue<Runnable> internalEventQueue = new LinkedList<Runnable>();
+	
+	private boolean sTART_B;
+	
+	private boolean sTART_C;
+	
+	public LocalEventsStatemachine() {
+		sCInterface = new SCInterfaceImpl();
+	}
+	
+	public void init() {
+		this.initialized = true;
+		for (int i = 0; i < 2; i++) {
+			stateVector[i] = State.$NullState$;
+		}
+		clearEvents();
+		clearOutEvents();
+	}
+	
+	public void enter() {
+		if (!initialized) {
+			throw new IllegalStateException(
+					"The state machine needs to be initialized first by calling the init() function.");
+		}
+		enterSequence_localEvents_r1_default();
+		enterSequence_localEvents_r2_default();
+	}
+	
+	public void exit() {
+		exitSequence_localEvents_r1();
+		exitSequence_localEvents_r2();
+	}
+	
+	/**
+	 * @see IStatemachine#isActive()
+	 */
+	public boolean isActive() {
+		return stateVector[0] != State.$NullState$||stateVector[1] != State.$NullState$;
+	}
+	
+	/** 
+	* Always returns 'false' since this state machine can never become final.
+	*
+	* @see IStatemachine#isFinal()
+	*/
+	public boolean isFinal() {
+		return false;
+	}
+	/**
+	* This method resets the incoming events (time events included).
+	*/
+	protected void clearEvents() {
+		sCInterface.clearEvents();
+		sTART_B = false;
+		sTART_C = false;
+	}
+	
+	/**
+	* This method resets the outgoing events.
+	*/
+	protected void clearOutEvents() {
+	}
+	
+	/**
+	* Returns true if the given state is currently active otherwise false.
+	*/
+	public boolean isStateActive(State state) {
+	
+		switch (state) {
+		case localEvents_r1_A:
+			return stateVector[0] == State.localEvents_r1_A;
+		case localEvents_r1_C:
+			return stateVector[0] == State.localEvents_r1_C;
+		case localEvents_r2_idle:
+			return stateVector[1] == State.localEvents_r2_idle;
+		case localEvents_r2_B:
+			return stateVector[1] == State.localEvents_r2_B;
+		case localEvents_r2_D:
+			return stateVector[1] == State.localEvents_r2_D;
+		default:
+			return false;
+		}
+	}
+	
+	public SCInterface getSCInterface() {
+		return sCInterface;
+	}
+	
+	private void raiseSTART_B() {
+	
+		internalEventQueue.add( new Runnable() {
+			@Override public void run() {
+				sTART_B = true;					
+				runCycle();
+			}
+		});
+	}
+	
+	
+	private void raiseSTART_C() {
+	
+		internalEventQueue.add( new Runnable() {
+			@Override public void run() {
+				sTART_C = true;					
+				runCycle();
+			}
+		});
+	}
+	
+	
+	public void raiseBUTTON_ON() {
+		sCInterface.raiseBUTTON_ON();
+	}
+	
+	private boolean check_localEvents_r1_A_lr0_lr0() {
+		return sCInterface.bUTTON_ON;
+	}
+	
+	private boolean check_localEvents_r1_A_tr0_tr0() {
+		return sTART_C;
+	}
+	
+	private boolean check_localEvents_r2_idle_tr0_tr0() {
+		return sTART_B;
+	}
+	
+	private boolean check_localEvents_r2_B_tr0_tr0() {
+		return sTART_C;
+	}
+	
+	private void effect_localEvents_r1_A_lr0_lr0() {
+		raiseSTART_B();
+	}
+	
+	private void effect_localEvents_r1_A_tr0() {
+		exitSequence_localEvents_r1_A();
+		enterSequence_localEvents_r1_C_default();
+	}
+	
+	private void effect_localEvents_r2_idle_tr0() {
+		exitSequence_localEvents_r2_idle();
+		enterSequence_localEvents_r2_B_default();
+	}
+	
+	private void effect_localEvents_r2_B_tr0() {
+		exitSequence_localEvents_r2_B();
+		enterSequence_localEvents_r2_D_default();
+	}
+	
+	/* Entry action for state 'B'. */
+	private void entryAction_localEvents_r2_B() {
+		raiseSTART_C();
+	}
+	
+	/* 'default' enter sequence for state A */
+	private void enterSequence_localEvents_r1_A_default() {
+		nextStateIndex = 0;
+		stateVector[0] = State.localEvents_r1_A;
+	}
+	
+	/* 'default' enter sequence for state C */
+	private void enterSequence_localEvents_r1_C_default() {
+		nextStateIndex = 0;
+		stateVector[0] = State.localEvents_r1_C;
+	}
+	
+	/* 'default' enter sequence for state idle */
+	private void enterSequence_localEvents_r2_idle_default() {
+		nextStateIndex = 1;
+		stateVector[1] = State.localEvents_r2_idle;
+	}
+	
+	/* 'default' enter sequence for state B */
+	private void enterSequence_localEvents_r2_B_default() {
+		entryAction_localEvents_r2_B();
+		nextStateIndex = 1;
+		stateVector[1] = State.localEvents_r2_B;
+	}
+	
+	/* 'default' enter sequence for state D */
+	private void enterSequence_localEvents_r2_D_default() {
+		nextStateIndex = 1;
+		stateVector[1] = State.localEvents_r2_D;
+	}
+	
+	/* 'default' enter sequence for region r1 */
+	private void enterSequence_localEvents_r1_default() {
+		react_localEvents_r1__entry_Default();
+	}
+	
+	/* 'default' enter sequence for region r2 */
+	private void enterSequence_localEvents_r2_default() {
+		react_localEvents_r2__entry_Default();
+	}
+	
+	/* Default exit sequence for state A */
+	private void exitSequence_localEvents_r1_A() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+	
+	/* Default exit sequence for state C */
+	private void exitSequence_localEvents_r1_C() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+	
+	/* Default exit sequence for state idle */
+	private void exitSequence_localEvents_r2_idle() {
+		nextStateIndex = 1;
+		stateVector[1] = State.$NullState$;
+	}
+	
+	/* Default exit sequence for state B */
+	private void exitSequence_localEvents_r2_B() {
+		nextStateIndex = 1;
+		stateVector[1] = State.$NullState$;
+	}
+	
+	/* Default exit sequence for state D */
+	private void exitSequence_localEvents_r2_D() {
+		nextStateIndex = 1;
+		stateVector[1] = State.$NullState$;
+	}
+	
+	/* Default exit sequence for region r1 */
+	private void exitSequence_localEvents_r1() {
+		switch (stateVector[0]) {
+		case localEvents_r1_A:
+			exitSequence_localEvents_r1_A();
+			break;
+		case localEvents_r1_C:
+			exitSequence_localEvents_r1_C();
+			break;
+		default:
+			break;
+		}
+	}
+	
+	/* Default exit sequence for region r2 */
+	private void exitSequence_localEvents_r2() {
+		switch (stateVector[1]) {
+		case localEvents_r2_idle:
+			exitSequence_localEvents_r2_idle();
+			break;
+		case localEvents_r2_B:
+			exitSequence_localEvents_r2_B();
+			break;
+		case localEvents_r2_D:
+			exitSequence_localEvents_r2_D();
+			break;
+		default:
+			break;
+		}
+	}
+	
+	/* The reactions of state A. */
+	private void react_localEvents_r1_A() {
+		if (check_localEvents_r1_A_tr0_tr0()) {
+			effect_localEvents_r1_A_tr0();
+		} else {
+			if (check_localEvents_r1_A_lr0_lr0()) {
+				effect_localEvents_r1_A_lr0_lr0();
+			}
+		}
+	}
+	
+	/* The reactions of state C. */
+	private void react_localEvents_r1_C() {
+	}
+	
+	/* The reactions of state idle. */
+	private void react_localEvents_r2_idle() {
+		if (check_localEvents_r2_idle_tr0_tr0()) {
+			effect_localEvents_r2_idle_tr0();
+		}
+	}
+	
+	/* The reactions of state B. */
+	private void react_localEvents_r2_B() {
+		if (check_localEvents_r2_B_tr0_tr0()) {
+			effect_localEvents_r2_B_tr0();
+		}
+	}
+	
+	/* The reactions of state D. */
+	private void react_localEvents_r2_D() {
+	}
+	
+	/* Default react sequence for initial entry  */
+	private void react_localEvents_r1__entry_Default() {
+		enterSequence_localEvents_r1_A_default();
+	}
+	
+	/* Default react sequence for initial entry  */
+	private void react_localEvents_r2__entry_Default() {
+		enterSequence_localEvents_r2_idle_default();
+	}
+	
+	public void runCycle() {
+		if (!initialized)
+			throw new IllegalStateException(
+					"The state machine needs to be initialized first by calling the init() function.");
+	
+		clearOutEvents();
+		singleCycle();
+		clearEvents();
+		
+		// process queued events
+		while (internalEventQueue.size() > 0) {
+			internalEventQueue.poll().run();
+			singleCycle();
+			clearEvents();
+		}
+	}
+	
+	protected void singleCycle() {
+		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
+			switch (stateVector[nextStateIndex]) {
+			case localEvents_r1_A:
+				react_localEvents_r1_A();
+				break;
+			case localEvents_r1_C:
+				react_localEvents_r1_C();
+				break;
+			case localEvents_r2_idle:
+				react_localEvents_r2_idle();
+				break;
+			case localEvents_r2_B:
+				react_localEvents_r2_B();
+				break;
+			case localEvents_r2_D:
+				react_localEvents_r2_D();
+				break;
+			default:
+				// $NullState$
+			}
+		}
+	}
+}

+ 2 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/transitionwithoutcondition/TransitionWithoutConditionStatemachine.java

@@ -14,6 +14,8 @@ public class TransitionWithoutConditionStatemachine implements ITransitionWithou
 	
 	private int nextStateIndex;
 	
+	
+	
 	public TransitionWithoutConditionStatemachine() {
 	}
 	

+ 3 - 0
test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/AllTests.java

@@ -30,8 +30,10 @@ import org.junit.runners.Suite.SuiteClasses;
 	EntryChoice.class,
 	EntryExitSelfTransition.class,
 	EntryReactionAction.class,
+	EventDrivenInternalEvent.class,
 	EventDrivenTriggeredByEvent.class,
 	EventDrivenTriggeredByTimeEvent.class,
+	EventDrivenOutEvents.class,
 	ExitOnSelfTransition.class,
 	ExitState.class,
 	FeatureCalls.class,
@@ -48,6 +50,7 @@ import org.junit.runners.Suite.SuiteClasses;
 	LocalReactions.class,
 	LogicalAndTests.class,
 	LogicalOrTests.class,
+	LocalEvents.class,
 	NamedInterfaceAccess.class,
 	OperationsTest.class,
 	OutEventLifeCycle.class,

+ 42 - 0
test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/EventDrivenOutEvents.java

@@ -0,0 +1,42 @@
+/* Generated by YAKINDU Statechart Tools code generator. */
+
+package org.yakindu.sct.generator.java.test;
+
+import org.junit.*;
+import static org.junit.Assert.*;
+import org.yakindu.scr.eventdrivenoutevents.EventDrivenOutEventsStatemachine;
+import org.yakindu.scr.eventdrivenoutevents.EventDrivenOutEventsStatemachine.State;	
+import org.yakindu.scr.VirtualTimer;
+
+/**
+ * Unit TestCase for EventDrivenOutEvents
+ */
+@SuppressWarnings("all")
+public class EventDrivenOutEvents {
+	
+	private EventDrivenOutEventsStatemachine statemachine;	
+	
+	
+	@Before
+	public void eventDrivenOutEvents_setUp() {
+		statemachine = new EventDrivenOutEventsStatemachine();
+		statemachine.init();
+	}
+
+	@After
+	public void eventDrivenOutEvents_tearDown() {
+		statemachine = null;
+		
+	}
+	
+	@Test
+	public void test() {
+		statemachine.enter();
+		assertTrue(statemachine.isStateActive(State.main_region_StateA));
+		assertTrue(statemachine.isStateActive(State.second_region_StateC));
+		statemachine.getSCInterface().raiseE1();
+		assertTrue(statemachine.isStateActive(State.main_region_StateB));
+		assertTrue(statemachine.isStateActive(State.second_region_StateD));
+		statemachine.exit();
+	}
+}

+ 42 - 0
test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/LocalEvents.java

@@ -0,0 +1,42 @@
+/* Generated by YAKINDU Statechart Tools code generator. */
+
+package org.yakindu.sct.generator.java.test;
+
+import org.junit.*;
+import static org.junit.Assert.*;
+import org.yakindu.scr.localevents.LocalEventsStatemachine;
+import org.yakindu.scr.localevents.LocalEventsStatemachine.State;	
+import org.yakindu.scr.VirtualTimer;
+
+/**
+ * Unit TestCase for localEvents
+ */
+@SuppressWarnings("all")
+public class LocalEvents {
+	
+	private LocalEventsStatemachine statemachine;	
+	
+	
+	@Before
+	public void localEvents_setUp() {
+		statemachine = new LocalEventsStatemachine();
+		statemachine.init();
+	}
+
+	@After
+	public void localEvents_tearDown() {
+		statemachine = null;
+		
+	}
+	
+	@Test
+	public void test() {
+		statemachine.enter();
+		assertTrue(statemachine.isStateActive(State.localEvents_r1_A));
+		assertTrue(statemachine.isStateActive(State.localEvents_r2_idle));
+		statemachine.getSCInterface().raiseBUTTON_ON();
+		assertTrue(statemachine.isStateActive(State.localEvents_r1_C));
+		assertTrue(statemachine.isStateActive(State.localEvents_r2_D));
+		statemachine.exit();
+	}
+}

+ 220 - 0
test-plugins/org.yakindu.sct.test.models/testmodels/SCTUnit/eventdriven/LocalEvents.sct

@@ -0,0 +1,220 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:sgraph="http://www.yakindu.org/sct/sgraph/2.0.0">
+  <sgraph:Statechart xmi:id="_bcpD0CkeEeiYXM7gQPaJPA" specification="namespace eventdriven&#xA;@EventDriven&#xA;&#xA;interface:&#xA;// Define events and&#xA;// and variables here. &#xA;//Use CTRL + Space for content assist.&#xA;&#xA;in event BUTTON_ON&#xA;&#xA;internal:&#xA;event START_B&#xA;event START_C&#xA;" namespace="eventdriven" name="localEvents">
+    <regions xmi:id="_bcwYkykeEeiYXM7gQPaJPA" name="r1">
+      <vertices xsi:type="sgraph:Entry" xmi:id="_bc4UYSkeEeiYXM7gQPaJPA">
+        <outgoingTransitions xmi:id="_bc6wpSkeEeiYXM7gQPaJPA" target="_bc5ihCkeEeiYXM7gQPaJPA"/>
+      </vertices>
+      <vertices xsi:type="sgraph:State" xmi:id="_bc5ihCkeEeiYXM7gQPaJPA" specification="BUTTON_ON/ raise START_B" name="A" incomingTransitions="_bc6wpSkeEeiYXM7gQPaJPA">
+        <outgoingTransitions xmi:id="_c2iO8ikeEeiYXM7gQPaJPA" specification="START_C" target="_c2hn4CkeEeiYXM7gQPaJPA"/>
+      </vertices>
+      <vertices xsi:type="sgraph:State" xmi:id="_c2hn4CkeEeiYXM7gQPaJPA" name="C" incomingTransitions="_c2iO8ikeEeiYXM7gQPaJPA"/>
+    </regions>
+    <regions xmi:id="_jYccwCkeEeiYXM7gQPaJPA" name="r2">
+      <vertices xsi:type="sgraph:Entry" xmi:id="_lYheICkeEeiYXM7gQPaJPA">
+        <outgoingTransitions xmi:id="_m2ROgCkeEeiYXM7gQPaJPA" target="_m2NkICkeEeiYXM7gQPaJPA"/>
+      </vertices>
+      <vertices xsi:type="sgraph:State" xmi:id="_m2NkICkeEeiYXM7gQPaJPA" name="idle" incomingTransitions="_m2ROgCkeEeiYXM7gQPaJPA">
+        <outgoingTransitions xmi:id="_n03kwikeEeiYXM7gQPaJPA" specification="START_B" target="_n029sCkeEeiYXM7gQPaJPA"/>
+      </vertices>
+      <vertices xsi:type="sgraph:State" xmi:id="_n029sCkeEeiYXM7gQPaJPA" specification="entry / raise START_C" name="B" incomingTransitions="_n03kwikeEeiYXM7gQPaJPA">
+        <outgoingTransitions xmi:id="_-oiLACupEeiYXM7gQPaJPA" specification="START_C" target="_-oV9wCupEeiYXM7gQPaJPA"/>
+      </vertices>
+      <vertices xsi:type="sgraph:State" xmi:id="_-oV9wCupEeiYXM7gQPaJPA" name="D" incomingTransitions="_-oiLACupEeiYXM7gQPaJPA"/>
+    </regions>
+  </sgraph:Statechart>
+  <notation:Diagram xmi:id="_bcwYkCkeEeiYXM7gQPaJPA" type="org.yakindu.sct.ui.editor.editor.StatechartDiagramEditor" element="_bcpD0CkeEeiYXM7gQPaJPA" measurementUnit="Pixel">
+    <children xmi:id="_bczb4CkeEeiYXM7gQPaJPA" type="Region" element="_bcwYkykeEeiYXM7gQPaJPA">
+      <children xsi:type="notation:DecorationNode" xmi:id="_bc14ICkeEeiYXM7gQPaJPA" type="RegionName">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_bc14ISkeEeiYXM7gQPaJPA"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_bc14IikeEeiYXM7gQPaJPA"/>
+      </children>
+      <children xsi:type="notation:Shape" xmi:id="_bc2fMCkeEeiYXM7gQPaJPA" type="RegionCompartment" fontName="Verdana" lineColor="4210752">
+        <children xmi:id="_bc47cCkeEeiYXM7gQPaJPA" type="Entry" element="_bc4UYSkeEeiYXM7gQPaJPA">
+          <children xmi:id="_bc47dCkeEeiYXM7gQPaJPA" type="BorderItemLabelContainer">
+            <children xsi:type="notation:DecorationNode" xmi:id="_bc5igCkeEeiYXM7gQPaJPA" type="BorderItemLabel">
+              <styles xsi:type="notation:ShapeStyle" xmi:id="_bc5igSkeEeiYXM7gQPaJPA"/>
+              <layoutConstraint xsi:type="notation:Location" xmi:id="_bc5igikeEeiYXM7gQPaJPA"/>
+            </children>
+            <styles xsi:type="notation:ShapeStyle" xmi:id="_bc47dSkeEeiYXM7gQPaJPA" fontName="Verdana" lineColor="4210752"/>
+            <layoutConstraint xsi:type="notation:Bounds" xmi:id="_bc47dikeEeiYXM7gQPaJPA"/>
+          </children>
+          <styles xsi:type="notation:ShapeStyle" xmi:id="_bc47cSkeEeiYXM7gQPaJPA" fontName="Verdana" fillColor="0" lineColor="16777215"/>
+          <styles xsi:type="notation:NamedStyle" xmi:id="_bc47cikeEeiYXM7gQPaJPA" name="allowColors"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_bc5igykeEeiYXM7gQPaJPA" x="97" y="21"/>
+        </children>
+        <children xmi:id="_bc6JkSkeEeiYXM7gQPaJPA" type="State" element="_bc5ihCkeEeiYXM7gQPaJPA">
+          <children xsi:type="notation:DecorationNode" xmi:id="_bc6JlSkeEeiYXM7gQPaJPA" type="StateName">
+            <styles xsi:type="notation:ShapeStyle" xmi:id="_bc6JlikeEeiYXM7gQPaJPA"/>
+            <layoutConstraint xsi:type="notation:Location" xmi:id="_bc6JlykeEeiYXM7gQPaJPA"/>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_bc6JmCkeEeiYXM7gQPaJPA" type="StateTextCompartment">
+            <children xsi:type="notation:Shape" xmi:id="_bc6woCkeEeiYXM7gQPaJPA" type="StateTextCompartmentExpression" fontName="Verdana" lineColor="4210752">
+              <layoutConstraint xsi:type="notation:Bounds" xmi:id="_bc6woSkeEeiYXM7gQPaJPA"/>
+            </children>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_bc6woikeEeiYXM7gQPaJPA" type="StateFigureCompartment"/>
+          <styles xsi:type="notation:ShapeStyle" xmi:id="_bc6JkikeEeiYXM7gQPaJPA" fontName="Verdana" fillColor="15981773" lineColor="12632256"/>
+          <styles xsi:type="notation:FontStyle" xmi:id="_bc6JkykeEeiYXM7gQPaJPA"/>
+          <styles xsi:type="notation:BooleanValueStyle" xmi:id="_bc6woykeEeiYXM7gQPaJPA" name="isHorizontal" booleanValue="true"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_bc6wpCkeEeiYXM7gQPaJPA" x="40" y="80"/>
+        </children>
+        <children xmi:id="_c2nugCkeEeiYXM7gQPaJPA" type="State" element="_c2hn4CkeEeiYXM7gQPaJPA">
+          <children xsi:type="notation:DecorationNode" xmi:id="_c2oVkCkeEeiYXM7gQPaJPA" type="StateName">
+            <styles xsi:type="notation:ShapeStyle" xmi:id="_c2oVkSkeEeiYXM7gQPaJPA"/>
+            <layoutConstraint xsi:type="notation:Location" xmi:id="_c2oVkikeEeiYXM7gQPaJPA"/>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_c2oVkykeEeiYXM7gQPaJPA" type="StateTextCompartment">
+            <children xsi:type="notation:Shape" xmi:id="_c2oVlCkeEeiYXM7gQPaJPA" type="StateTextCompartmentExpression" fontName="Verdana" lineColor="4210752">
+              <layoutConstraint xsi:type="notation:Bounds" xmi:id="_c2oVlSkeEeiYXM7gQPaJPA"/>
+            </children>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_c2o8oCkeEeiYXM7gQPaJPA" type="StateFigureCompartment"/>
+          <styles xsi:type="notation:ShapeStyle" xmi:id="_c2nugSkeEeiYXM7gQPaJPA" fontName="Verdana" fillColor="15981773" lineColor="12632256"/>
+          <styles xsi:type="notation:FontStyle" xmi:id="_c2nugikeEeiYXM7gQPaJPA"/>
+          <styles xsi:type="notation:BooleanValueStyle" xmi:id="_c2o8oSkeEeiYXM7gQPaJPA" name="isHorizontal" booleanValue="true"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_c2nugykeEeiYXM7gQPaJPA" x="105" y="173"/>
+        </children>
+        <layoutConstraint xsi:type="notation:Bounds" xmi:id="_bc2fMSkeEeiYXM7gQPaJPA"/>
+      </children>
+      <styles xsi:type="notation:ShapeStyle" xmi:id="_bczb4SkeEeiYXM7gQPaJPA" fontName="Verdana" fillColor="15790320" lineColor="12632256"/>
+      <layoutConstraint xsi:type="notation:Bounds" xmi:id="_bc4UYCkeEeiYXM7gQPaJPA" x="220" y="10" width="289" height="307"/>
+    </children>
+    <children xsi:type="notation:Shape" xmi:id="_bc8l0CkeEeiYXM7gQPaJPA" type="StatechartText" fontName="Verdana" lineColor="4210752">
+      <children xsi:type="notation:DecorationNode" xmi:id="_bc8l0ikeEeiYXM7gQPaJPA" type="StatechartName">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_bc8l0ykeEeiYXM7gQPaJPA"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_bc8l1CkeEeiYXM7gQPaJPA"/>
+      </children>
+      <children xsi:type="notation:Shape" xmi:id="_bc8l1SkeEeiYXM7gQPaJPA" type="StatechartTextExpression" fontName="Verdana" lineColor="4210752">
+        <layoutConstraint xsi:type="notation:Bounds" xmi:id="_bc8l1ikeEeiYXM7gQPaJPA"/>
+      </children>
+      <layoutConstraint xsi:type="notation:Bounds" xmi:id="_bc9M4CkeEeiYXM7gQPaJPA" x="10" y="10" width="200" height="307"/>
+    </children>
+    <children xmi:id="_jYdq4CkeEeiYXM7gQPaJPA" type="Region" element="_jYccwCkeEeiYXM7gQPaJPA">
+      <children xsi:type="notation:DecorationNode" xmi:id="_jYeR8CkeEeiYXM7gQPaJPA" type="RegionName">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_jYeR8SkeEeiYXM7gQPaJPA"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_jYeR8ikeEeiYXM7gQPaJPA"/>
+      </children>
+      <children xsi:type="notation:Shape" xmi:id="_jYe5ACkeEeiYXM7gQPaJPA" type="RegionCompartment" fontName="Verdana" lineColor="4210752">
+        <children xmi:id="_lYj6YCkeEeiYXM7gQPaJPA" type="Entry" element="_lYheICkeEeiYXM7gQPaJPA">
+          <children xmi:id="_lYkhcCkeEeiYXM7gQPaJPA" type="BorderItemLabelContainer">
+            <children xsi:type="notation:DecorationNode" xmi:id="_lYkhcykeEeiYXM7gQPaJPA" type="BorderItemLabel">
+              <styles xsi:type="notation:ShapeStyle" xmi:id="_lYkhdCkeEeiYXM7gQPaJPA"/>
+              <layoutConstraint xsi:type="notation:Location" xmi:id="_lYlIgCkeEeiYXM7gQPaJPA"/>
+            </children>
+            <styles xsi:type="notation:ShapeStyle" xmi:id="_lYkhcSkeEeiYXM7gQPaJPA" fontName="Verdana" lineColor="4210752"/>
+            <layoutConstraint xsi:type="notation:Bounds" xmi:id="_lYkhcikeEeiYXM7gQPaJPA"/>
+          </children>
+          <styles xsi:type="notation:ShapeStyle" xmi:id="_lYj6YSkeEeiYXM7gQPaJPA" fontName="Verdana" fillColor="0" lineColor="16777215"/>
+          <styles xsi:type="notation:NamedStyle" xmi:id="_lYj6YikeEeiYXM7gQPaJPA" name="allowColors"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_lYj6YykeEeiYXM7gQPaJPA" x="91" y="17"/>
+        </children>
+        <children xmi:id="_m2OLMCkeEeiYXM7gQPaJPA" type="State" element="_m2NkICkeEeiYXM7gQPaJPA">
+          <children xsi:type="notation:DecorationNode" xmi:id="_m2OyQCkeEeiYXM7gQPaJPA" type="StateName">
+            <styles xsi:type="notation:ShapeStyle" xmi:id="_m2OyQSkeEeiYXM7gQPaJPA"/>
+            <layoutConstraint xsi:type="notation:Location" xmi:id="_m2OyQikeEeiYXM7gQPaJPA"/>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_m2OyQykeEeiYXM7gQPaJPA" type="StateTextCompartment">
+            <children xsi:type="notation:Shape" xmi:id="_m2OyRCkeEeiYXM7gQPaJPA" type="StateTextCompartmentExpression" fontName="Verdana" lineColor="4210752">
+              <layoutConstraint xsi:type="notation:Bounds" xmi:id="_m2OyRSkeEeiYXM7gQPaJPA"/>
+            </children>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_m2OyRikeEeiYXM7gQPaJPA" type="StateFigureCompartment"/>
+          <styles xsi:type="notation:ShapeStyle" xmi:id="_m2OLMSkeEeiYXM7gQPaJPA" fontName="Verdana" fillColor="15981773" lineColor="12632256"/>
+          <styles xsi:type="notation:FontStyle" xmi:id="_m2OLMikeEeiYXM7gQPaJPA"/>
+          <styles xsi:type="notation:BooleanValueStyle" xmi:id="_m2OyRykeEeiYXM7gQPaJPA" name="isHorizontal" booleanValue="true"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_m2OLMykeEeiYXM7gQPaJPA" x="81" y="89"/>
+        </children>
+        <children xmi:id="_n06BACkeEeiYXM7gQPaJPA" type="State" element="_n029sCkeEeiYXM7gQPaJPA">
+          <children xsi:type="notation:DecorationNode" xmi:id="_n06BBCkeEeiYXM7gQPaJPA" type="StateName">
+            <styles xsi:type="notation:ShapeStyle" xmi:id="_n06BBSkeEeiYXM7gQPaJPA"/>
+            <layoutConstraint xsi:type="notation:Location" xmi:id="_n06BBikeEeiYXM7gQPaJPA"/>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_n06BBykeEeiYXM7gQPaJPA" type="StateTextCompartment">
+            <children xsi:type="notation:Shape" xmi:id="_n06BCCkeEeiYXM7gQPaJPA" type="StateTextCompartmentExpression" fontName="Verdana" lineColor="4210752">
+              <layoutConstraint xsi:type="notation:Bounds" xmi:id="_n06BCSkeEeiYXM7gQPaJPA"/>
+            </children>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_n06oECkeEeiYXM7gQPaJPA" type="StateFigureCompartment"/>
+          <styles xsi:type="notation:ShapeStyle" xmi:id="_n06BASkeEeiYXM7gQPaJPA" fontName="Verdana" fillColor="15981773" lineColor="12632256"/>
+          <styles xsi:type="notation:FontStyle" xmi:id="_n06BAikeEeiYXM7gQPaJPA"/>
+          <styles xsi:type="notation:BooleanValueStyle" xmi:id="_n06oESkeEeiYXM7gQPaJPA" name="isHorizontal" booleanValue="true"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_n06BAykeEeiYXM7gQPaJPA" x="41" y="197"/>
+        </children>
+        <children xmi:id="_-oa2QCupEeiYXM7gQPaJPA" type="State" element="_-oV9wCupEeiYXM7gQPaJPA">
+          <children xsi:type="notation:DecorationNode" xmi:id="_-obdUCupEeiYXM7gQPaJPA" type="StateName">
+            <styles xsi:type="notation:ShapeStyle" xmi:id="_-obdUSupEeiYXM7gQPaJPA"/>
+            <layoutConstraint xsi:type="notation:Location" xmi:id="_-obdUiupEeiYXM7gQPaJPA"/>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_-obdUyupEeiYXM7gQPaJPA" type="StateTextCompartment">
+            <children xsi:type="notation:Shape" xmi:id="_-obdVCupEeiYXM7gQPaJPA" type="StateTextCompartmentExpression" fontName="Verdana" lineColor="4210752">
+              <layoutConstraint xsi:type="notation:Bounds" xmi:id="_-obdVSupEeiYXM7gQPaJPA"/>
+            </children>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_-obdViupEeiYXM7gQPaJPA" type="StateFigureCompartment"/>
+          <styles xsi:type="notation:ShapeStyle" xmi:id="_-oa2QSupEeiYXM7gQPaJPA" fontName="Verdana" fillColor="15981773" lineColor="12632256"/>
+          <styles xsi:type="notation:FontStyle" xmi:id="_-oa2QiupEeiYXM7gQPaJPA"/>
+          <styles xsi:type="notation:BooleanValueStyle" xmi:id="_-ocEYCupEeiYXM7gQPaJPA" name="isHorizontal" booleanValue="true"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_-oa2QyupEeiYXM7gQPaJPA" x="81" y="325"/>
+        </children>
+        <layoutConstraint xsi:type="notation:Bounds" xmi:id="_jYe5ASkeEeiYXM7gQPaJPA"/>
+      </children>
+      <styles xsi:type="notation:ShapeStyle" xmi:id="_jYdq4SkeEeiYXM7gQPaJPA" fontName="Verdana" fillColor="15790320" lineColor="12632256"/>
+      <layoutConstraint xsi:type="notation:Bounds" xmi:id="_jYdq4ikeEeiYXM7gQPaJPA" x="516" y="10" width="265" height="467"/>
+    </children>
+    <styles xsi:type="notation:BooleanValueStyle" xmi:id="_bcwYkSkeEeiYXM7gQPaJPA" name="inlineDefinitionSection" booleanValue="true"/>
+    <styles xsi:type="notation:DiagramStyle" xmi:id="_bcwYkikeEeiYXM7gQPaJPA"/>
+    <edges xmi:id="_bc7-wCkeEeiYXM7gQPaJPA" type="Transition" element="_bc6wpSkeEeiYXM7gQPaJPA" source="_bc47cCkeEeiYXM7gQPaJPA" target="_bc6JkSkeEeiYXM7gQPaJPA">
+      <children xsi:type="notation:DecorationNode" xmi:id="_bc7-xCkeEeiYXM7gQPaJPA" type="TransitionExpression">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_bc7-xSkeEeiYXM7gQPaJPA"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_bc7-xikeEeiYXM7gQPaJPA" x="15" y="3"/>
+      </children>
+      <styles xsi:type="notation:ConnectorStyle" xmi:id="_bc7-wSkeEeiYXM7gQPaJPA" routing="Rectilinear" lineColor="4210752"/>
+      <styles xsi:type="notation:FontStyle" xmi:id="_bc7-wykeEeiYXM7gQPaJPA" fontName="Verdana"/>
+      <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_bc7-wikeEeiYXM7gQPaJPA" points="[7, 2, -6, -74]$[0, 2, -13, -74]$[0, 52, -13, -24]"/>
+      <sourceAnchor xsi:type="notation:IdentityAnchor" xmi:id="_7lXTwCkeEeiYXM7gQPaJPA" id="(0.5,0.5)"/>
+    </edges>
+    <edges xmi:id="_c2tOECkeEeiYXM7gQPaJPA" type="Transition" element="_c2iO8ikeEeiYXM7gQPaJPA" source="_bc6JkSkeEeiYXM7gQPaJPA" target="_c2nugCkeEeiYXM7gQPaJPA">
+      <children xsi:type="notation:DecorationNode" xmi:id="_c2tOFCkeEeiYXM7gQPaJPA" type="TransitionExpression">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_c2tOFSkeEeiYXM7gQPaJPA"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_c2tOFikeEeiYXM7gQPaJPA" y="-32"/>
+      </children>
+      <styles xsi:type="notation:ConnectorStyle" xmi:id="_c2tOESkeEeiYXM7gQPaJPA" routing="Rectilinear" lineColor="4210752"/>
+      <styles xsi:type="notation:FontStyle" xmi:id="_c2tOEykeEeiYXM7gQPaJPA" fontName="Verdana"/>
+      <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_c2tOEikeEeiYXM7gQPaJPA" points="[-14, -24, 46, 83]$[-59, -104, 1, 3]"/>
+      <targetAnchor xsi:type="notation:IdentityAnchor" xmi:id="_37d04CkeEeiYXM7gQPaJPA" id="(0.5,0.5)"/>
+    </edges>
+    <edges xmi:id="_m2TDsCkeEeiYXM7gQPaJPA" type="Transition" element="_m2ROgCkeEeiYXM7gQPaJPA" source="_lYj6YCkeEeiYXM7gQPaJPA" target="_m2OLMCkeEeiYXM7gQPaJPA">
+      <children xsi:type="notation:DecorationNode" xmi:id="_m2TqwCkeEeiYXM7gQPaJPA" type="TransitionExpression">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_m2TqwSkeEeiYXM7gQPaJPA"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_m2TqwikeEeiYXM7gQPaJPA" y="10"/>
+      </children>
+      <styles xsi:type="notation:ConnectorStyle" xmi:id="_m2TDsSkeEeiYXM7gQPaJPA" routing="Rectilinear" lineColor="4210752"/>
+      <styles xsi:type="notation:FontStyle" xmi:id="_m2TDsykeEeiYXM7gQPaJPA" fontName="Verdana"/>
+      <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_m2TDsikeEeiYXM7gQPaJPA" points="[-6, -4, 86, 51]$[-89, -54, 3, 1]"/>
+      <sourceAnchor xsi:type="notation:IdentityAnchor" xmi:id="_80ARICkeEeiYXM7gQPaJPA" id="(0.5,0.5)"/>
+      <targetAnchor xsi:type="notation:IdentityAnchor" xmi:id="_9CmGwCkeEeiYXM7gQPaJPA" id="(0.5,0.5)"/>
+    </edges>
+    <edges xmi:id="_n08dQCkeEeiYXM7gQPaJPA" type="Transition" element="_n03kwikeEeiYXM7gQPaJPA" source="_m2OLMCkeEeiYXM7gQPaJPA" target="_n06BACkeEeiYXM7gQPaJPA">
+      <children xsi:type="notation:DecorationNode" xmi:id="_n08dRCkeEeiYXM7gQPaJPA" type="TransitionExpression">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_n08dRSkeEeiYXM7gQPaJPA"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_n08dRikeEeiYXM7gQPaJPA" y="-28"/>
+      </children>
+      <styles xsi:type="notation:ConnectorStyle" xmi:id="_n08dQSkeEeiYXM7gQPaJPA" routing="Rectilinear" lineColor="4210752"/>
+      <styles xsi:type="notation:FontStyle" xmi:id="_n08dQykeEeiYXM7gQPaJPA" fontName="Verdana"/>
+      <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_n08dQikeEeiYXM7gQPaJPA" points="[-17, -24, 94, 132]$[-109, -153, 2, 3]"/>
+      <sourceAnchor xsi:type="notation:IdentityAnchor" xmi:id="_9CmGwSkeEeiYXM7gQPaJPA" id="(0.5,0.5)"/>
+      <targetAnchor xsi:type="notation:IdentityAnchor" xmi:id="_oKIqICkeEeiYXM7gQPaJPA" id="(0.5,0.5)"/>
+    </edges>
+    <edges xmi:id="_-oiyECupEeiYXM7gQPaJPA" type="Transition" element="_-oiLACupEeiYXM7gQPaJPA" source="_n06BACkeEeiYXM7gQPaJPA" target="_-oa2QCupEeiYXM7gQPaJPA">
+      <children xsi:type="notation:DecorationNode" xmi:id="_-oiyFCupEeiYXM7gQPaJPA" type="TransitionExpression">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_-oiyFSupEeiYXM7gQPaJPA"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_-oiyFiupEeiYXM7gQPaJPA" x="-2" y="28"/>
+      </children>
+      <styles xsi:type="notation:ConnectorStyle" xmi:id="_-oiyESupEeiYXM7gQPaJPA" routing="Rectilinear" lineColor="4210752"/>
+      <styles xsi:type="notation:FontStyle" xmi:id="_-oiyEyupEeiYXM7gQPaJPA" fontName="Verdana"/>
+      <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_-oiyEiupEeiYXM7gQPaJPA" points="[-12, -24, 94, 200]$[-105, -221, 1, 3]"/>
+      <targetAnchor xsi:type="notation:IdentityAnchor" xmi:id="_F7Z7sCuqEeiYXM7gQPaJPA" id="(0.5,0.5)"/>
+    </edges>
+  </notation:Diagram>
+</xmi:XMI>

+ 2 - 8
test-plugins/org.yakindu.sct.test.models/tests/AllTests.sctunit

@@ -8,15 +8,12 @@ testsuite AllTests {
 	CKeywords,
 	ConditionalExpression,
 	ConstantsTests,
-	
 	ConstOnlyDefaultScope,
 	ConstOnlyInternalScope,
 	ConstOnlyNamedScope,
-	
 	ChildFirstExecutionHierarchy,
 	ChildFirstLocalReactions,
 //	ChildFirstOrthogonalReactions,
-	
 	Declarations, 
 	DeepEntry,
 	DeepHistory,
@@ -26,12 +23,10 @@ testsuite AllTests {
 	EntryChoice,
 	EntryExitSelfTransition,
 	EntryReactionAction,
-	
-//	EventDrivenInternalEvent,
+	EventDrivenInternalEvent,
 	EventDrivenTriggeredByEvent,
 	EventDrivenTriggeredByTimeEvent,
 	EventDrivenOutEvents,
-
 	ExitOnSelfTransition, 
 	ExitState,
 	FeatureCalls,
@@ -48,16 +43,15 @@ testsuite AllTests {
 	LocalReactions,
 	LogicalAndTests, 
 	LogicalOrTests,
+	LocalEvents,
 	NamedInterfaceAccess,
 	OperationsTest,
 //	OperationsWithoutBraces,
 	OutEventLifeCycle,
 	Parenthesis,
-	
 	ParentFirstExecutionHierarchy,
 	ParentFirstLocalReactions,
 //	ParentFirstOrthogonalReactions,
-	
 	PriorityValues,
 	RaiseEvent,
 	ReadOnlyVariable,

+ 17 - 0
test-plugins/org.yakindu.sct.test.models/tests/eventdriven/LocalEvents.sctunit

@@ -0,0 +1,17 @@
+testclass LocalEvents for statechart eventdriven.localEvents {
+	
+	@Test
+	operation test() {
+		enter
+		
+		assert active(eventdriven.localEvents.r1.A)
+		assert active(eventdriven.localEvents.r2.idle)
+		
+		raise BUTTON_ON
+		
+		assert active(eventdriven.localEvents.r1.C)
+		assert active(eventdriven.localEvents.r2.D)
+		
+		exit
+	}
+}