Explorar o código

added const only scope test cases for Java code generator

Axel Terfloth %!s(int64=9) %!d(string=hai) anos
pai
achega
e085c2782b
Modificáronse 16 ficheiros con 1215 adicións e 0 borrados
  1. 10 0
      test-plugins/org.yakindu.sct.generator.java.test/model/cods_test.sgen
  2. 77 0
      test-plugins/org.yakindu.sct.generator.java.test/model/model.declarations.sgen
  3. 27 0
      test-plugins/org.yakindu.sct.generator.java.test/model/model.entries.sgen
  4. 26 0
      test-plugins/org.yakindu.sct.generator.java.test/model/model.expressions.sgen
  5. 29 0
      test-plugins/org.yakindu.sct.generator.java.test/model/test.declarations.sgen
  6. 12 0
      test-plugins/org.yakindu.sct.generator.java.test/model/test.entries.sgen
  7. 12 0
      test-plugins/org.yakindu.sct.generator.java.test/model/test.expressions.sgen
  8. 276 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/constonlydefaultscope/ConstOnlyDefaultScopeStatemachine.java
  9. 22 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/constonlydefaultscope/IConstOnlyDefaultScopeStatemachine.java
  10. 262 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/constonlyinternalscope/ConstOnlyInternalScopeStatemachine.java
  11. 15 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/constonlyinternalscope/IConstOnlyInternalScopeStatemachine.java
  12. 272 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/constonlynamedscope/ConstOnlyNamedScopeStatemachine.java
  13. 22 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/constonlynamedscope/IConstOnlyNamedScopeStatemachine.java
  14. 51 0
      test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/ConstOnlyDefaultScopeTest.java
  15. 51 0
      test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/ConstOnlyInternalScopeTest.java
  16. 51 0
      test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/ConstOnlyNamedScopeTest.java

+ 10 - 0
test-plugins/org.yakindu.sct.generator.java.test/model/cods_test.sgen

@@ -0,0 +1,10 @@
+GeneratorModel for sctunit::java {
+	
+	test ConstOnlyDefaultScope {
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.generator.java.test" 
+			targetFolder = "test-gen"			
+		}			
+		
+	}
+}

+ 77 - 0
test-plugins/org.yakindu.sct.generator.java.test/model/model.declarations.sgen

@@ -0,0 +1,77 @@
+GeneratorModel for yakindu::java {
+
+
+	statechart declarations.ConstOnlyDefaultScope {
+		feature Outlet {
+			targetProject = "org.yakindu.sct.generator.java.test"
+			targetFolder = "src-gen"
+		}
+
+		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 declarations.ConstOnlyNamedScope {
+		feature Outlet {
+			targetProject = "org.yakindu.sct.generator.java.test"
+			targetFolder = "src-gen"
+		}
+
+		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 declarations.ConstOnlyInternalScope {
+		feature Outlet {
+			targetProject = "org.yakindu.sct.generator.java.test"
+			targetFolder = "src-gen"
+		}
+
+		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
+		}
+	}
+}

+ 27 - 0
test-plugins/org.yakindu.sct.generator.java.test/model/model.entries.sgen

@@ -0,0 +1,27 @@
+GeneratorModel for yakindu::java {
+
+	statechart entries.EntryReactionAction {
+		feature Outlet {
+			targetProject = "org.yakindu.sct.generator.java.test"
+			targetFolder = "src-gen"
+		}
+
+		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
+		}
+	}
+
+}

+ 26 - 0
test-plugins/org.yakindu.sct.generator.java.test/model/model.expressions.sgen

@@ -0,0 +1,26 @@
+GeneratorModel for yakindu::java {
+
+	statechart expressions.TriggerExpressionPrecedence {
+		feature Outlet {
+			targetProject = "org.yakindu.sct.generator.java.test"
+			targetFolder = "src-gen"
+		}
+
+		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
+		}
+	}
+}

+ 29 - 0
test-plugins/org.yakindu.sct.generator.java.test/model/test.declarations.sgen

