Bläddra i källkod

Moved event declaration of interface scopes from java interface class to java interface implementation class.

markus.muehlbrandt@itemis.de 14 år sedan
förälder
incheckning
705be42f71
20 ändrade filer med 143 tillägg och 114 borttagningar
  1. 11 11
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomBaseStatemachine.xpt
  2. 4 4
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomCycleBasedStatemachine.xpt
  3. 4 4
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomEventBasedStatemachine.xpt
  4. 8 12
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterface.xpt
  5. 15 8
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterfaceImpl.xpt
  6. 3 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Event.xpt
  7. 4 4
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/EventNotification.xpt
  8. 1 1
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Expression.ext
  9. 3 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/INotificationListener.xpt
  10. 3 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/INotificationSender.xpt
  11. 3 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/IStatemachine.xpt
  12. 4 4
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimedStatemachine.xpt
  13. 3 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimerHandler.xpt
  14. 18 21
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Main.xpt
  15. 43 14
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Naming.ext
  16. 3 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Notification.xpt
  17. 3 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/NotificationSender.xpt
  18. 3 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/NotificationType.xpt
  19. 3 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/TimeEvent.xpt
  20. 4 4
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/TimerHandler.xpt

+ 11 - 11
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomBaseStatemachine.xpt

@@ -144,25 +144,25 @@ else {
 	}
 «ENDDEFINE»
 
-«DEFINE file FOR ExecutionFlow-»
-«FILE getCustomPackage()+getBaseStatemachineName()+'.java'-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
+«FILE getImplementationPackagePath(entry)+"/"+getBaseStatemachineName()+'.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.«getStatemachineName().toLowerCase()»;
+package «getImplementationPackageName(entry)»;
 
 import java.util.Collection;
 import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Set;
 
-import org.yakindu.sct.runtime.java.base.Event;
+import «entry.getBasePackageName()».Event;
 «IF getTimeEvents().size > 0 -»
-import org.yakindu.sct.runtime.java.base.TimeEvent;
+import «entry.getBasePackageName()».TimeEvent;
 «ENDIF-»
