소스 검색

Escape variable name if it equals internal statemachine identifiers.

Markus Mühlbrandt 9 년 전
부모
커밋
d71d4dabd7
21개의 변경된 파일1227개의 추가작업 그리고 558개의 파일을 삭제
  1. 1 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/CycleBasedSynchronizedWrapper.xtend
  2. 7 6
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/EventBasedRunnableWrapper.xtend
  3. 5 4
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/ExpressionCode.xtend
  4. 2 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/FlowCode.xtend
  5. 2 2
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/JavaCodeGenerator.java
  6. 5 1
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/JavaGenerator.xtend
  7. 0 24
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/JavaKeywords.java
  8. 91 16
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/JavaNamingService.xtend
  9. 70 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/Keywords.java
  10. 36 55
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/Naming.xtend
  11. 20 19
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/Statemachine.xtend
  12. 4 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/StatemachineInterface.xtend
  13. 2 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/features/CycleBasedWrapperFeature.xtend
  14. 240 219
      test-plugins/org.yakindu.sct.generator.java.test/model/model.sgen
  15. 57 57
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/ckeywords/CKeywordsStatemachine.java
  16. 4 4
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/guard/GuardStatemachine.java
  17. 2 2
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/javakeywords/IJavaKeywordsStatemachine.java
  18. 146 146
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/javakeywords/JavaKeywordsStatemachine.java
  19. 42 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/statechartkeywords/IStatechartKeywordsStatemachine.java
  20. 418 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/statechartkeywords/StatechartKeywordsStatemachine.java
  21. 73 0
      test-plugins/org.yakindu.sct.test.models/testmodels/SCTUnit/StatechartKeywords.sct

+ 1 - 0
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/CycleBasedSynchronizedWrapper.xtend