@@ -0,0 +1,29 @@
+GeneratorModel for sctunit::java {
+
+
+	test ConstOnlyInternalScope{
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.generator.java.test" 
+			targetFolder = "test-gen"			
+		}			
+	}	
+	
+	
+	test ConstOnlyDefaultScope{
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.generator.java.test" 
+			targetFolder = "test-gen"			
+		}			
+	}		
+		
+	test ConstOnlyNamedScope{
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.generator.java.test" 
+			targetFolder = "test-gen"			
+		}			
+	}		
+
+}

+ 12 - 0
test-plugins/org.yakindu.sct.generator.java.test/model/test.entries.sgen

@@ -0,0 +1,12 @@
+GeneratorModel for sctunit::java {
+	
+	test EntryReactionAction{
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.generator.java.test" 
+			targetFolder = "test-gen"			
+		}			
+	}
+	
+}
+	

+ 12 - 0
test-plugins/org.yakindu.sct.generator.java.test/model/test.expressions.sgen

@@ -0,0 +1,12 @@
+GeneratorModel for sctunit::java {
+	
+	test TriggerExpressionPrecedence {
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.generator.java.test" 
+			targetFolder = "test-gen"			
+		}			
+	}
+
+
+}

+ 276 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/constonlydefaultscope/ConstOnlyDefaultScopeStatemachine.java