-import org.yakindu.sct.runtime.java.base.ITimedStatemachine;
-import org.yakindu.sct.runtime.java.base.ITimerHandler;
-import org.yakindu.sct.runtime.java.base.TimerHandler;
-import org.yakindu.sct.runtime.java.base.notification.EventNotification;
-import org.yakindu.sct.runtime.java.base.notification.Notification;
+import «entry.getBasePackageName()».ITimedStatemachine;
+import «entry.getBasePackageName()».ITimerHandler;
+import «entry.getBasePackageName()».TimerHandler;
+import «entry.getBasePackageName()».EventNotification;
+import «entry.getBasePackageName()».Notification;
 
 public abstract class «getBaseStatemachineName()» implements ITimedStatemachine {
 	
@@ -282,7 +282,7 @@ public abstract class 
 «EXPAND EnterMethodImplement FOREACH this.states-»
 «EXPAND ExitMethodImplement FOREACH this.states-»
 
-	public void runCycle(Collection<?> events) {
+	protected void runCycle(Collection<?> events) {
 		getOutEvents().clear();
 		for (State state : activeStates) {
 			switch (state) {

+ 4 - 4
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomCycleBasedStatemachine.xpt

@@ -17,14 +17,14 @@ Contributors:
 «EXTENSION org::yakindu::sct::generator::java::templates::Expression»
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR ExecutionFlow»
-«FILE getCustomPackage()+getCycleBasedStatemachineName() + '.java'»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow»
+«FILE getImplementationPackagePath(entry)+"/"+getCycleBasedStatemachineName() + '.java'»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.«getStatemachineName().toLowerCase()»;
+package «getImplementationPackageName(entry)»;
 
 import java.util.HashSet;
 
-import org.yakindu.sct.runtime.java.base.Event;
+import «entry.getBasePackageName()».Event;
 
 public class «getCycleBasedStatemachineName()» extends «getBaseStatemachineName()» {
 

+ 4 - 4
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomEventBasedStatemachine.xpt

@@ -17,16 +17,16 @@ Contributors:
 «EXTENSION org::yakindu::sct::generator::java::templates::Expression»
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR ExecutionFlow»
-«FILE getCustomPackage()+getEventBasedStatemachineName()+'.java'-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow»
+«FILE getImplementationPackagePath(entry)+"/"+getEventBasedStatemachineName()+'.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.«getStatemachineName().toLowerCase()»;
+package «getImplementationPackageName(entry)»;
 
 import java.util.Collections;
 import java.util.LinkedList;
 import java.util.Queue;
 
-import org.yakindu.sct.runtime.java.base.Event;
+import «entry.getBasePackageName()».Event;
 
 public class «getEventBasedStatemachineName()» extends «getBaseStatemachineName()» {
 

+ 8 - 12
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterface.xpt

@@ -15,22 +15,18 @@ Contributors:
 
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR InterfaceScope-»
-«FILE getCustomPackage()+getInterfaceName() + '.java'-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR InterfaceScope-»
+«FILE getImplementationPackagePath(entry)+"/"+getInterfaceName() + '.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.«getStatemachineName((ExecutionFlow)eContainer).toLowerCase()»;
+package «getImplementationPackageName(entry)»;
 
-import org.yakindu.sct.runtime.java.base.Event;
 «IF hasOutgoingEvents()-»
-import org.yakindu.sct.runtime.java.base.notification.INotificationSender;
+import «entry.getBasePackageName()».Event;
+import «entry.getBasePackageName()».INotificationSender;
 «ENDIF-»
 
 public interface «getInterfaceName()»«getInterfaceExtension()» {
 	
-	«FOREACH declarations.typeSelect(EventDefinition) AS event-»
-	public static final Event<«event.type.getJavaClassType()»> «event.getName()» = new Event<«event.type.getJavaClassType()»>("«event.name»", «event.getInitialValue()»); 
-	«ENDFOREACH-»
-	
 	«FOREACH declarations.typeSelect(EventDefinition) AS eventDefinition-»
 	«IF  eventDefinition.direction ==  Direction::IN-»
 	public void raise«eventDefinition.name.toFirstUpper()»();
@@ -39,9 +35,9 @@ public interface 
 		«ENDIF-»
 	«ELSEIF eventDefinition.direction ==  Direction::OUT-»
 	public boolean isRaised«eventDefinition.name.toFirstUpper()»();
-		«IF eventDefinition.type != Type::void-»
-	public «eventDefinition.type.getJavaType()» get«eventDefinition.getValueName().toFirstUpper()»();
-		«ENDIF-»
+		
+	public Event<«eventDefinition.type.getJavaClassType()»> get«eventDefinition.getName()»();
+	
 	«ENDIF-»
 	«ENDFOREACH-»
 	

+ 15 - 8
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterfaceImpl.xpt

@@ -16,18 +16,25 @@ Contributors:
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 «EXTENSION org::yakindu::sct::generator::java::templates::Expression»
 
-«DEFINE file FOR InterfaceScope»
-«FILE getCustomPackage()+getInterfaceImplName() + '.java'-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR InterfaceScope»
+«FILE getImplementationPackagePath(entry)+"/"+getInterfaceImplName() + '.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.«getStatemachineName((ExecutionFlow)eContainer).toLowerCase()»;
+package «getImplementationPackageName(entry)»;
 
-import org.yakindu.sct.runtime.java.base.notification.EventNotification;
+import «entry.getBasePackageName()».EventNotification;
+«IF hasEvents()-»
+import «entry.getBasePackageName()».Event;
+«ENDIF-»
 «IF hasOutgoingEvents()-»
-import org.yakindu.sct.runtime.java.base.notification.NotificationSender;
+import «entry.getBasePackageName()».NotificationSender;
 «ENDIF-»
 
 public class «getInterfaceImplName()»«getInterfaceImplExtension()» implements «getInterfaceName()» {
 	
+	«FOREACH declarations.typeSelect(EventDefinition) AS event-»
+	private final Event<«event.type.getJavaClassType()»> «event.getName()» = new Event<«event.type.getJavaClassType()»>("«event.name»", «event.getInitialValue()»); 
+	«ENDFOREACH-»
+	
 	private «getBaseStatemachineName()» statemachine; 
 	
 	public «getInterfaceImplName()»(«getBaseStatemachineName()» statemachine) {
@@ -52,12 +59,12 @@ public class 
 		notifyListeners(new EventNotification(«event.getName()»));
 		«ENDIF-»
 	}
+	«ENDIF-»
 	
-	public «event.type.getJavaType()» get«event.getValueName().toFirstUpper()»() {
-		return «event.getName()».getValue();
+	public Event<«event.type.getJavaClassType()»> get«event.getName()»() {
+		return «event.getName()»;
 	}
 	
-	«ENDIF-»
 	«IF event.direction ==  Direction::OUT-»
 	public boolean isRaised«event.name.toFirstUpper()»() {
 		return statemachine.getOutEvents().contains(«event.getName()»);

+ 3 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Event.xpt

@@ -15,11 +15,11 @@ Contributors:
 
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR ExecutionFlow-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
 «IF name != null-»
-«FILE 'org/yakindu/sct/runtime/java/base/Event.java'-»
+«FILE entry.getBasePackagePath()+'/Event.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.base;
+package «entry.getBasePackageName()»;
 
 public class Event<DataType> {
 	

+ 4 - 4
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/EventNotification.xpt

@@ -15,13 +15,13 @@ Contributors:
 
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR ExecutionFlow-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
 «IF name != null-»
-«FILE 'org/yakindu/sct/runtime/java/base/notification/EventNotification.java'-»
+«FILE entry.getBasePackagePath()+'/EventNotification.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.base.notification;
+package «entry.getBasePackageName()»;
 
-import org.yakindu.sct.runtime.java.base.Event;
+import «entry.getBasePackageName()».Event;
 
 public class EventNotification extends Notification<Event<?>> {
 

+ 1 - 1
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Expression.ext

@@ -86,7 +86,7 @@ String toCode(NumericalMultiplyDivideExpression expression) :
 
 String toCode(ElementReferenceExpression exp) :
     if (EventDefinition.isInstance(exp.value)) then
-    	"getOccuredEvents().contains("+((EventDefinition)exp.value).getContext()+((EventDefinition)exp.value).getName()+")"
+    	"getOccuredEvents().contains("+((EventDefinition)exp.value).getContext().toFirstLower()+"get"+((EventDefinition)exp.value).getName()+"())"
     else if (VariableDefinition.isInstance(exp.value)) then
     	getContext((VariableDefinition)exp.value)+"getVar"+exp.value.name.toFirstUpper()+"()"
     else if (TimeEvent.isInstance(exp.value)) then

+ 3 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/INotificationListener.xpt

@@ -15,11 +15,11 @@ Contributors:
 
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR ExecutionFlow-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
 «IF name != null-»
-«FILE 'org/yakindu/sct/runtime/java/base/notification/INotificationListener.java'-»
+«FILE entry.getBasePackagePath()+'/INotificationListener.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.base.notification;
+package «entry.getBasePackageName()»;
 
 public interface INotificationListener {
 	

+ 3 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/INotificationSender.xpt

@@ -15,11 +15,11 @@ Contributors:
 
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR ExecutionFlow-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
 «IF name != null-»
-«FILE 'org/yakindu/sct/runtime/java/base/notification/INotificationSender.java'-»
+«FILE entry.getBasePackagePath()+'/INotificationSender.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.base.notification;
+package «entry.getBasePackageName()»;
 
 public interface INotificationSender {
 	

+ 3 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/IStatemachine.xpt

@@ -15,10 +15,10 @@ Contributors:
 «IMPORT sgraph»
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR ExecutionFlow-»
-«FILE 'org/yakindu/sct/runtime/java/base/IStatemachine.java'-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
+«FILE entry.getBasePackagePath()+'/IStatemachine.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.base;
+package «entry.getBasePackageName()»;
 
 public interface IStatemachine {
 	

+ 4 - 4
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimedStatemachine.xpt

@@ -14,12 +14,12 @@ Contributors:
 «IMPORT sgraph»
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR ExecutionFlow-»
-«FILE 'org/yakindu/sct/runtime/java/base/ITimedStatemachine.java'-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
+«FILE entry.getBasePackagePath()+'/ITimedStatemachine.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.base;
+package «entry.getBasePackageName()»;
 
-import org.yakindu.sct.runtime.java.base.notification.INotificationListener;
+import «entry.getBasePackageName()».INotificationListener;
 
 public interface ITimedStatemachine extends
 		IStatemachine, INotificationListener {

+ 3 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimerHandler.xpt

@@ -15,10 +15,10 @@ Contributors:
 
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR ExecutionFlow-»
-«FILE 'org/yakindu/sct/runtime/java/base/ITimerHandler.java'-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
+«FILE entry.getBasePackagePath()+'/ITimerHandler.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.base;
+package «entry.getBasePackageName()»;
 
 public interface ITimerHandler {
 	

+ 18 - 21
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Main.xpt

@@ -17,46 +17,43 @@ Contributors:
 «IMPORT org::yakindu::sct::generator::java::templates»
 
 «DEFINE main(sgen::GeneratorEntry entry) FOR ExecutionFlow»
-	«FILE 'test.test'»
-	«entry.getFeatureConfiguration("NamingFeature")»
-	«ENDFILE»
-	«REM» basis files «ENDREM»
 	
-	«EXPAND IStatemachine::file FOR this»
+	«REM» base package files «ENDREM»
+	«EXPAND IStatemachine::file(entry) FOR this»
 	
-	«EXPAND ITimedStatemachine::file FOR this»
+	«EXPAND ITimedStatemachine::file(entry) FOR this»
 	
-	«EXPAND ITimerHandler::file FOR this»
+	«EXPAND ITimerHandler::file(entry) FOR this»
 	
-	«EXPAND TimerHandler::file FOR this»
+	«EXPAND TimerHandler::file(entry) FOR this»
 	
-	«EXPAND Event::file FOR this»
+	«EXPAND Event::file(entry) FOR this»
 	
-	«EXPAND TimeEvent::file FOR this»
+	«EXPAND TimeEvent::file(entry) FOR this»
 	
-	«EXPAND EventNotification::file FOR this»
+	«EXPAND EventNotification::file(entry) FOR this»
 	
-	«EXPAND INotificationListener::file FOR this»
+	«EXPAND INotificationListener::file(entry) FOR this»
 	
-	«EXPAND INotificationSender::file FOR this»
+	«EXPAND INotificationSender::file(entry) FOR this»
 	
-	«EXPAND Notification::file FOR this»
+	«EXPAND Notification::file(entry) FOR this»
 	
-	«EXPAND NotificationSender::file FOR this»
+	«EXPAND NotificationSender::file(entry) FOR this»
 	
-	«EXPAND NotificationType::file FOR this»
+	«EXPAND NotificationType::file(entry) FOR this»
 	
 	«REM» concrete files «ENDREM»
 	«FOREACH this.scopes.typeSelect(InterfaceScope) AS scope»
-	«EXPAND CustomInterface::file FOR scope»
-	«EXPAND CustomInterfaceImpl::file FOR scope»
+	«EXPAND CustomInterface::file(entry) FOR scope»
+	«EXPAND CustomInterfaceImpl::file(entry) FOR scope»
 	«ENDFOREACH»
 	
-	«EXPAND CustomBaseStatemachine::file FOR this»
+	«EXPAND CustomBaseStatemachine::file(entry) FOR this»
 	
-	«EXPAND CustomCycleBasedStatemachine::file FOR this»
+	«EXPAND CustomCycleBasedStatemachine::file(entry) FOR this»
 	
-	«EXPAND CustomEventBasedStatemachine::file FOR this»
+	«EXPAND CustomEventBasedStatemachine::file(entry) FOR this»
 	
 
 «ENDDEFINE»

+ 43 - 14
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Naming.ext

@@ -14,6 +14,8 @@ import stext;
 import sexec;
 import ecore;
 import sgraph;
+import sgen;
+
 extension org::yakindu::sct::generator::java::templates::Expression;
 
 List declaredVariables(ExecutionFlow flow) : flow.scopes.declarations.typeSelect(VariableDefinition);
@@ -25,19 +27,6 @@ getInterfaceScopeEvents(ExecutionFlow this) : getInterfaceScopeDeclarations().ty
 getInterfaceScopeVoidEvents(ExecutionFlow this) : getInterfaceScopeEvents().select(e|e.type==Type::void);
 getInterfaceScopeValuedEvents(ExecutionFlow this) : getInterfaceScopeEvents().select(e|e.type!=Type::void);
 
-//getNamedInterfaceScope(ExecutionFlow this) : scopes.typeSelect(InterfaceScope).select(interfaceScope|interfaceScope.name!=null);
-//getNamedInterfaceScopeDeclarations(ExecutionFlow this) : getNamedInterfaceScope().declarations;
-//getNamedInterfaceScopeVariables(ExecutionFlow this) : getNamedInterfaceScopeDeclarations().typeSelect(VariableDefinition);
-//getNamedInterfaceScopeEvents(ExecutionFlow this) : getNamedInterfaceScopeDeclarations().typeSelect(EventDefinition);
-//getNamedInterfaceScopeVoidEvents(ExecutionFlow this) : getNamedInterfaceScopeEvents().select(e|e.type==Type::void);
-//getNamedInterfaceScopeValuedEvents(ExecutionFlow this) : getNamedInterfaceScopeEvents().select(e|e.type!=Type::void);
-
-//getUnnamedInterfaceScopeDeclarations(ExecutionFlow this) : scopes.typeSelect(InterfaceScope).select(interfaceScope|interfaceScope.name==null).declarations;	
-//getUnnamedInterfaceScopeVariables(ExecutionFlow this) : getUnnamedInterfaceScopeDeclarations().typeSelect(VariableDefinition);
-//getUnnamedInterfaceScopeEvents(ExecutionFlow this) : getUnnamedInterfaceScopeDeclarations().typeSelect(EventDefinition);	
-//getUnnamedInterfaceScopeVoidEvents(ExecutionFlow this) : getUnnamedInterfaceScopeEvents().select(e|e.type==Type::void);
-//getUnnamedInterfaceScopeValuedEvents(ExecutionFlow this) : getUnnamedInterfaceScopeEvents().select(e|e.type!=Type::void);
-
 getInternalScopeDeclarations(ExecutionFlow this) : scopes.typeSelect(InternalScope).declarations;
 getInternalScopeVariables(ExecutionFlow this) :	getInternalScopeDeclarations().typeSelect(VariableDefinition);
 getInternalScopeEvents(ExecutionFlow this) : getInternalScopeDeclarations().typeSelect(EventDefinition);
@@ -71,7 +60,15 @@ String getInitialValue(EventDefinition this) :
 	if derivation != null then
 		derivation.condition.toCode()
 	else
-		"null";
+		//if no initial value expression is declared set default value to avoid npe exceptions
+		switch (type) {
+		case (Type::real) : "0D"
+		case (Type::integer) : "0"
+		case (Type::boolean) : "false"
+		case (Type::string) : ""
+		case (Type::void) : "null"
+		default : ""
+		};
 
 String getInitialValueAssignment(EventDefinition this) :
 	if derivation != null then
@@ -175,6 +172,9 @@ String getContext(Event this) :
 boolean hasOutgoingEvents(InterfaceScope this) :
 	!declarations.typeSelect(EventDefinition).select(event|event.direction == Direction::OUT).isEmpty;
 	
+boolean hasEvents(InterfaceScope this) :
+	!declarations.typeSelect(EventDefinition).isEmpty;
+	
 String getInterfaceExtension(InterfaceScope this):
 	if (hasOutgoingEvents()) then
 		" extends INotificationSender"
@@ -187,6 +187,35 @@ String getInterfaceImplExtension(InterfaceScope this):
 	else
 		null;
 		
+String getBasePackageName(GeneratorEntry entry):
+	if entry.getFeatureConfiguration("NamingFeature")!=null 
+		&& entry.getFeatureConfiguration("NamingFeature").getParameterValue("basePackage")!=null then
+		entry.getFeatureConfiguration("NamingFeature").getParameterValue("basePackage").value
+	else
+		"org.yakindu.sct.runtime.java";
+
+String getBasePackagePath(GeneratorEntry entry):
+	entry.getBasePackageName().replaceAll("\\.","/");
+	
+String getImplementationSuffix(GeneratorEntry entry, ExecutionFlow flow):
+	if entry.getFeatureConfiguration("NamingFeature")!=null
+		&& entry.getFeatureConfiguration("NamingFeature").getParameterValue("implementationSuffix") != null then
+		entry.getFeatureConfiguration("NamingFeature").getParameterValue("implementationSuffix").value
+	else 
+		flow.getStatemachineName();
+
+String getImplementationPackagePath(ExecutionFlow this, GeneratorEntry entry):
+	entry.getBasePackagePath()+"/"+entry.getImplementationSuffix(this).toLowerCase();
+
+String getImplementationPackagePath(InterfaceScope this, GeneratorEntry entry):
+	((ExecutionFlow)eContainer).getImplementationPackagePath(entry);
+
+String getImplementationPackageName(ExecutionFlow this, GeneratorEntry entry):
+	entry.getBasePackageName()+"."+entry.getImplementationSuffix(this).toLowerCase();
+
+String getImplementationPackageName(InterfaceScope this, GeneratorEntry entry):
+	((ExecutionFlow)eContainer).getImplementationPackageName(entry);
+	
 String getLicenseHeader() : "/**
  * Copyright (c) 2011 committers of YAKINDU and others.
  * All rights reserved. This program and the accompanying materials

+ 3 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Notification.xpt

@@ -15,11 +15,11 @@ Contributors:
 
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR ExecutionFlow-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
 «IF name != null-»
-«FILE 'org/yakindu/sct/runtime/java/base/notification/Notification.java'-»
+«FILE entry.getBasePackagePath()+'/Notification.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.base.notification;
+package «entry.getBasePackageName()»;
 
 public class Notification<Element> {
 	

+ 3 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/NotificationSender.xpt

@@ -15,11 +15,11 @@ Contributors:
 
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR ExecutionFlow-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
 «IF name != null-»
-«FILE 'org/yakindu/sct/runtime/java/base/notification/NotificationSender.java'-»
+«FILE entry.getBasePackagePath()+'/NotificationSender.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.base.notification;
+package «entry.getBasePackageName()»;
 
 import java.util.HashSet;
 import java.util.Set;

+ 3 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/NotificationType.xpt

@@ -15,11 +15,11 @@ Contributors:
 
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR ExecutionFlow-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
 «IF name != null-»
-«FILE 'org/yakindu/sct/runtime/java/base/notification/NotificationType.java'-»
+«FILE entry.getBasePackagePath()+'/NotificationType.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.base.notification;
+package «entry.getBasePackageName()»;
 
 public enum NotificationType {
 	EventNotification,

+ 3 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/TimeEvent.xpt

@@ -15,11 +15,11 @@ Contributors:
 
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR ExecutionFlow-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
 «IF name != null-»
-«FILE 'org/yakindu/sct/runtime/java/base/TimeEvent.java'-»
+«FILE entry.getBasePackagePath()+'/TimeEvent.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.base;
+package «entry.getBasePackageName()»;
 
 public class TimeEvent extends Event<Boolean> {
 	

+ 4 - 4
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/TimerHandler.xpt

@@ -15,17 +15,17 @@ Contributors:
 
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file FOR ExecutionFlow-»
-«FILE 'org/yakindu/sct/runtime/java/base/TimerHandler.java'-»
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
+«FILE entry.getBasePackagePath()+'/TimerHandler.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.base;
+package «entry.getBasePackageName()»;
 
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Timer;
 import java.util.TimerTask;
 
-import org.yakindu.sct.runtime.java.base.notification.EventNotification;
+import «entry.getBasePackageName()».EventNotification;
 
 public class TimerHandler implements ITimerHandler {