@@ -31,6 +31,7 @@ class CycleBasedSynchronizedWrapper {
 	@Inject protected extension GenmodelEntries
 	@Inject protected extension CycleBasedWrapperFeature
 
+	@Inject protected extension JavaNamingService
 	@Inject protected extension Naming
 	@Inject protected extension Navigation
 	@Inject protected extension ITypeSystem

+ 7 - 6
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/EventBasedRunnableWrapper.xtend

@@ -12,17 +12,17 @@
 
 package org.yakindu.sct.generator.java
 
-import org.yakindu.sct.model.sexec.ExecutionFlow
-import org.yakindu.sct.model.sgen.GeneratorEntry
-import org.eclipse.xtext.generator.IFileSystemAccess
 import com.google.inject.Inject
-import org.yakindu.sct.model.stext.stext.InterfaceScope
-import org.yakindu.base.types.typesystem.ITypeSystem
+import org.eclipse.xtext.generator.IFileSystemAccess
 import org.yakindu.base.types.Direction
 import org.yakindu.base.types.typesystem.GenericTypeSystem
+import org.yakindu.base.types.typesystem.ITypeSystem
 import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
-import org.yakindu.sct.generator.java.features.EventBasedRunnableFeature
 import org.yakindu.sct.generator.java.features.CycleBasedWrapperFeature
+import org.yakindu.sct.generator.java.features.EventBasedRunnableFeature
+import org.yakindu.sct.model.sexec.ExecutionFlow
+import org.yakindu.sct.model.sgen.GeneratorEntry
+import org.yakindu.sct.model.stext.stext.InterfaceScope
 
 /**
  * Generates the runnable wrapper for the state machine. This wrapper implies event based execution semantics. 
@@ -34,6 +34,7 @@ class EventBasedRunnableWrapper {
 	@Inject protected extension CycleBasedWrapperFeature
 
 	@Inject protected extension Naming
+	@Inject protected extension JavaNamingService
 	@Inject protected extension Navigation
 	@Inject protected extension ITypeSystem
 	@Inject protected extension ICodegenTypeSystemAccess

+ 5 - 4
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/ExpressionCode.xtend

@@ -23,6 +23,7 @@ import org.yakindu.base.expressions.expressions.BoolLiteral
 import org.yakindu.base.expressions.expressions.ConditionalExpression
 import org.yakindu.base.expressions.expressions.DoubleLiteral
 import org.yakindu.base.expressions.expressions.ElementReferenceExpression
+import org.yakindu.base.expressions.expressions.Expression
 import org.yakindu.base.expressions.expressions.FeatureCall
 import org.yakindu.base.expressions.expressions.FloatLiteral
 import org.yakindu.base.expressions.expressions.HexLiteral
@@ -57,11 +58,11 @@ import org.yakindu.sct.model.stext.stext.ActiveStateReferenceExpression
 import org.yakindu.sct.model.stext.stext.EventRaisingExpression
 import org.yakindu.sct.model.stext.stext.EventValueReferenceExpression
 import org.yakindu.sct.model.stext.stext.OperationDefinition
-import org.yakindu.base.expressions.expressions.Expression
 
 class ExpressionCode {
 
 	@Inject extension Naming
+	@Inject extension JavaNamingService
 	@Inject extension Navigation
 	@Inject extension ITypeSystem
 	@Inject extension ITypeSystemInferrer
@@ -264,9 +265,9 @@ class ExpressionCode {
 		«ELSE»
 			«val def = definition»
 			«IF def instanceof Property && isAssignmentContained»
-				«def.getContext(false) + def.symbol»
+				«def.getContext(false) + def.identifier»
 			«ELSEIF def instanceof Property && isPropertyContained»
-				«def.getContext(true) + def.symbol»
+				«def.getContext(true) + def.identifier»
 			«ELSE»
 				«definition.code»
 			«ENDIF»
@@ -282,7 +283,7 @@ class ExpressionCode {
 	'''
 
 	def dispatch String code(Declaration it) {
-		getContext(false) + symbol
+		getContext(false) + identifier
 	}
 
 	def dispatch String code(Property it) {

+ 2 - 0
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/FlowCode.xtend

@@ -29,10 +29,12 @@ import org.yakindu.sct.model.sexec.UnscheduleTimeEvent
 import org.yakindu.sct.model.sexec.extensions.SExecExtensions
 import java.util.List
 import org.yakindu.sct.model.sexec.TimeEvent
+import org.yakindu.sct.model.sexec.naming.INamingService
 
 class FlowCode {
 	
 	@Inject extension Naming
+	@Inject extension INamingService
 	@Inject extension ExpressionCode
 	@Inject extension SExecExtensions
 	

+ 2 - 2
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/JavaCodeGenerator.java

@@ -21,7 +21,7 @@ import org.yakindu.sct.model.sgraph.Statechart;
 
 import com.google.inject.Binder;
 import com.google.inject.Module;
-import com.google.inject.Scopes;
+import com.google.inject.Singleton;
 import com.google.inject.util.Modules;
 
 public class JavaCodeGenerator extends AbstractJavaCodeGenerator {
@@ -54,7 +54,7 @@ public class JavaCodeGenerator extends AbstractJavaCodeGenerator {
 							JavaTypeSystemAccess.class);
 				}
 				binder.bind(INamingService.class).to(JavaNamingService.class)
-						.in(Scopes.SINGLETON);
+						.in(Singleton.class);
 			}
 		});
 

+ 5 - 1
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/JavaGenerator.xtend

@@ -16,6 +16,7 @@ import org.yakindu.sct.model.sexec.ExecutionFlow
 import org.yakindu.sct.model.sgen.GeneratorEntry
 import org.yakindu.sct.generator.java.features.EventBasedRunnableFeature
 import org.yakindu.sct.generator.java.features.CycleBasedWrapperFeature
+import org.yakindu.sct.model.sexec.naming.INamingService
 
 /**
  * This is the Java code generators main class. 
@@ -39,9 +40,12 @@ class JavaGenerator implements IExecutionFlowGenerator {
 	@Inject extension Statemachine
 	@Inject extension EventBasedRunnableWrapper
 	@Inject extension CycleBasedSynchronizedWrapper
+	@Inject INamingService namingService
  	
 	override generate(ExecutionFlow flow, GeneratorEntry entry, IFileSystemAccess fsa) {
-
+		
+		namingService.initializeNamingService(flow);
+		
 		flow.generateIStatemachine(entry, fsa)
 		
 		if (flow.timed) {

+ 0 - 24
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/JavaKeywords.java

@@ -1,24 +0,0 @@
-/**
- * Copyright (c) 2012 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;
-
-public interface JavaKeywords {
-	
-	public static final String[] KEYWORDS = { "abstract", "assert",
-			"boolean", "break", "byte", "case", "catch", "char", "class",
-			"const", "continue", "default", "do", "double", "else", "enum",
-			"extends", "false", "final", "finally", "float", "for", "goto",
-			"if", "implements", "import", "instanceof", "int", "interface",
-			"long", "native", "new", "null", "package", "private", "protected",
-			"public", "return", "short", "static", "strictfp", "super",
-			"switch", "synchronized", "this", "throw", "throws", "transient",
-			"true", "try", "void", "volatile", "while" };
-}

+ 91 - 16
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/JavaNamingService.xtend

@@ -1,31 +1,40 @@
 /*
-  Copyright (c) 2014-2015 committers of YAKINDU Statechart Tools.
-  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:
-  	Axel Terfloth - Initial contribution
-*/
+ *   Copyright (c) 2014-2015 committers of YAKINDU Statechart Tools.
+ *   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:
+ *   	Axel Terfloth - Initial contribution
+ */
 package org.yakindu.sct.generator.java
 
 import com.google.inject.Inject
-import java.util.Arrays
+import com.google.inject.Singleton
+import java.util.HashSet
+import java.util.Set
 import org.yakindu.sct.model.sexec.Step
 import org.yakindu.sct.model.sexec.extensions.SExecExtensions
 import org.yakindu.sct.model.sexec.naming.DefaultNamingService
+import org.yakindu.sct.model.stext.stext.InterfaceScope
+import org.yakindu.base.types.Declaration
+import org.yakindu.sct.model.stext.stext.InternalScope
 
 /** 
  * Specific adaption of the default naming service to the needs of the java code generator.
  * 
  * @author axel terfloth (terfloth@itemis.de)
+ * @author Markus Mühlbrandt (muehlbrandt@itemis.de)
  */
-class JavaNamingService extends DefaultNamingService implements JavaKeywords {
-	
+@Singleton
+class JavaNamingService extends DefaultNamingService {
+
 	@Inject extension SExecExtensions
-	
-  override protected prefix(Step it, char separator) {
+
+	private Set<String> derivedIdentifiers = new HashSet
+
+	override protected prefix(Step it, char separator) {
 		switch (it) {
 			case isCheckFunction: "check"
 			case isEntryAction: "entryAction"
@@ -40,9 +49,75 @@ class JavaNamingService extends DefaultNamingService implements JavaKeywords {
 		}
 	}
 
-		
+	override asIdentifier(String string) {
+		super.asIdentifier(string).toFirstLower
+	}
+
+	override asEscapedIdentifier(String it) {
+		var s = it
+		if (s.isKeyword) {
+			s = s + separator + 'ID'
+		}
+		return s.asIdentifier
+	}
+
 	override boolean isKeyword(String name) {
-		return !Arrays::asList(KEYWORDS).findFirst[it.equalsIgnoreCase(name)].nullOrEmpty
+		return Keywords::javaKeywords.isKeyword(name)
+	}
+
+	def isStatemachineIdentifier(String name) {
+		return Keywords::statemachineIdentifiers.isKeyword(name);
+	}
+
+	def isStatemachineInterfaceIdentifier(String name) {
+		return Keywords::statemachineInterfaceIdentifiers.isKeyword(name)
 	}
 
+	def isDerivedIdentifier(String name) {
+		return getDerivedIdentifiers.isKeyword(name);
+	}
+	
+	def isStatemachineMethod(String name) {
+		return Keywords::statemachineMethods.isKeyword(name);
+	}
+
+	private def isKeyword(Set<String> set, String name) {
+		return !set.findFirst [
+			it.equalsIgnoreCase(name)
+		].nullOrEmpty
+	}
+	
+	def isKeyword(Declaration it) {
+		
+		if (name.isKeyword)
+			return true
+
+		switch eContainer {
+			InterfaceScope: {
+				return name.isStatemachineInterfaceIdentifier;
+			}
+			InternalScope: {
+				return name.isStatemachineIdentifier || name.isDerivedIdentifier
+			}
+		}
+
+		return false;
+	}
+
+	protected def getDerivedIdentifiers() {
+		if (derivedIdentifiers.isEmpty) {
+			if (activeFlow != null) {
+				activeFlow.interfaceScopes.forEach[derivedIdentifiers.add(interfaceName.asEscapedIdentifier)]
+			}
+		}
+		return derivedIdentifiers
+	}
+
+	def String getInterfaceName(InterfaceScope it) {
+		if (name != null) {
+			return "SCI" + name.toFirstUpper()
+		} else {
+			return "SCInterface";
+		}
+	}
 }

+ 70 - 0
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/Keywords.java

@@ -0,0 +1,70 @@
+/**
+ * Copyright (c) 2012 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;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+public class Keywords {
+
+	private static Set<String> JAVA_KEYWORD_SET = new HashSet<>();
+	private static Set<String> STATEMACHICHNE_KEYWORD_SET = new HashSet<>();
+	private static Set<String> STATEMACHINE_INTERFACE_KEYWORD_SET = new HashSet<>();
+	private static Set<String> STATEMACHINE_METHOD_SET = new HashSet<>();
+
+	public static final String[] JAVA_KEYWORDS = { "abstract", "assert", "boolean", "break", "byte", "case", "catch",
+			"char", "class", "const", "continue", "default", "do", "double", "else", "enum", "extends", "false",
+			"final", "finally", "float", "for", "goto", "if", "implements", "import", "instanceof", "int", "interface",
+			"long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static",
+			"strictfp", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try",
+			"void", "volatile", "while" };
+
+	public static final String[] STATEMACHINE_IDENTIFIERS = { "initialized", "stateVector", "nextStateIndex", "timer",
+			"getTimer", "setTimer", "timeEvents", "operationCallback" };
+
+	public static final String[] STATEMACHINE_INTERFACE_IDENTIFIERS = { "listeners", "operationCallback" };
+
+	public static final String[] STATEMACHINE_METHODS = { "getTimer", "setTimer", "getClass" };
+
+	public static final Set<String> javaKeywords() {
+		if (JAVA_KEYWORD_SET.isEmpty()) {
+			JAVA_KEYWORD_SET.addAll(Arrays.asList(JAVA_KEYWORDS));
+			JAVA_KEYWORD_SET = Collections.unmodifiableSet(JAVA_KEYWORD_SET);
+		}
+		return JAVA_KEYWORD_SET;
+	}
+
+	public static final Set<String> statemachineIdentifiers() {
+		if (STATEMACHICHNE_KEYWORD_SET.isEmpty()) {
+			STATEMACHICHNE_KEYWORD_SET.addAll(Arrays.asList(STATEMACHINE_IDENTIFIERS));
+			STATEMACHICHNE_KEYWORD_SET = Collections.unmodifiableSet(STATEMACHICHNE_KEYWORD_SET);
+		}
+		return STATEMACHICHNE_KEYWORD_SET;
+	}
+
+	public static final Set<String> statemachineInterfaceIdentifiers() {
+		if (STATEMACHINE_INTERFACE_KEYWORD_SET.isEmpty()) {
+			STATEMACHINE_INTERFACE_KEYWORD_SET.addAll(Arrays.asList(STATEMACHINE_INTERFACE_IDENTIFIERS));
+			STATEMACHINE_INTERFACE_KEYWORD_SET = Collections.unmodifiableSet(STATEMACHINE_INTERFACE_KEYWORD_SET);
+		}
+		return STATEMACHINE_INTERFACE_KEYWORD_SET;
+	}
+	
+	public static final Set<String> statemachineMethods() {
+		if (STATEMACHINE_METHOD_SET.isEmpty()) {
+			STATEMACHINE_METHOD_SET.addAll(Arrays.asList(STATEMACHINE_METHODS));
+			STATEMACHINE_METHOD_SET = Collections.unmodifiableSet(STATEMACHINE_METHOD_SET);
+		}
+		return STATEMACHINE_METHOD_SET;
+	}
+}

+ 36 - 55
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/Naming.xtend

@@ -6,20 +6,16 @@
  * http://www.eclipse.org/legal/epl-v10.html 
  * Contributors:
  * committers of YAKINDU - initial API and implementation
- *
-*/
+ * 
+ */
 package org.yakindu.sct.generator.java
 
 import com.google.inject.Inject
-import java.util.Arrays
-import java.util.regex.Matcher
-import java.util.regex.Pattern
 import org.yakindu.base.types.Event
 import org.yakindu.base.types.Property
 import org.yakindu.sct.model.sexec.ExecutionFlow
 import org.yakindu.sct.model.sexec.ExecutionState
 import org.yakindu.sct.model.sexec.Step
-import org.yakindu.sct.model.sexec.naming.INamingService
 import org.yakindu.sct.model.sgraph.State
 import org.yakindu.sct.model.stext.naming.StextNameProvider
 import org.yakindu.sct.model.stext.stext.EventDefinition
@@ -27,9 +23,9 @@ import org.yakindu.sct.model.stext.stext.InterfaceScope
 import org.yakindu.sct.model.stext.stext.InternalScope
 import org.yakindu.sct.model.stext.stext.VariableDefinition
 
-class Naming implements JavaKeywords {
+class Naming {
 
-	@Inject extension INamingService namingService;
+	@Inject extension JavaNamingService namingService;
 	@Inject StextNameProvider provider;
 
 	def iStatemachine() {
@@ -72,23 +68,10 @@ class Naming implements JavaKeywords {
 		"InternalOperationCallback"
 	}
 
-	def boolean isJavaKeyword(String name) {
-		var String lowName = name.toLowerCase();
-		for (String keyword : Arrays::asList(KEYWORDS)) {
-			var Pattern pattern = Pattern::compile("^" + keyword + "$");
-			var Matcher matcher = pattern.matcher(lowName);
-			if (matcher.find()) {
-				return true;
-			}
-		}
-		return false;
-	}
-
 	def dispatch String statemachineName(String name) {
-
 		// remove whitespaces;
 		var String newName = name.replace(" ", "")
-		if (isJavaKeyword(name)) {
+		if (name.isKeyword) {
 			return newName + "SM"
 		}
 		return newName
@@ -106,20 +89,16 @@ class Naming implements JavaKeywords {
 		"I" + statemachineClassName
 	}
 
-	def String getInterfaceName(InterfaceScope it) {
-		if (name != null) {
-			return "SCI" + name.toFirstUpper()
-		} else {
-			return "SCInterface";
-		}
+	def dispatch identifier(VariableDefinition it) {
+		escaped.asIdentifier
 	}
 
-	def dispatch getSymbol(VariableDefinition it) {
-		name.asEscapedIdentifier
+	def dispatch identifier(EventDefinition it) {
+		escaped.asIdentifier
 	}
 
-	def dispatch getSymbol(EventDefinition it) {
-		name.asEscapedIdentifier
+	def String getValueIdentifier(Event it) {
+		name.asIdentifier + "Value"
 	}
 
 	def String getInterfaceImplName(InterfaceScope it) {
@@ -147,52 +126,54 @@ class Naming implements JavaKeywords {
 		name.fullQualifiedStateName
 	}
 
-	def asIdentifier(String it) {
-		replaceAll('[^a-z&&[^A-Z&&[^0-9]]]', '_').toFirstLower
-	}
-
 	def asName(String it) {
 		asIdentifier.toFirstUpper
 	}
 
-	def asEscapedIdentifier(String it) {
-		var s = it
-		if (s.isJavaKeyword) {
-			s = s + '_ID'
-		}
-		return s.asIdentifier
-	}
-
 	def asEscapedName(String it) {
 		asEscapedIdentifier.toFirstUpper
 	}
 
-	def String getValueIdentifier(Event it) {
-		name.asIdentifier + "Value"
+	def private escaped(Property it) {
+		var varName = name
+		if (isKeyword) {
+			varName += "Variable"
+		}
+		return varName
 	}
 
-	def private varName(Property it) {
-		if (name.equalsIgnoreCase("class")) {
-			name.asEscapedName
-		} else {
-			name.asName
+	def private escaped(Event it) {
+		var varName = name
+		if (isKeyword) {
+			varName += "Event"
 		}
+		return varName
 	}
 
 	def String getter(Event it) {
 		"get" + name.asName + "Value()"
 	}
-	
+
 	def String getter(Property it) {
-		return "get" + varName + "()"
+		methodName("get", "()")
 	}
 
 	def String setter(Property it) {
-		"set" + varName
+		methodName("set", "");
 	}
 	
 	def String assign(Property it) {
-		"assign" + varName
+		methodName("assign", "")
+	}
+	
+	def private methodName(Property it, String prefix, String suffix) {
+		var methodName = prefix + name.asName
+
+		if (isStatemachineMethod(methodName) || isDerivedIdentifier(name)) {
+			methodName = prefix + escaped.asName
+		}
+
+		return methodName + suffix
 	}
 
 	def String getNullStateName() {

+ 20 - 19
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/Statemachine.xtend

@@ -31,6 +31,7 @@ import static org.eclipse.xtext.util.Strings.*
 class Statemachine {
 	
 	@Inject protected extension Naming
+	@Inject protected extension JavaNamingService
 	@Inject protected extension GenmodelEntries
 	@Inject protected extension Navigation
 	@Inject protected extension ICodegenTypeSystemAccess
@@ -128,7 +129,7 @@ class Statemachine {
 		«ENDIF»
 		
 		«FOR event : flow.internalScopeEvents»
-			private boolean «event.symbol»;
+			private boolean «event.identifier»;
 			
 			«IF event.type != null && !isSame(event.type, getType(GenericTypeSystem.VOID))»
 				private «event.type.targetLanguageName» «event.valueIdentifier»;
@@ -141,17 +142,17 @@ class Statemachine {
 				«variable.fieldDeclaration»
 				
 				protected void «variable.setter»(«variable.type.targetLanguageName» value) {
-					«variable.symbol» = value;
+					«variable.identifier» = value;
 				}
 				
 			«ENDIF»
 			protected «variable.type.targetLanguageName» «variable.getter» {
-				return «variable.symbol»;
+				return «variable.identifier»;
 			}
 			
 			«IF variable.needsAssignMethod»
 				protected «variable.type.targetLanguageName» «variable.assign»(«variable.type.targetLanguageName» value) {
-					return this.«variable.symbol» = value;
+					return this.«variable.identifier» = value;
 				}
 			«ENDIF»
 		«ENDFOR»
@@ -163,7 +164,7 @@ class Statemachine {
 	'''
 	//reused by interfaces
 	def protected fieldDeclaration(VariableDefinition variable) {
-		'''private «variable.type.targetLanguageName» «variable.symbol»;'''
+		'''private «variable.type.targetLanguageName» «variable.identifier»;'''
 	}
 	
 	def protected createConstructor(ExecutionFlow flow) '''
@@ -211,7 +212,7 @@ class Statemachine {
 			«ENDFOR»
 			«FOR scope : flow.internalScopes»
 				«FOR event : scope.eventDefinitions»
-					«event.symbol» = false;
+					«event.identifier» = false;
 				«ENDFOR»
 			«ENDFOR»
 			
@@ -370,7 +371,7 @@ class Statemachine {
 		protected void clearOutEvents() {
 		«FOR event : scope.eventDefinitions»
 			«IF event.direction == Direction::OUT»
-				«event.symbol» = false;
+				«event.identifier» = false;
 			«ENDIF»
 		«ENDFOR»
 		}
@@ -381,7 +382,7 @@ class Statemachine {
 		protected void clearEvents() {
 		«FOR event : scope.eventDefinitions»
 			«IF event.direction != Direction::OUT»
-			«event.symbol» = false;
+			«event.identifier» = false;
 			«ENDIF»
 		«ENDFOR»
 		}
@@ -393,25 +394,25 @@ class Statemachine {
 			
 		«ENDIF»
 		public «variable.type.targetLanguageName» «variable.getter» {
-			return «variable.symbol»;
+			return «variable.identifier»;
 		}
 		
 		«IF !variable.const»
 			«IF variable.readonly»protected«ELSE»public«ENDIF» void «variable.setter»(«variable.type.targetLanguageName» value) {
-				this.«variable.symbol» = value;
+				this.«variable.identifier» = value;
 			}
 			
 		«ENDIF»
 		
 		«IF variable.needsAssignMethod»
 			protected «variable.type.targetLanguageName» «variable.assign»(«variable.type.targetLanguageName» value) {
-				return this.«variable.symbol» = value;
+				return this.«variable.identifier» = value;
 			}
 		«ENDIF»
 	'''
 	
 	protected def generateEventDefinition(EventDefinition event, GeneratorEntry entry, InterfaceScope scope) '''
-		private boolean «event.symbol»;
+		private boolean «event.identifier»;
 		
 		«IF event.type != null && !isSame(event.type, getType(GenericTypeSystem.VOID))»
 			private «event.type.targetLanguageName» «event.valueIdentifier»;
@@ -429,12 +430,12 @@ class Statemachine {
 	protected def generateOutEventDefinition(EventDefinition event, GeneratorEntry entry, InterfaceScope scope) '''
 		
 		public boolean isRaised«event.name.asName»() {
-			return «event.symbol»;
+			return «event.identifier»;
 		}
 		
 		«IF event.type != null && !isSame(event.type, getType(GenericTypeSystem.VOID))»
 			protected void raise«event.name.asName»(«event.type.targetLanguageName» value) {
-				«event.symbol» = true;
+				«event.identifier» = true;
 				«event.valueIdentifier» = value;
 				«IF entry.createInterfaceObserver»
 				for («scope.interfaceListenerName» listener : listeners) {
@@ -449,7 +450,7 @@ class Statemachine {
 			}
 		«ELSE»
 			protected void raise«event.name.asName»() {
-				«event.symbol» = true;
+				«event.identifier» = true;
 				«IF entry.createInterfaceObserver»
 					for («scope.interfaceListenerName» listener : listeners) {
 						listener.on«event.name.asEscapedName»Raised();
@@ -462,7 +463,7 @@ class Statemachine {
 	protected def generateInEventDefinition(EventDefinition event) '''
 		«IF event.type != null && !isSame(event.type, getType(GenericTypeSystem.VOID))»
 			public void raise«event.name.asName»(«event.type.targetLanguageName» value) {
-				«event.symbol» = true;
+				«event.identifier» = true;
 				«event.valueIdentifier» = value;
 			}
 			
@@ -473,7 +474,7 @@ class Statemachine {
 			
 		«ELSE»
 			public void raise«event.name.asName»() {
-				«event.symbol» = true;
+				«event.identifier» = true;
 			}
 			
 		«ENDIF»
@@ -508,7 +509,7 @@ class Statemachine {
 			«IF event.type != null && !isSame(event.type, getType(GenericTypeSystem.VOID))»
 				private void raise«event.name.asEscapedName»(«event.type.targetLanguageName» value) {
 					«event.valueIdentifier» = value;
-					«event.symbol» = true;
+					«event.identifier» = true;
 				}
 				
 				private «event.type.targetLanguageName» get«event.name.asEscapedName»Value() {
@@ -518,7 +519,7 @@ class Statemachine {
 			«ELSE»
 			
 				private void raise«event.name.asEscapedName»() {
-					«event.symbol» = true;
+					«event.identifier» = true;
 				}
 				
 			«ENDIF»

+ 4 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/StatemachineInterface.xtend

@@ -27,6 +27,7 @@ import org.yakindu.sct.model.stext.stext.VariableDefinition
 class StatemachineInterface {
 
 	@Inject extension Naming
+	@Inject extension JavaNamingService
 	@Inject extension GenmodelEntries
 	@Inject extension Navigation
 	@Inject extension ITypeSystem
@@ -70,7 +71,7 @@ class StatemachineInterface {
 	
 	
 	def protected constantFieldDeclaration(VariableDefinition variable){
-		'''public static final «variable.type.targetLanguageName» «variable.symbol» = «variable.initialValue.code»;'''
+		'''public static final «variable.type.targetLanguageName» «variable.identifier» = «variable.initialValue.code»;'''
 	}
 
 	def protected createScope(Scope scope, GeneratorEntry entry) {
@@ -181,7 +182,7 @@ class StatemachineInterface {
 		«FOR variable : scope.variableDefinitions»
 			public «variable.type.targetLanguageName» «variable.getter»;
 			«IF !variable.readonly && !variable.const»
-				public void «variable.setter»(«variable.type.targetLanguageName» value);	
+				public void «variable.setter»(«variable.type.targetLanguageName» value);
 			«ENDIF»
 		«ENDFOR»
 	'''
@@ -207,7 +208,7 @@ class StatemachineInterface {
 	}
 
 	def protected identifier(Parameter parameter) {
-		if (parameter.name.isJavaKeyword()) {
+		if (parameter.name.isKeyword) {
 			return parameter.name + "Arg"
 		} else {
 			parameter.name

+ 2 - 0
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/features/CycleBasedWrapperFeature.xtend

@@ -16,10 +16,12 @@ import org.yakindu.sct.model.sexec.ExecutionFlow
 import com.google.inject.Inject
 import org.yakindu.sct.generator.java.Naming
 import org.yakindu.sct.model.stext.stext.InterfaceScope
+import org.yakindu.sct.generator.java.JavaNamingService
 
 class CycleBasedWrapperFeature {
 
 	@Inject extension Naming
+	@Inject extension JavaNamingService
 
 	def getFeatureCycleWrapper(GeneratorEntry it) {
 		getFeatureConfiguration(IJavaFeatureConstants::FEATURE_SYCHRONIZED_WRAPPER);

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 240 - 219
test-plugins/org.yakindu.sct.generator.java.test/model/model.sgen


+ 57 - 57
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/ckeywords/CKeywordsStatemachine.java

@@ -10,60 +10,60 @@ public class CKeywordsStatemachine implements ICKeywordsStatemachine {
 			auto = true;
 		}
 
-		private boolean break_ID;
+		private boolean breakEvent;
 
 		public void raiseBreak() {
-			break_ID = true;
+			breakEvent = true;
 		}
 
-		private boolean case_ID;
+		private boolean caseVariable;
 
 		public boolean getCase() {
-			return case_ID;
+			return caseVariable;
 		}
 
 		public void setCase(boolean value) {
-			this.case_ID = value;
+			this.caseVariable = value;
 		}
 
-		private long do_ID;
+		private long doVariable;
 
 		public long getDo() {
-			return do_ID;
+			return doVariable;
 		}
 
 		public void setDo(long value) {
-			this.do_ID = value;
+			this.doVariable = value;
 		}
 
-		private boolean continue_ID;
+		private boolean continueVariable;
 
 		public boolean getContinue() {
-			return continue_ID;
+			return continueVariable;
 		}
 
 		public void setContinue(boolean value) {
-			this.continue_ID = value;
+			this.continueVariable = value;
 		}
 
-		private boolean double_ID;
+		private boolean doubleVariable;
 
 		public boolean getDouble() {
-			return double_ID;
+			return doubleVariable;
 		}
 
 		public void setDouble(boolean value) {
-			this.double_ID = value;
+			this.doubleVariable = value;
 		}
 
-		private boolean enum_ID;
+		private boolean enumVariable;
 
 		public boolean getEnum() {
-			return enum_ID;
+			return enumVariable;
 		}
 
 		public void setEnum(boolean value) {
-			this.enum_ID = value;
+			this.enumVariable = value;
 		}
 
 		private boolean extern;
@@ -76,64 +76,64 @@ public class CKeywordsStatemachine implements ICKeywordsStatemachine {
 			this.extern = value;
 		}
 
-		private boolean float_ID;
+		private boolean floatVariable;
 
 		public boolean getFloat() {
-			return float_ID;
+			return floatVariable;
 		}
 
 		public void setFloat(boolean value) {
-			this.float_ID = value;
+			this.floatVariable = value;
 		}
 
-		private boolean for_ID;
+		private boolean forVariable;
 
 		public boolean getFor() {
-			return for_ID;
+			return forVariable;
 		}
 
 		public void setFor(boolean value) {
-			this.for_ID = value;
+			this.forVariable = value;
 		}
 
-		private boolean goto_ID;
+		private boolean gotoVariable;
 
 		public boolean getGoto() {
-			return goto_ID;
+			return gotoVariable;
 		}
 
 		public void setGoto(boolean value) {
-			this.goto_ID = value;
+			this.gotoVariable = value;
 		}
 
-		private boolean if_ID;
+		private boolean ifVariable;
 
 		public boolean getIf() {
-			return if_ID;
+			return ifVariable;
 		}
 
 		public void setIf(boolean value) {
-			this.if_ID = value;
+			this.ifVariable = value;
 		}
 
-		private boolean int_ID;
+		private boolean intVariable;
 
 		public boolean getInt() {
-			return int_ID;
+			return intVariable;
 		}
 
 		public void setInt(boolean value) {
-			this.int_ID = value;
+			this.intVariable = value;
 		}
 
-		private boolean long_ID;
+		private boolean longVariable;
 
 		public boolean getLong() {
-			return long_ID;
+			return longVariable;
 		}
 
 		public void setLong(boolean value) {
-			this.long_ID = value;
+			this.longVariable = value;
 		}
 
 		private boolean register;
@@ -146,24 +146,24 @@ public class CKeywordsStatemachine implements ICKeywordsStatemachine {
 			this.register = value;
 		}
 
-		private boolean return_ID;
+		private boolean returnVariable;
 
 		public boolean getReturn() {
-			return return_ID;
+			return returnVariable;
 		}
 
 		public void setReturn(boolean value) {
-			this.return_ID = value;
+			this.returnVariable = value;
 		}
 
-		private boolean short_ID;
+		private boolean shortVariable;
 
 		public boolean getShort() {
-			return short_ID;
+			return shortVariable;
 		}
 
 		public void setShort(boolean value) {
-			this.short_ID = value;
+			this.shortVariable = value;
 		}
 
 		private boolean signed;
@@ -186,14 +186,14 @@ public class CKeywordsStatemachine implements ICKeywordsStatemachine {
 			this.sizeof = value;
 		}
 
-		private boolean static_ID;
+		private boolean staticVariable;
 
 		public boolean getStatic() {
-			return static_ID;
+			return staticVariable;
 		}
 
 		public void setStatic(boolean value) {
-			this.static_ID = value;
+			this.staticVariable = value;
 		}
 
 		private boolean struct;
@@ -206,14 +206,14 @@ public class CKeywordsStatemachine implements ICKeywordsStatemachine {
 			this.struct = value;
 		}
 
-		private boolean switch_ID;
+		private boolean switchVariable;
 
 		public boolean getSwitch() {
-			return switch_ID;
+			return switchVariable;
 		}
 
 		public void setSwitch(boolean value) {
-			this.switch_ID = value;
+			this.switchVariable = value;
 		}
 
 		private boolean typedef;
@@ -246,39 +246,39 @@ public class CKeywordsStatemachine implements ICKeywordsStatemachine {
 			this.unsigned = value;
 		}
 
-		private boolean void_ID;
+		private boolean voidVariable;
 
 		public boolean getVoid() {
-			return void_ID;
+			return voidVariable;
 		}
 
 		public void setVoid(boolean value) {
-			this.void_ID = value;
+			this.voidVariable = value;
 		}
 
-		private boolean volatile_ID;
+		private boolean volatileVariable;
 
 		public boolean getVolatile() {
-			return volatile_ID;
+			return volatileVariable;
 		}
 
 		public void setVolatile(boolean value) {
-			this.volatile_ID = value;
+			this.volatileVariable = value;
 		}
 
-		private boolean while_ID;
+		private boolean whileVariable;
 
 		public boolean getWhile() {
-			return while_ID;
+			return whileVariable;
 		}
 
 		public void setWhile(boolean value) {
-			this.while_ID = value;
+			this.whileVariable = value;
 		}
 
 		protected void clearEvents() {
 			auto = false;
-			break_ID = false;
+			breakEvent = false;
 		}
 
 	}

+ 4 - 4
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/guard/GuardStatemachine.java

@@ -16,10 +16,10 @@ public class GuardStatemachine implements IGuardStatemachine {
 			event2 = true;
 		}
 
-		private boolean return_ID;
+		private boolean returnEvent;
 
 		public void raiseReturn() {
-			return_ID = true;
+			returnEvent = true;
 		}
 
 		private long myVar;
@@ -35,7 +35,7 @@ public class GuardStatemachine implements IGuardStatemachine {
 		protected void clearEvents() {
 			event1 = false;
 			event2 = false;
-			return_ID = false;
+			returnEvent = false;
 		}
 
 	}
@@ -157,7 +157,7 @@ public class GuardStatemachine implements IGuardStatemachine {
 	}
 
 	private boolean check_main_region_B_tr0_tr0() {
-		return sCInterface.return_ID;
+		return sCInterface.returnEvent;
 	}
 
 	private void effect_main_region_A_tr0() {

+ 2 - 2
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/javakeywords/IJavaKeywordsStatemachine.java

@@ -21,8 +21,8 @@ public interface IJavaKeywordsStatemachine extends IStatemachine {
 		public void setCatch(boolean value);
 		public boolean getChar();
 		public void setChar(boolean value);
-		public boolean getClass_ID();
-		public void setClass_ID(boolean value);
+		public boolean getClassVariable();
+		public void setClass(boolean value);
 		public boolean getContinue();
 		public void setContinue(boolean value);
 		public boolean getDo();

+ 146 - 146
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/javakeywords/JavaKeywordsStatemachine.java

@@ -4,10 +4,10 @@ public class JavaKeywordsStatemachine implements IJavaKeywordsStatemachine {
 
 	protected class SCInterfaceImpl implements SCInterface {
 
-		private boolean while_ID;
+		private boolean whileEvent;
 
 		public void raiseWhile() {
-			while_ID = true;
+			whileEvent = true;
 		}
 
 		private boolean ev;
@@ -16,448 +16,448 @@ public class JavaKeywordsStatemachine implements IJavaKeywordsStatemachine {
 			ev = true;
 		}
 
-		private boolean abstract_ID;
+		private boolean abstractVariable;
 
 		public boolean getAbstract() {
-			return abstract_ID;
+			return abstractVariable;
 		}
 
 		public void setAbstract(boolean value) {
-			this.abstract_ID = value;
+			this.abstractVariable = value;
 		}
 
-		private boolean assert_ID;
+		private boolean assertVariable;
 
 		public boolean getAssert() {
-			return assert_ID;
+			return assertVariable;
 		}
 
 		public void setAssert(boolean value) {
-			this.assert_ID = value;
+			this.assertVariable = value;
 		}
 
-		private boolean boolean_ID;
+		private boolean booleanVariable;
 
 		public boolean getBoolean() {
-			return boolean_ID;
+			return booleanVariable;
 		}
 
 		public void setBoolean(boolean value) {
-			this.boolean_ID = value;
+			this.booleanVariable = value;
 		}
 
-		private boolean break_ID;
+		private boolean breakVariable;
 
 		public boolean getBreak() {
-			return break_ID;
+			return breakVariable;
 		}
 
 		public void setBreak(boolean value) {
-			this.break_ID = value;
+			this.breakVariable = value;
 		}
 
-		private boolean byte_ID;
+		private boolean byteVariable;
 
 		public boolean getByte() {
-			return byte_ID;
+			return byteVariable;
 		}
 
 		public void setByte(boolean value) {
-			this.byte_ID = value;
+			this.byteVariable = value;
 		}
 
-		private boolean case_ID;
+		private boolean caseVariable;
 
 		public boolean getCase() {
-			return case_ID;
+			return caseVariable;
 		}
 
 		public void setCase(boolean value) {
-			this.case_ID = value;
+			this.caseVariable = value;
 		}
 
-		private boolean catch_ID;
+		private boolean catchVariable;
 
 		public boolean getCatch() {
-			return catch_ID;
+			return catchVariable;
 		}
 
 		public void setCatch(boolean value) {
-			this.catch_ID = value;
+			this.catchVariable = value;
 		}
 
-		private boolean char_ID;
+		private boolean charVariable;
 
 		public boolean getChar() {
-			return char_ID;
+			return charVariable;
 		}
 
 		public void setChar(boolean value) {
-			this.char_ID = value;
+			this.charVariable = value;
 		}
 
-		private boolean class_ID;
+		private boolean classVariable;
 
-		public boolean getClass_ID() {
-			return class_ID;
+		public boolean getClassVariable() {
+			return classVariable;
 		}
 
-		public void setClass_ID(boolean value) {
-			this.class_ID = value;
+		public void setClass(boolean value) {
+			this.classVariable = value;
 		}
 
-		private boolean continue_ID;
+		private boolean continueVariable;
 
 		public boolean getContinue() {
-			return continue_ID;
+			return continueVariable;
 		}
 
 		public void setContinue(boolean value) {
-			this.continue_ID = value;
+			this.continueVariable = value;
 		}
 
-		private boolean do_ID;
+		private boolean doVariable;
 
 		public boolean getDo() {
-			return do_ID;
+			return doVariable;
 		}
 
 		public void setDo(boolean value) {
-			this.do_ID = value;
+			this.doVariable = value;
 		}
 
-		private boolean double_ID;
+		private boolean doubleVariable;
 
 		public boolean getDouble() {
-			return double_ID;
+			return doubleVariable;
 		}
 
 		public void setDouble(boolean value) {
-			this.double_ID = value;
+			this.doubleVariable = value;
 		}
 
-		private boolean enum_ID;
+		private boolean enumVariable;
 
 		public boolean getEnum() {
-			return enum_ID;
+			return enumVariable;
 		}
 
 		public void setEnum(boolean value) {
-			this.enum_ID = value;
+			this.enumVariable = value;
 		}
 
-		private boolean extends_ID;
+		private boolean extendsVariable;
 
 		public boolean getExtends() {
-			return extends_ID;
+			return extendsVariable;
 		}
 
 		public void setExtends(boolean value) {
-			this.extends_ID = value;
+			this.extendsVariable = value;
 		}
 
-		private boolean final_ID;
+		private boolean finalVariable;
 
 		public boolean getFinal() {
-			return final_ID;
+			return finalVariable;
 		}
 
 		public void setFinal(boolean value) {
-			this.final_ID = value;
+			this.finalVariable = value;
 		}
 
-		private boolean finally_ID;
+		private boolean finallyVariable;
 
 		public boolean getFinally() {
-			return finally_ID;
+			return finallyVariable;
 		}
 
 		public void setFinally(boolean value) {
-			this.finally_ID = value;
+			this.finallyVariable = value;
 		}
 
-		private boolean float_ID;
+		private boolean floatVariable;
 
 		public boolean getFloat() {
-			return float_ID;
+			return floatVariable;
 		}
 
 		public void setFloat(boolean value) {
-			this.float_ID = value;
+			this.floatVariable = value;
 		}
 
-		private boolean for_ID;
+		private boolean forVariable;
 
 		public boolean getFor() {
-			return for_ID;
+			return forVariable;
 		}
 
 		public void setFor(boolean value) {
-			this.for_ID = value;
+			this.forVariable = value;
 		}
 
-		private boolean goto_ID;
+		private boolean gotoVariable;
 
 		public boolean getGoto() {
-			return goto_ID;
+			return gotoVariable;
 		}
 
 		public void setGoto(boolean value) {
-			this.goto_ID = value;
+			this.gotoVariable = value;
 		}
 
-		private boolean if_ID;
+		private boolean ifVariable;
 
 		public boolean getIf() {
-			return if_ID;
+			return ifVariable;
 		}
 
 		public void setIf(boolean value) {
-			this.if_ID = value;
+			this.ifVariable = value;
 		}
 
-		private boolean implements_ID;
+		private boolean implementsVariable;
 
 		public boolean getImplements() {
-			return implements_ID;
+			return implementsVariable;
 		}
 
 		public void setImplements(boolean value) {
-			this.implements_ID = value;
+			this.implementsVariable = value;
 		}
 
-		private boolean instanceof_ID;
+		private boolean instanceofVariable;
 
 		public boolean getInstanceof() {
-			return instanceof_ID;
+			return instanceofVariable;
 		}
 
 		public void setInstanceof(boolean value) {
-			this.instanceof_ID = value;
+			this.instanceofVariable = value;
 		}
 
-		private boolean int_ID;
+		private boolean intVariable;
 
 		public boolean getInt() {
-			return int_ID;
+			return intVariable;
 		}
 
 		public void setInt(boolean value) {
-			this.int_ID = value;
+			this.intVariable = value;
 		}
 
-		private boolean long_ID;
+		private boolean longVariable;
 
 		public boolean getLong() {
-			return long_ID;
+			return longVariable;
 		}
 
 		public void setLong(boolean value) {
-			this.long_ID = value;
+			this.longVariable = value;
 		}
 
-		private boolean native_ID;
+		private boolean nativeVariable;
 
 		public boolean getNative() {
-			return native_ID;
+			return nativeVariable;
 		}
 
 		public void setNative(boolean value) {
-			this.native_ID = value;
+			this.nativeVariable = value;
 		}
 
-		private boolean new_ID;
+		private boolean newVariable;
 
 		public boolean getNew() {
-			return new_ID;
+			return newVariable;
 		}
 
 		public void setNew(boolean value) {
-			this.new_ID = value;
+			this.newVariable = value;
 		}
 
-		private boolean package_ID;
+		private boolean packageVariable;
 
 		public boolean getPackage() {
-			return package_ID;
+			return packageVariable;
 		}
 
 		public void setPackage(boolean value) {
-			this.package_ID = value;
+			this.packageVariable = value;
 		}
 
-		private boolean private_ID;
+		private boolean privateVariable;
 
 		public boolean getPrivate() {
-			return private_ID;
+			return privateVariable;
 		}
 
 		public void setPrivate(boolean value) {
-			this.private_ID = value;
+			this.privateVariable = value;
 		}
 
-		private boolean protected_ID;
+		private boolean protectedVariable;
 
 		public boolean getProtected() {
-			return protected_ID;
+			return protectedVariable;
 		}
 
 		public void setProtected(boolean value) {
-			this.protected_ID = value;
+			this.protectedVariable = value;
 		}
 
-		private boolean public_ID;
+		private boolean publicVariable;
 
 		public boolean getPublic() {
-			return public_ID;
+			return publicVariable;
 		}
 
 		public void setPublic(boolean value) {
-			this.public_ID = value;
+			this.publicVariable = value;
 		}
 
-		private boolean return_ID;
+		private boolean returnVariable;
 
 		public boolean getReturn() {
-			return return_ID;
+			return returnVariable;
 		}
 
 		public void setReturn(boolean value) {
-			this.return_ID = value;
+			this.returnVariable = value;
 		}
 
-		private boolean short_ID;
+		private boolean shortVariable;
 
 		public boolean getShort() {
-			return short_ID;
+			return shortVariable;
 		}
 
 		public void setShort(boolean value) {
-			this.short_ID = value;
+			this.shortVariable = value;
 		}
 
-		private boolean static_ID;
+		private boolean staticVariable;
 
 		public boolean getStatic() {
-			return static_ID;
+			return staticVariable;
 		}
 
 		public void setStatic(boolean value) {
-			this.static_ID = value;
+			this.staticVariable = value;
 		}
 
-		private boolean strictfp_ID;
+		private boolean strictfpVariable;
 
 		public boolean getStrictfp() {
-			return strictfp_ID;
+			return strictfpVariable;
 		}
 
 		public void setStrictfp(boolean value) {
-			this.strictfp_ID = value;
+			this.strictfpVariable = value;
 		}
 
-		private boolean super_ID;
+		private boolean superVariable;
 
 		public boolean getSuper() {
-			return super_ID;
+			return superVariable;
 		}
 
 		public void setSuper(boolean value) {
-			this.super_ID = value;
+			this.superVariable = value;
 		}
 
-		private boolean switch_ID;
+		private boolean switchVariable;
 
 		public boolean getSwitch() {
-			return switch_ID;
+			return switchVariable;
 		}
 
 		public void setSwitch(boolean value) {
-			this.switch_ID = value;
+			this.switchVariable = value;
 		}
 
-		private boolean synchronized_ID;
+		private boolean synchronizedVariable;
 
 		public boolean getSynchronized() {
-			return synchronized_ID;
+			return synchronizedVariable;
 		}
 
 		public void setSynchronized(boolean value) {
-			this.synchronized_ID = value;
+			this.synchronizedVariable = value;
 		}
 
-		private boolean this_ID;
+		private boolean thisVariable;
 
 		public boolean getThis() {
-			return this_ID;
+			return thisVariable;
 		}
 
 		public void setThis(boolean value) {
-			this.this_ID = value;
+			this.thisVariable = value;
 		}
 
-		private boolean throw_ID;
+		private boolean throwVariable;
 
 		public boolean getThrow() {
-			return throw_ID;
+			return throwVariable;
 		}
 
 		public void setThrow(boolean value) {
-			this.throw_ID = value;
+			this.throwVariable = value;
 		}
 
-		private boolean throws_ID;
+		private boolean throwsVariable;
 
 		public boolean getThrows() {
-			return throws_ID;
+			return throwsVariable;
 		}
 
 		public void setThrows(boolean value) {
-			this.throws_ID = value;
+			this.throwsVariable = value;
 		}
 
-		private boolean transient_ID;
+		private boolean transientVariable;
 
 		public boolean getTransient() {
-			return transient_ID;
+			return transientVariable;
 		}
 
 		public void setTransient(boolean value) {
-			this.transient_ID = value;
+			this.transientVariable = value;
 		}
 
-		private boolean try_ID;
+		private boolean tryVariable;
 
 		public boolean getTry() {
-			return try_ID;
+			return tryVariable;
 		}
 
 		public void setTry(boolean value) {
-			this.try_ID = value;
+			this.tryVariable = value;
 		}
 
-		private boolean void_ID;
+		private boolean voidVariable;
 
 		public boolean getVoid() {
-			return void_ID;
+			return voidVariable;
 		}
 
 		public void setVoid(boolean value) {
-			this.void_ID = value;
+			this.voidVariable = value;
 		}
 
-		private boolean volatile_ID;
+		private boolean volatileVariable;
 
 		public boolean getVolatile() {
-			return volatile_ID;
+			return volatileVariable;
 		}
 
 		public void setVolatile(boolean value) {
-			this.volatile_ID = value;
+			this.volatileVariable = value;
 		}
 
 		protected void clearEvents() {
-			while_ID = false;
+			whileEvent = false;
 			ev = false;
 		}
 
@@ -509,7 +509,7 @@ public class JavaKeywordsStatemachine implements IJavaKeywordsStatemachine {
 
 		sCInterface.setChar(false);
 
-		sCInterface.setClass_ID(false);
+		sCInterface.setClass(false);
 
 		sCInterface.setContinue(false);
 
@@ -716,12 +716,12 @@ public class JavaKeywordsStatemachine implements IJavaKeywordsStatemachine {
 	public void setChar(boolean value) {
 		sCInterface.setChar(value);
 	}
-	public boolean getClass_ID() {
-		return sCInterface.getClass_ID();
+	public boolean getClassVariable() {
+		return sCInterface.getClassVariable();
 	}
 
-	public void setClass_ID(boolean value) {
-		sCInterface.setClass_ID(value);
+	public void setClass(boolean value) {
+		sCInterface.setClass(value);
 	}
 	public boolean getContinue() {
 		return sCInterface.getContinue();
@@ -970,11 +970,11 @@ public class JavaKeywordsStatemachine implements IJavaKeywordsStatemachine {
 	}
 
 	private boolean check_goto_abstract_tr0_tr0() {
-		return (sCInterface.while_ID) && (true);
+		return (sCInterface.whileEvent) && (true);
 	}
 
 	private boolean check_goto_boolean_tr0_tr0() {
-		return sCInterface.while_ID;
+		return sCInterface.whileEvent;
 	}
 
 	private boolean check_goto_boolean_tr1_tr1() {
@@ -1029,7 +1029,7 @@ public class JavaKeywordsStatemachine implements IJavaKeywordsStatemachine {
 
 		sCInterface.setChar(true);
 
-		sCInterface.setClass_ID(true);
+		sCInterface.setClass(true);
 
 		sCInterface.setContinue(true);
 
@@ -1120,7 +1120,7 @@ public class JavaKeywordsStatemachine implements IJavaKeywordsStatemachine {
 
 		sCInterface.setChar(false);
 
-		sCInterface.setClass_ID(false);
+		sCInterface.setClass(false);
 
 		sCInterface.setContinue(false);
 

+ 42 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/statechartkeywords/IStatechartKeywordsStatemachine.java

@@ -0,0 +1,42 @@
+package org.yakindu.scr.statechartkeywords;
+import java.util.List;
+import org.yakindu.scr.IStatemachine;
+import org.yakindu.scr.ITimerCallback;
+
+public interface IStatechartKeywordsStatemachine extends ITimerCallback, IStatemachine {
+
+	public interface SCIIf {
+		public boolean isRaisedOperationCallback();
+		public boolean isRaisedListeners();
+		public long getTimer();
+		public void setTimer(long value);
+		public long getIsActive();
+		public void setIsActive(long value);
+		public long getInit();
+		public void setInit(long value);
+		public long getEnter();
+		public void setEnter(long value);
+		public long getRunCycle();
+		public void setRunCycle(long value);
+		public List<SCIIfListener> getListeners();
+
+		public void setSCIIfOperationCallback(SCIIfOperationCallback operationCallback);
+	}
+
+	public interface SCIIfListener {
+		public void onOperationCallbackRaised();
+		public void onListenersRaised();
+	}
+
+	public interface SCIIfOperationCallback {
+		public void myOperation();
+	}
+
+	public SCIIf getSCIIf();
+
+	public interface InternalOperationCallback {
+		public void myOperation();
+	}
+
+	public void setInternalOperationCallback(InternalOperationCallback operationCallback);
+}

+ 418 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/statechartkeywords/StatechartKeywordsStatemachine.java

@@ -0,0 +1,418 @@
+package org.yakindu.scr.statechartkeywords;
+import java.util.LinkedList;
+import java.util.List;
+import org.yakindu.scr.ITimer;
+
+public class StatechartKeywordsStatemachine implements IStatechartKeywordsStatemachine {
+
+	protected class SCIIfImpl implements SCIIf {
+
+		private List<SCIIfListener> listeners = new LinkedList<SCIIfListener>();
+
+		public List<SCIIfListener> getListeners() {
+			return listeners;
+		}
+
+		private SCIIfOperationCallback operationCallback;
+
+		public void setSCIIfOperationCallback(SCIIfOperationCallback operationCallback) {
+			this.operationCallback = operationCallback;
+		}
+
+		private boolean operationCallbackEvent;
+
+		public boolean isRaisedOperationCallback() {
+			return operationCallbackEvent;
+		}
+
+		protected void raiseOperationCallback() {
+			operationCallbackEvent = true;
+			for (SCIIfListener listener : listeners) {
+				listener.onOperationCallbackRaised();
+			}
+		}
+
+		private boolean listenersEvent;
+
+		public boolean isRaisedListeners() {
+			return listenersEvent;
+		}
+
+		protected void raiseListeners() {
+			listenersEvent = true;
+			for (SCIIfListener listener : listeners) {
+				listener.onListenersRaised();
+			}
+		}
+
+		private long timer;
+
+		public long getTimer() {
+			return timer;
+		}
+
+		public void setTimer(long value) {
+			this.timer = value;
+		}
+
+		private long isActive;
+
+		public long getIsActive() {
+			return isActive;
+		}
+
+		public void setIsActive(long value) {
+			this.isActive = value;
+		}
+
+		private long init;
+
+		public long getInit() {
+			return init;
+		}
+
+		public void setInit(long value) {
+			this.init = value;
+		}
+
+		private long enter;
+
+		public long getEnter() {
+			return enter;
+		}
+
+		public void setEnter(long value) {
+			this.enter = value;
+		}
+
+		private long runCycle;
+
+		public long getRunCycle() {
+			return runCycle;
+		}
+
+		public void setRunCycle(long value) {
+			this.runCycle = value;
+		}
+
+		protected void clearEvents() {
+		}
+
+		protected void clearOutEvents() {
+			operationCallbackEvent = false;
+			listenersEvent = false;
+		}
+	}
+
+	protected SCIIfImpl sCIIf;
+
+	private boolean initialized = false;
+
+	public enum State {
+		main_region_Timer, $NullState$
+	};
+
+	private final State[] stateVector = new State[1];
+
+	private int nextStateIndex;
+
+	private ITimer timer;
+
+	private final boolean[] timeEvents = new boolean[1];
+
+	private boolean operationCallbackEvent;
+
+	private boolean listeners;
+
+	private long timerVariable;
+
+	protected void setTimerVariable(long value) {
+		timerVariable = value;
+	}
+
+	protected long getTimerVariable() {
+		return timerVariable;
+	}
+
+	private long isActive;
+
+	protected void setIsActive(long value) {
+		isActive = value;
+	}
+
+	protected long getIsActive() {
+		return isActive;
+	}
+
+	private long init;
+
+	protected void setInit(long value) {
+		init = value;
+	}
+
+	protected long getInit() {
+		return init;
+	}
+
+	private long enter;
+
+	protected void setEnter(long value) {
+		enter = value;
+	}
+
+	protected long getEnter() {
+		return enter;
+	}
+
+	private long runCycle;
+
+	protected void setRunCycle(long value) {
+		runCycle = value;
+	}
+
+	protected long getRunCycle() {
+		return runCycle;
+	}
+
+	private long sCIIfVariable;
+
+	protected void setSCIIfVariable(long value) {
+		sCIIfVariable = value;
+	}
+
+	protected long getSCIIfVariable() {
+		return sCIIfVariable;
+	}
+
+	private InternalOperationCallback operationCallback;
+
+	public StatechartKeywordsStatemachine() {
+
+		sCIIf = new SCIIfImpl();
+	}
+
+	public void init() {
+		this.initialized = true;
+		if (timer == null) {
+			throw new IllegalStateException("timer not set.");
+		}
+		for (int i = 0; i < 1; i++) {
+			stateVector[i] = State.$NullState$;
+		}
+
+		clearEvents();
+		clearOutEvents();
+
+		sCIIf.setTimer(0);
+
+		sCIIf.setIsActive(0);
+
+		sCIIf.setInit(0);
+
+		sCIIf.setEnter(0);
+
+		sCIIf.setRunCycle(0);
+
+		setTimerVariable(0);
+
+		setIsActive(0);
+
+		setInit(0);
+
+		setEnter(0);
+
+		setRunCycle(0);
+
+		setSCIIfVariable(0);
+	}
+
+	public void enter() {
+		if (!initialized)
+			throw new IllegalStateException(
+					"The state machine needs to be initialized first by calling the init() function.");
+
+		if (timer == null) {
+			throw new IllegalStateException("timer not set.");
+		}
+		entryAction();
+
+		enterSequence_main_region_default();
+	}
+
+	public void exit() {
+		exitSequence_main_region();
+
+		exitAction();
+	}
+
+	/**
+	 * @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() {
+		sCIIf.clearEvents();
+		operationCallbackEvent = false;
+		listeners = false;
+
+		for (int i = 0; i < timeEvents.length; i++) {
+			timeEvents[i] = false;
+		}
+	}
+
+	/**
+	* This method resets the outgoing events.
+	*/
+	protected void clearOutEvents() {
+		sCIIf.clearOutEvents();
+	}
+
+	/**
+	* Returns true if the given state is currently active otherwise false.
+	*/
+	public boolean isStateActive(State state) {
+		switch (state) {
+			case main_region_Timer :
+				return stateVector[0] == State.main_region_Timer;
+			default :
+				return false;
+		}
+	}
+
+	/**
+	* Set the {@link ITimer} for the state machine. It must be set
+	* externally on a timed state machine before a run cycle can be correct
+	* executed.
+	* 
+	* @param timer
+	*/
+	public void setTimer(ITimer timer) {
+		this.timer = timer;
+	}
+
+	/**
+	* Returns the currently used timer.
+	* 
+	* @return {@link ITimer}
+	*/
+	public ITimer getTimer() {
+		return timer;
+	}
+
+	public void timeElapsed(int eventID) {
+		timeEvents[eventID] = true;
+	}
+
+	public SCIIf getSCIIf() {
+		return sCIIf;
+	}
+
+	private void raiseOperationCallback() {
+		operationCallbackEvent = true;
+	}
+
+	private void raiseListeners() {
+		listeners = true;
+	}
+
+	public void setInternalOperationCallback(InternalOperationCallback operationCallback) {
+		this.operationCallback = operationCallback;
+	}
+
+	private boolean check__lr0() {
+		return timeEvents[0];
+	}
+
+	private void effect__lr0() {
+		setTimerVariable(getTimerVariable() + 1);
+	}
+
+	/* Entry action for statechart 'StatechartKeywords'. */
+	private void entryAction() {
+
+		timer.setTimer(this, 0, 1 * 1000, true);
+	}
+
+	/* Exit action for state 'StatechartKeywords'. */
+	private void exitAction() {
+		timer.unsetTimer(this, 0);
+	}
+
+	/* 'default' enter sequence for state Timer */
+	private void enterSequence_main_region_Timer_default() {
+		nextStateIndex = 0;
+		stateVector[0] = State.main_region_Timer;
+	}
+
+	/* 'default' enter sequence for region main region */
+	private void enterSequence_main_region_default() {
+		react_main_region__entry_Default();
+	}
+
+	/* Default exit sequence for state Timer */
+	private void exitSequence_main_region_Timer() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+
+	/* Default exit sequence for region main region */
+	private void exitSequence_main_region() {
+		switch (stateVector[0]) {
+			case main_region_Timer :
+				exitSequence_main_region_Timer();
+				break;
+
+			default :
+				break;
+		}
+	}
+
+	/* The reactions of state Timer. */
+	private void react_main_region_Timer() {
+		if (check__lr0()) {
+			effect__lr0();
+		}
+
+	}
+
+	/* Default react sequence for initial entry  */
+	private void react_main_region__entry_Default() {
+		enterSequence_main_region_Timer_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 main_region_Timer :
+					react_main_region_Timer();
+					break;
+				default :
+					// $NullState$
+			}
+		}
+
+		clearEvents();
+	}
+}

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 73 - 0
test-plugins/org.yakindu.sct.test.models/testmodels/SCTUnit/StatechartKeywords.sct