@@ -0,0 +1,276 @@
+package org.yakindu.scr.constonlydefaultscope;
+
+public class ConstOnlyDefaultScopeStatemachine implements IConstOnlyDefaultScopeStatemachine {
+
+	protected class SCInterfaceImpl implements SCInterface {
+
+		public long getB() {
+			return b;
+		}
+
+		public long getC() {
+			return c;
+		}
+
+	}
+
+	protected SCInterfaceImpl sCInterface;
+
+	protected class SCIAImpl implements SCIA {
+
+		private boolean e;
+
+		private long eValue;
+
+		public void raiseE(long value) {
+			e = true;
+			eValue = value;
+		}
+
+		protected long getEValue() {
+			if (!e)
+				throw new IllegalStateException("Illegal event value access. Event E is not raised!");
+			return eValue;
+		}
+
+		protected void clearEvents() {
+			e = false;
+		}
+
+	}
+
+	protected SCIAImpl sCIA;
+
+	private boolean initialized = false;
+
+	public enum State {
+		constOnlyDefaultScope_main_region_A, constOnlyDefaultScope_main_region_B, constOnlyDefaultScope_main_region_C, $NullState$
+	};
+
+	private final State[] stateVector = new State[1];
+
+	private int nextStateIndex;
+
+	public ConstOnlyDefaultScopeStatemachine() {
+
+		sCInterface = new SCInterfaceImpl();
+		sCIA = new SCIAImpl();
+	}
+
+	public void init() {
+		this.initialized = true;
+		for (int i = 0; i < 1; 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_ConstOnlyDefaultScope_main_region_default();
+	}
+
+	public void exit() {
+		exitSequence_ConstOnlyDefaultScope_main_region();
+	}
+
+	/**
+	 * @see IStatemachine#isActive()
+	 */
+	public boolean isActive() {
+
+		return stateVector[0] != 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() {
+		sCIA.clearEvents();
+
+	}
+
+	/**
+	* 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 constOnlyDefaultScope_main_region_A :
+				return stateVector[0] == State.constOnlyDefaultScope_main_region_A;
+			case constOnlyDefaultScope_main_region_B :
+				return stateVector[0] == State.constOnlyDefaultScope_main_region_B;
+			case constOnlyDefaultScope_main_region_C :
+				return stateVector[0] == State.constOnlyDefaultScope_main_region_C;
+			default :
+				return false;
+		}
+	}
+
+	public SCInterface getSCInterface() {
+		return sCInterface;
+	}
+	public SCIA getSCIA() {
+		return sCIA;
+	}
+
+	public long getB() {
+		return sCInterface.getB();
+	}
+
+	public long getC() {
+		return sCInterface.getC();
+	}
+
+	private boolean check_ConstOnlyDefaultScope_main_region_A_tr0_tr0() {
+		return (sCIA.e) && (sCIA.getEValue() == sCInterface.getB());
+	}
+
+	private boolean check_ConstOnlyDefaultScope_main_region_A_tr1_tr1() {
+		return (sCIA.e) && (sCIA.getEValue() == sCInterface.getC());
+	}
+
+	private void effect_ConstOnlyDefaultScope_main_region_A_tr0() {
+		exitSequence_ConstOnlyDefaultScope_main_region_A();
+
+		enterSequence_ConstOnlyDefaultScope_main_region_B_default();
+	}
+
+	private void effect_ConstOnlyDefaultScope_main_region_A_tr1() {
+		exitSequence_ConstOnlyDefaultScope_main_region_A();
+
+		enterSequence_ConstOnlyDefaultScope_main_region_C_default();
+	}
+
+	/* 'default' enter sequence for state A */
+	private void enterSequence_ConstOnlyDefaultScope_main_region_A_default() {
+		nextStateIndex = 0;
+		stateVector[0] = State.constOnlyDefaultScope_main_region_A;
+	}
+
+	/* 'default' enter sequence for state B */
+	private void enterSequence_ConstOnlyDefaultScope_main_region_B_default() {
+		nextStateIndex = 0;
+		stateVector[0] = State.constOnlyDefaultScope_main_region_B;
+	}
+
+	/* 'default' enter sequence for state C */
+	private void enterSequence_ConstOnlyDefaultScope_main_region_C_default() {
+		nextStateIndex = 0;
+		stateVector[0] = State.constOnlyDefaultScope_main_region_C;
+	}
+
+	/* 'default' enter sequence for region main region */
+	private void enterSequence_ConstOnlyDefaultScope_main_region_default() {
+		react_ConstOnlyDefaultScope_main_region__entry_Default();
+	}
+
+	/* Default exit sequence for state A */
+	private void exitSequence_ConstOnlyDefaultScope_main_region_A() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+
+	/* Default exit sequence for state B */
+	private void exitSequence_ConstOnlyDefaultScope_main_region_B() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+
+	/* Default exit sequence for state C */
+	private void exitSequence_ConstOnlyDefaultScope_main_region_C() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+
+	/* Default exit sequence for region main region */
+	private void exitSequence_ConstOnlyDefaultScope_main_region() {
+		switch (stateVector[0]) {
+			case constOnlyDefaultScope_main_region_A :
+				exitSequence_ConstOnlyDefaultScope_main_region_A();
+				break;
+
+			case constOnlyDefaultScope_main_region_B :
+				exitSequence_ConstOnlyDefaultScope_main_region_B();
+				break;
+
+			case constOnlyDefaultScope_main_region_C :
+				exitSequence_ConstOnlyDefaultScope_main_region_C();
+				break;
+
+			default :
+				break;
+		}
+	}
+
+	/* The reactions of state A. */
+	private void react_ConstOnlyDefaultScope_main_region_A() {
+		if (check_ConstOnlyDefaultScope_main_region_A_tr0_tr0()) {
+			effect_ConstOnlyDefaultScope_main_region_A_tr0();
+		} else {
+			if (check_ConstOnlyDefaultScope_main_region_A_tr1_tr1()) {
+				effect_ConstOnlyDefaultScope_main_region_A_tr1();
+			}
+		}
+	}
+
+	/* The reactions of state B. */
+	private void react_ConstOnlyDefaultScope_main_region_B() {
+	}
+
+	/* The reactions of state C. */
+	private void react_ConstOnlyDefaultScope_main_region_C() {
+	}
+
+	/* Default react sequence for initial entry  */
+	private void react_ConstOnlyDefaultScope_main_region__entry_Default() {
+		enterSequence_ConstOnlyDefaultScope_main_region_A_default();
+	}
+
+	public void runCycle() {
+		if (!initialized)
+			throw new IllegalStateException(
+					"The state machine needs to be initialized first by calling the init() function.");
+
+		clearOutEvents();
+
+		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
+
+			switch (stateVector[nextStateIndex]) {
+				case constOnlyDefaultScope_main_region_A :
+					react_ConstOnlyDefaultScope_main_region_A();
+					break;
+				case constOnlyDefaultScope_main_region_B :
+					react_ConstOnlyDefaultScope_main_region_B();
+					break;
+				case constOnlyDefaultScope_main_region_C :
+					react_ConstOnlyDefaultScope_main_region_C();
+					break;
+				default :
+					// $NullState$
+			}
+		}
+
+		clearEvents();
+	}
+}

+ 22 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/constonlydefaultscope/IConstOnlyDefaultScopeStatemachine.java

@@ -0,0 +1,22 @@
+package org.yakindu.scr.constonlydefaultscope;
+import org.yakindu.scr.IStatemachine;
+
+public interface IConstOnlyDefaultScopeStatemachine extends IStatemachine {
+	public interface SCInterface {
+		public static final long b = 1;
+		public static final long c = 2;
+		public long getB();
+		public long getC();
+
+	}
+
+	public SCInterface getSCInterface();
+
+	public interface SCIA {
+		public void raiseE(long value);
+
+	}
+
+	public SCIA getSCIA();
+
+}

+ 262 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/constonlyinternalscope/ConstOnlyInternalScopeStatemachine.java

@@ -0,0 +1,262 @@
+package org.yakindu.scr.constonlyinternalscope;
+
+public class ConstOnlyInternalScopeStatemachine implements IConstOnlyInternalScopeStatemachine {
+
+	protected class SCInterfaceImpl implements SCInterface {
+
+		private boolean e;
+
+		private long eValue;
+
+		public void raiseE(long value) {
+			e = true;
+			eValue = value;
+		}
+
+		protected long getEValue() {
+			if (!e)
+				throw new IllegalStateException("Illegal event value access. Event E is not raised!");
+			return eValue;
+		}
+
+		protected void clearEvents() {
+			e = false;
+		}
+
+	}
+
+	protected SCInterfaceImpl sCInterface;
+
+	private boolean initialized = false;
+
+	public enum State {
+		constOnlyInternalScope_main_region_A, constOnlyInternalScope_main_region_B, constOnlyInternalScope_main_region_C, $NullState$
+	};
+
+	private final State[] stateVector = new State[1];
+
+	private int nextStateIndex;
+
+	protected long getB() {
+		return b;
+	}
+
+	protected long getC() {
+		return c;
+	}
+
+	public ConstOnlyInternalScopeStatemachine() {
+
+		sCInterface = new SCInterfaceImpl();
+	}
+
+	public void init() {
+		this.initialized = true;
+		for (int i = 0; i < 1; 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_ConstOnlyInternalScope_main_region_default();
+	}
+
+	public void exit() {
+		exitSequence_ConstOnlyInternalScope_main_region();
+	}
+
+	/**
+	 * @see IStatemachine#isActive()
+	 */
+	public boolean isActive() {
+
+		return stateVector[0] != 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() {
+	}
+
+	/**
+	* Returns true if the given state is currently active otherwise false.
+	*/
+	public boolean isStateActive(State state) {
+		switch (state) {
+			case constOnlyInternalScope_main_region_A :
+				return stateVector[0] == State.constOnlyInternalScope_main_region_A;
+			case constOnlyInternalScope_main_region_B :
+				return stateVector[0] == State.constOnlyInternalScope_main_region_B;
+			case constOnlyInternalScope_main_region_C :
+				return stateVector[0] == State.constOnlyInternalScope_main_region_C;
+			default :
+				return false;
+		}
+	}
+
+	public SCInterface getSCInterface() {
+		return sCInterface;
+	}
+
+	public void raiseE(long value) {
+		sCInterface.raiseE(value);
+	}
+
+	private boolean check_ConstOnlyInternalScope_main_region_A_tr0_tr0() {
+		return (sCInterface.e) && (sCInterface.getEValue() == getB());
+	}
+
+	private boolean check_ConstOnlyInternalScope_main_region_A_tr1_tr1() {
+		return (sCInterface.e) && (sCInterface.getEValue() == getC());
+	}
+
+	private void effect_ConstOnlyInternalScope_main_region_A_tr0() {
+		exitSequence_ConstOnlyInternalScope_main_region_A();
+
+		enterSequence_ConstOnlyInternalScope_main_region_B_default();
+	}
+
+	private void effect_ConstOnlyInternalScope_main_region_A_tr1() {
+		exitSequence_ConstOnlyInternalScope_main_region_A();
+
+		enterSequence_ConstOnlyInternalScope_main_region_C_default();
+	}
+
+	/* 'default' enter sequence for state A */
+	private void enterSequence_ConstOnlyInternalScope_main_region_A_default() {
+		nextStateIndex = 0;
+		stateVector[0] = State.constOnlyInternalScope_main_region_A;
+	}
+
+	/* 'default' enter sequence for state B */
+	private void enterSequence_ConstOnlyInternalScope_main_region_B_default() {
+		nextStateIndex = 0;
+		stateVector[0] = State.constOnlyInternalScope_main_region_B;
+	}
+
+	/* 'default' enter sequence for state C */
+	private void enterSequence_ConstOnlyInternalScope_main_region_C_default() {
+		nextStateIndex = 0;
+		stateVector[0] = State.constOnlyInternalScope_main_region_C;
+	}
+
+	/* 'default' enter sequence for region main region */
+	private void enterSequence_ConstOnlyInternalScope_main_region_default() {
+		react_ConstOnlyInternalScope_main_region__entry_Default();
+	}
+
+	/* Default exit sequence for state A */
+	private void exitSequence_ConstOnlyInternalScope_main_region_A() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+
+	/* Default exit sequence for state B */
+	private void exitSequence_ConstOnlyInternalScope_main_region_B() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+
+	/* Default exit sequence for state C */
+	private void exitSequence_ConstOnlyInternalScope_main_region_C() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+
+	/* Default exit sequence for region main region */
+	private void exitSequence_ConstOnlyInternalScope_main_region() {
+		switch (stateVector[0]) {
+			case constOnlyInternalScope_main_region_A :
+				exitSequence_ConstOnlyInternalScope_main_region_A();
+				break;
+
+			case constOnlyInternalScope_main_region_B :
+				exitSequence_ConstOnlyInternalScope_main_region_B();
+				break;
+
+			case constOnlyInternalScope_main_region_C :
+				exitSequence_ConstOnlyInternalScope_main_region_C();
+				break;
+
+			default :
+				break;
+		}
+	}
+
+	/* The reactions of state A. */
+	private void react_ConstOnlyInternalScope_main_region_A() {
+		if (check_ConstOnlyInternalScope_main_region_A_tr0_tr0()) {
+			effect_ConstOnlyInternalScope_main_region_A_tr0();
+		} else {
+			if (check_ConstOnlyInternalScope_main_region_A_tr1_tr1()) {
+				effect_ConstOnlyInternalScope_main_region_A_tr1();
+			}
+		}
+	}
+
+	/* The reactions of state B. */
+	private void react_ConstOnlyInternalScope_main_region_B() {
+	}
+
+	/* The reactions of state C. */
+	private void react_ConstOnlyInternalScope_main_region_C() {
+	}
+
+	/* Default react sequence for initial entry  */
+	private void react_ConstOnlyInternalScope_main_region__entry_Default() {
+		enterSequence_ConstOnlyInternalScope_main_region_A_default();
+	}
+
+	public void runCycle() {
+		if (!initialized)
+			throw new IllegalStateException(
+					"The state machine needs to be initialized first by calling the init() function.");
+
+		clearOutEvents();
+
+		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
+
+			switch (stateVector[nextStateIndex]) {
+				case constOnlyInternalScope_main_region_A :
+					react_ConstOnlyInternalScope_main_region_A();
+					break;
+				case constOnlyInternalScope_main_region_B :
+					react_ConstOnlyInternalScope_main_region_B();
+					break;
+				case constOnlyInternalScope_main_region_C :
+					react_ConstOnlyInternalScope_main_region_C();
+					break;
+				default :
+					// $NullState$
+			}
+		}
+
+		clearEvents();
+	}
+}

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

@@ -0,0 +1,15 @@
+package org.yakindu.scr.constonlyinternalscope;
+import org.yakindu.scr.IStatemachine;
+
+public interface IConstOnlyInternalScopeStatemachine extends IStatemachine {
+
+	public static final long b = 1;
+	public static final long c = 2;
+	public interface SCInterface {
+		public void raiseE(long value);
+
+	}
+
+	public SCInterface getSCInterface();
+
+}

+ 272 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/constonlynamedscope/ConstOnlyNamedScopeStatemachine.java

@@ -0,0 +1,272 @@
+package org.yakindu.scr.constonlynamedscope;
+
+public class ConstOnlyNamedScopeStatemachine implements IConstOnlyNamedScopeStatemachine {
+
+	protected class SCInterfaceImpl implements SCInterface {
+
+		private boolean e;
+
+		private long eValue;
+
+		public void raiseE(long value) {
+			e = true;
+			eValue = value;
+		}
+
+		protected long getEValue() {
+			if (!e)
+				throw new IllegalStateException("Illegal event value access. Event E is not raised!");
+			return eValue;
+		}
+
+		protected void clearEvents() {
+			e = false;
+		}
+
+	}
+
+	protected SCInterfaceImpl sCInterface;
+
+	protected class SCIAImpl implements SCIA {
+
+		public long getB() {
+			return b;
+		}
+
+		public long getC() {
+			return c;
+		}
+
+	}
+
+	protected SCIAImpl sCIA;
+
+	private boolean initialized = false;
+
+	public enum State {
+		constOnlyNamedScope_main_region_A, constOnlyNamedScope_main_region_B, constOnlyNamedScope_main_region_C, $NullState$
+	};
+
+	private final State[] stateVector = new State[1];
+
+	private int nextStateIndex;
+
+	public ConstOnlyNamedScopeStatemachine() {
+
+		sCInterface = new SCInterfaceImpl();
+		sCIA = new SCIAImpl();
+	}
+
+	public void init() {
+		this.initialized = true;
+		for (int i = 0; i < 1; 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_ConstOnlyNamedScope_main_region_default();
+	}
+
+	public void exit() {
+		exitSequence_ConstOnlyNamedScope_main_region();
+	}
+
+	/**
+	 * @see IStatemachine#isActive()
+	 */
+	public boolean isActive() {
+
+		return stateVector[0] != 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() {
+	}
+
+	/**
+	* Returns true if the given state is currently active otherwise false.
+	*/
+	public boolean isStateActive(State state) {
+		switch (state) {
+			case constOnlyNamedScope_main_region_A :
+				return stateVector[0] == State.constOnlyNamedScope_main_region_A;
+			case constOnlyNamedScope_main_region_B :
+				return stateVector[0] == State.constOnlyNamedScope_main_region_B;
+			case constOnlyNamedScope_main_region_C :
+				return stateVector[0] == State.constOnlyNamedScope_main_region_C;
+			default :
+				return false;
+		}
+	}
+
+	public SCInterface getSCInterface() {
+		return sCInterface;
+	}
+	public SCIA getSCIA() {
+		return sCIA;
+	}
+
+	public void raiseE(long value) {
+		sCInterface.raiseE(value);
+	}
+
+	private boolean check_ConstOnlyNamedScope_main_region_A_tr0_tr0() {
+		return (sCInterface.e) && (sCInterface.getEValue() == sCIA.b);
+	}
+
+	private boolean check_ConstOnlyNamedScope_main_region_A_tr1_tr1() {
+		return (sCInterface.e) && (sCInterface.getEValue() == sCIA.c);
+	}
+
+	private void effect_ConstOnlyNamedScope_main_region_A_tr0() {
+		exitSequence_ConstOnlyNamedScope_main_region_A();
+
+		enterSequence_ConstOnlyNamedScope_main_region_B_default();
+	}
+
+	private void effect_ConstOnlyNamedScope_main_region_A_tr1() {
+		exitSequence_ConstOnlyNamedScope_main_region_A();
+
+		enterSequence_ConstOnlyNamedScope_main_region_C_default();
+	}
+
+	/* 'default' enter sequence for state A */
+	private void enterSequence_ConstOnlyNamedScope_main_region_A_default() {
+		nextStateIndex = 0;
+		stateVector[0] = State.constOnlyNamedScope_main_region_A;
+	}
+
+	/* 'default' enter sequence for state B */
+	private void enterSequence_ConstOnlyNamedScope_main_region_B_default() {
+		nextStateIndex = 0;
+		stateVector[0] = State.constOnlyNamedScope_main_region_B;
+	}
+
+	/* 'default' enter sequence for state C */
+	private void enterSequence_ConstOnlyNamedScope_main_region_C_default() {
+		nextStateIndex = 0;
+		stateVector[0] = State.constOnlyNamedScope_main_region_C;
+	}
+
+	/* 'default' enter sequence for region main region */
+	private void enterSequence_ConstOnlyNamedScope_main_region_default() {
+		react_ConstOnlyNamedScope_main_region__entry_Default();
+	}
+
+	/* Default exit sequence for state A */
+	private void exitSequence_ConstOnlyNamedScope_main_region_A() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+
+	/* Default exit sequence for state B */
+	private void exitSequence_ConstOnlyNamedScope_main_region_B() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+
+	/* Default exit sequence for state C */
+	private void exitSequence_ConstOnlyNamedScope_main_region_C() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+
+	/* Default exit sequence for region main region */
+	private void exitSequence_ConstOnlyNamedScope_main_region() {
+		switch (stateVector[0]) {
+			case constOnlyNamedScope_main_region_A :
+				exitSequence_ConstOnlyNamedScope_main_region_A();
+				break;
+
+			case constOnlyNamedScope_main_region_B :
+				exitSequence_ConstOnlyNamedScope_main_region_B();
+				break;
+
+			case constOnlyNamedScope_main_region_C :
+				exitSequence_ConstOnlyNamedScope_main_region_C();
+				break;
+
+			default :
+				break;
+		}
+	}
+
+	/* The reactions of state A. */
+	private void react_ConstOnlyNamedScope_main_region_A() {
+		if (check_ConstOnlyNamedScope_main_region_A_tr0_tr0()) {
+			effect_ConstOnlyNamedScope_main_region_A_tr0();
+		} else {
+			if (check_ConstOnlyNamedScope_main_region_A_tr1_tr1()) {
+				effect_ConstOnlyNamedScope_main_region_A_tr1();
+			}
+		}
+	}
+
+	/* The reactions of state B. */
+	private void react_ConstOnlyNamedScope_main_region_B() {
+	}
+
+	/* The reactions of state C. */
+	private void react_ConstOnlyNamedScope_main_region_C() {
+	}
+
+	/* Default react sequence for initial entry  */
+	private void react_ConstOnlyNamedScope_main_region__entry_Default() {
+		enterSequence_ConstOnlyNamedScope_main_region_A_default();
+	}
+
+	public void runCycle() {
+		if (!initialized)
+			throw new IllegalStateException(
+					"The state machine needs to be initialized first by calling the init() function.");
+
+		clearOutEvents();
+
+		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
+
+			switch (stateVector[nextStateIndex]) {
+				case constOnlyNamedScope_main_region_A :
+					react_ConstOnlyNamedScope_main_region_A();
+					break;
+				case constOnlyNamedScope_main_region_B :
+					react_ConstOnlyNamedScope_main_region_B();
+					break;
+				case constOnlyNamedScope_main_region_C :
+					react_ConstOnlyNamedScope_main_region_C();
+					break;
+				default :
+					// $NullState$
+			}
+		}
+
+		clearEvents();
+	}
+}

+ 22 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/constonlynamedscope/IConstOnlyNamedScopeStatemachine.java

@@ -0,0 +1,22 @@
+package org.yakindu.scr.constonlynamedscope;
+import org.yakindu.scr.IStatemachine;
+
+public interface IConstOnlyNamedScopeStatemachine extends IStatemachine {
+	public interface SCInterface {
+		public void raiseE(long value);
+
+	}
+
+	public SCInterface getSCInterface();
+
+	public interface SCIA {
+		public static final long b = 1;
+		public static final long c = 2;
+		public long getB();
+		public long getC();
+
+	}
+
+	public SCIA getSCIA();
+
+}

+ 51 - 0
test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/ConstOnlyDefaultScopeTest.java

@@ -0,0 +1,51 @@
+/**
+* Copyright (c) 2016 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.generator.java.test;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.yakindu.scr.constonlydefaultscope.ConstOnlyDefaultScopeStatemachine;
+import org.yakindu.scr.constonlydefaultscope.ConstOnlyDefaultScopeStatemachine.State;
+/**
+ *  Unit TestCase for ConstOnlyDefaultScope
+ */
+@SuppressWarnings("all")
+public class ConstOnlyDefaultScopeTest {
+
+	private ConstOnlyDefaultScopeStatemachine statemachine;
+
+	@Before
+	public void setUp() {
+		statemachine = new ConstOnlyDefaultScopeStatemachine();
+		statemachine.init();
+	}
+
+	@After
+	public void tearDown() {
+		statemachine = null;
+	}
+
+	@Test
+	public void teststatechartEntry() {
+		statemachine.enter();
+		assertTrue(statemachine.isStateActive(State.constOnlyDefaultScope_main_region_A));
+	}
+	@Test
+	public void teststateTransition() {
+		statemachine.enter();
+		statemachine.getSCIA().raiseE(1l);
+		statemachine.runCycle();
+		assertTrue(statemachine.isStateActive(State.constOnlyDefaultScope_main_region_B));
+	}
+}

+ 51 - 0
test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/ConstOnlyInternalScopeTest.java

@@ -0,0 +1,51 @@
+/**
+* Copyright (c) 2016 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.generator.java.test;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.yakindu.scr.constonlyinternalscope.ConstOnlyInternalScopeStatemachine;
+import org.yakindu.scr.constonlyinternalscope.ConstOnlyInternalScopeStatemachine.State;
+/**
+ *  Unit TestCase for ConstOnlyInternalScope
+ */
+@SuppressWarnings("all")
+public class ConstOnlyInternalScopeTest {
+
+	private ConstOnlyInternalScopeStatemachine statemachine;
+
+	@Before
+	public void setUp() {
+		statemachine = new ConstOnlyInternalScopeStatemachine();
+		statemachine.init();
+	}
+
+	@After
+	public void tearDown() {
+		statemachine = null;
+	}
+
+	@Test
+	public void teststatechartEntry() {
+		statemachine.enter();
+		assertTrue(statemachine.isStateActive(State.constOnlyInternalScope_main_region_A));
+	}
+	@Test
+	public void teststateTransition() {
+		statemachine.enter();
+		statemachine.raiseE(1l);
+		statemachine.runCycle();
+		assertTrue(statemachine.isStateActive(State.constOnlyInternalScope_main_region_B));
+	}
+}

+ 51 - 0
test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/ConstOnlyNamedScopeTest.java

@@ -0,0 +1,51 @@
+/**
+* Copyright (c) 2016 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.generator.java.test;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.yakindu.scr.constonlynamedscope.ConstOnlyNamedScopeStatemachine;
+import org.yakindu.scr.constonlynamedscope.ConstOnlyNamedScopeStatemachine.State;
+/**
+ *  Unit TestCase for ConstOnlyNamedScope
+ */
+@SuppressWarnings("all")
+public class ConstOnlyNamedScopeTest {
+
+	private ConstOnlyNamedScopeStatemachine statemachine;
+
+	@Before
+	public void setUp() {
+		statemachine = new ConstOnlyNamedScopeStatemachine();
+		statemachine.init();
+	}
+
+	@After
+	public void tearDown() {
+		statemachine = null;
+	}
+
+	@Test
+	public void teststatechartEntry() {
+		statemachine.enter();
+		assertTrue(statemachine.isStateActive(State.constOnlyNamedScope_main_region_A));
+	}
+	@Test
+	public void teststateTransition() {
+		statemachine.enter();
+		statemachine.raiseE(1l);
+		statemachine.runCycle();
+		assertTrue(statemachine.isStateActive(State.constOnlyNamedScope_main_region_B));
+	}
+}