Просмотр исходного кода

Added API for notification.
Refactoring of templates to support notification mechanism.

markus.muehlbrandt@itemis.de 14 лет назад
Родитель
Сommit
130bb0a8c9
19 измененных файлов с 517 добавлено и 215 удалено
  1. 48 84
      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. 9 7
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomEventBasedStatemachine.xpt
  4. 10 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterface.xpt
  5. 22 18
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterfaceImpl.xpt
  6. 22 15
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Event.xpt
  7. 35 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/EventNotification.xpt
  8. 13 7
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Expression.ext
  9. 31 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/INotificationListener.xpt
  10. 32 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/INotificationSender.xpt
  11. 8 7
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimedStatemachine.xpt
  12. 3 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimerHandler.xpt
  13. 14 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Main.xpt
  14. 93 57
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Naming.ext
  15. 45 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Notification.xpt
  16. 47 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/NotificationSender.xpt
  17. 29 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/NotificationType.xpt
  18. 40 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/TimeEvent.xpt
  19. 12 10
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/TimerHandler.xpt

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

@@ -64,7 +64,7 @@ true
 «ENDDEFINE»
 
 «DEFINE ActionCode FOR Reaction-»
-«EXPAND ActionCode FOR this.effect-» 
+	«EXPAND ActionCode FOR this.effect-» 
 «ENDDEFINE»
 
 «DEFINE ActionCode FOR If-»
@@ -109,7 +109,7 @@ else {
 «ENDDEFINE»
 
 «DEFINE CycleCode FOR Cycle-» 
-«EXPAND ActionCode FOREACH this.steps-»
+	«EXPAND ActionCode FOREACH this.steps-»
 «ENDDEFINE»
 
 «DEFINE CycleMethodsImplement FOR ExecutionState-»
@@ -151,53 +151,54 @@ package org.yakindu.sct.runtime.java.
 
 import java.util.Collection;
 import java.util.EnumSet;
+import java.util.HashSet;
 import java.util.Set;
 
-import org.yakindu.sct.runtime.java.base.DataType;
-import org.yakindu.sct.runtime.java.base.IStatemachine;
-
-public class «getBaseStatemachineName()» implements ITimedStatemachine<Event> {
+import org.yakindu.sct.runtime.java.base.Event;
+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;
 
+public abstract class «getBaseStatemachineName()» implements ITimedStatemachine<Event> {
+	
+	«FOREACH getInternalScopeEvents() AS event-»
+	private static final Event<«event.type.getJavaClassType()»> «event.getName()» = new Event<«event.type.getJavaClassType()»>("«event.name»", «event.getInitialValue()»); 
+	«ENDFOREACH-»
+	
 	public enum State {
 		«FOREACH states AS state-»
 	      «state.getName()»,
 	    «ENDFOREACH-»
 	};
 	
-	«FOREACH getNamedInterfaceScope() AS interface-»
+	«FOREACH scopes.typeSelect(InterfaceScope) AS interface-»
 	private «interface.getInterfaceImplName()» «interface.getInterfaceName().toFirstLower()»
 	«ENDFOREACH-»
-	
-	«REM»unnamed interface valued events«ENDREM»
-	«FOREACH getUnnamedInterfaceScopeEvents() AS event-»
-	private «event.type.getJavaType()» «event.getValueName()»;
-	«ENDFOREACH-»
-	«REM»unnamed interface variables«ENDREM»
-	«FOREACH getUnnamedInterfaceScopeVariables() AS variable-»
-	private «variable.type.getJavaType()» «variable.getValueName()»;
-	«ENDFOREACH-»
-	«REM»internal scope valued events«ENDREM»
+	«REM»internal scope valued events
 	«FOREACH getInternalScopeValuedEvents() AS event-»
-  	private «event.type.getJavaType()» «event.getValueName()»;
-	«ENDFOREACH-»
+  	private «event.type.getJavaType()» «event.getValueName()»«event.getInitialValueAssignment()»;
+	«ENDFOREACH-»«ENDREM»
 	«REM»internal variables«ENDREM»
 	«FOREACH getInternalScopeVariables() AS variable-»
-	private «variable.type.getJavaType()» «variable.getValueName()»;
+	private «variable.type.getJavaType()» «variable.getValueName()»«variable.getInitialValueAssignment()»;
+	
 	«ENDFOREACH-»
 
 	private final Set<State> activeStates = EnumSet.noneOf(State.class);
 	
-	private Collection<Event> occuredEvents;
+	private final Collection<Event<?>> occuredEvents;
 	
-	private Collection<Event> outEvents;
+	private final Collection<Event<?>> outEvents;
 	
-	private ITimerHandler<Event> timerHandler;
+	private ITimerHandler timerHandler;
 	
-	public «getBaseStatemachineName()»(Collection<Event> occuredEvents, Collection<Event> outEvents) {
+	public «getBaseStatemachineName()»(Collection<Event<?>> occuredEvents) {
 		this.occuredEvents = occuredEvents;
-		this.outEvents = outEvents;
-		«FOREACH getNamedInterfaceScope() AS interface-»
-		«interface.getInterfaceName().toFirstLower()» = new  «interface.getInterfaceImplName()»(occuredEvents, outEvents);
+		this.outEvents = new HashSet<Event<?>>();
+		«FOREACH getInterfaceScope() AS interface-»
+		«interface.getInterfaceName().toFirstLower()» = new «interface.getInterfaceImplName()»(this);
 		«ENDFOREACH-»
 	}
 	
@@ -219,86 +220,49 @@ public class 
 	public void init() {
 		
 	}
-	
-	@Override
-	public void raiseTimeEvent(Event timeEvent) {
-		getOccuredEvents().add(timeEvent);
-	}
 
 	@Override
-	public void setTimerHandler(ITimerHandler<Event> timerHandler) {
+	public void setTimerHandler(ITimerHandler timerHandler) {
 		this.timerHandler = timerHandler;
 	}
 
 	@Override
-	public ITimerHandler<Event> getTimerHandler() {
+	public ITimerHandler getTimerHandler() {
 		if (timerHandler == null) {
 			timerHandler = new TimerHandler<Event>(this);
 		}
 		return timerHandler;
 	}
 	
-	«FOREACH getNamedInterfaceScope() AS interface-»
-	public «interface.getInterfaceName()» get«interface.getInterfaceName()» {
-		return «interface.getInterfaceName().toFirstLower()»;
+	@Override
+	public void notify(Notification<?> notification) {
+		if (notification instanceof EventNotification) {
+			EventNotification eventNotification = (EventNotification) notification;
+			getOccuredEvents().add(eventNotification.getElement());
+		}
 	}
-	«ENDFOREACH-»
 	
-	«REM»Generate raise and isRaised... Methods for Interface Scopes«ENDREM»
-	«FOREACH getUnnamedInterfaceScopeEvents() AS event-»
-	«IF event.direction == Direction::OUT-»
-	public boolean isRaised«event.getInternalName()»() {
-		return getOutEvents().contains(Event.«event.getInternalName()»);
-	}
-	private void raise«event.getInternalName()»(){
-		getOccuredEvents().add(Event.«event.getInternalName()»);
-		getOutEvents().add(Event.«event.getInternalName()»);
-	}
-	«ELSE-»
-	private boolean isRaised«event.getInternalName()»() {
-		return getOccuredEvents().contains(Event.«event.getInternalName()»);
+	«FOREACH scopes.typeSelect(InterfaceScope) AS interface-»
+	public «interface.getInterfaceName()» get«interface.getInterfaceName()» {
+		return «interface.getInterfaceName().toFirstLower()»;
 	}
 	
-	public void raise«event.getInternalName().toFirstUpper()»(){
-		getOccuredEvents().add(Event.«event.getInternalName()»);
-	}
-	«ENDIF-»
 	«ENDFOREACH-»
 	«FOREACH getInternalScopeEvents() AS event-»
-	private boolean isRaised«event.getInternalName()»() {
-		return getOccuredEvents().contains(Event.«event.getInternalName()»);
+	private void raise«event.name.toFirstUpper()»() {
+		statemachine.getOccuredEvents().add(«event.getName()»);
 	}
 	
-	private void raise«event.getInternalName()»(){
-		getOccuredEvents().add(Event.«event.getInternalName()»);
-	}
-	«ENDFOREACH-»
-	«REM»Generate getters and setters for valued events and variables«ENDREM»
-	«FOREACH getUnnamedInterfaceScopeValuedEvents() AS event-»
-	«event.getterVisibility()» «event.type.getJavaType()» get«event.getValueName().toFirstUpper()»(){
-		return «event.getValueName()»;
+	«IF event.type != Type::void-»
+	private void raise«event.name.toFirstUpper()»(«event.type.getJavaType()» value) {
+		«event.getName()».setValue(value);
+		statemachine.getOccuredEvents().add(«event.getName()»);
 	}
 	
-	«event.setterVisibility()» void set«event.getValueName().toFirstUpper()»(«event.type.getJavaType()» value) {
-		«event.getValueName()» = value;
-	}
-	«ENDFOREACH-»
-	«FOREACH getUnnamedInterfaceScopeVariables() AS variable-»
-	public «variable.type.getJavaType()» get«variable.getValueName().toFirstUpper()»(){
-		return «variable.getValueName()»;
-	}
-	«variable.setterValueVisibility()» void set«variable.getValueName().toFirstUpper()»(«variable.type.getJavaType()» value) {
-		«variable.getValueName()» = value;
-	}
-	«ENDFOREACH-»
-	«FOREACH getInternalScopeValuedEvents() AS event-»
-	private «event.type.getJavaType()» get«event.getValueName().toFirstUpper()»(){
-		return «event.getValueName()»;
-	}
-	
-	private void set«event.getValueName().toFirstUpper()»(«event.type.getJavaType()» value) {
-		«event.getValueName()» = value;
+	private «event.type.getJavaType()» get«event.getValueName().toFirstUpper()»() {
+		return «event.getName()».getValue();
 	}
+	«ENDIF-»
 	«ENDFOREACH-»
 
 «EXPAND ConditionMethodsImplement FOREACH this.states-»

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

@@ -22,14 +22,14 @@ Contributors:
 «getLicenseHeader()»
 package org.yakindu.sct.runtime.java.«getStatemachineName()»;
 
-import java.util.Collection;
-import java.util.EnumSet;
-import java.util.Set;
+import java.util.HashSet;
+
+import org.yakindu.sct.runtime.java.base.Event;
 
 public class «getCycleBasedStatemachineName()» extends «getBaseStatemachineName()» {
 
 	public CustomCycleBasedStatemachine() {
-		super(EnumSet.noneOf(Event.class), EnumSet.noneOf(Event.class));
+		super(new HashSet<Event<?>>());
 	}
 
 	public void runCycle() {

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

@@ -22,25 +22,27 @@ Contributors:
 «getLicenseHeader()»
 package org.yakindu.sct.runtime.java.«getStatemachineName()»;
 
-import java.util.Collection;
-import java.util.EnumSet;
-import java.util.Set;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.Queue;
+
+import org.yakindu.sct.runtime.java.base.Event;
 
 public class «getEventBasedStatemachineName()» extends «getBaseStatemachineName()» {
 
 	public CustomEventBasedStatemachine() {
-		super(new LinkedList<Event>(), EnumSet.noneOf(Event.class));
+		super(new LinkedList<Event<?>>());
 	}
 	
 	@Override
-	protected Queue<Event> getOccuredEvents() {
-		return (Queue<Event>) super.getOccuredEvents();
+	protected Queue<Event<?>> getOccuredEvents() {
+		return (Queue<Event<?>>) super.getOccuredEvents();
 	}
 	
 	@Override
 	public void runCycle() {
 		if (eventOccured()) {
-			Event event = getOccuredEvents().poll();
+			Event<?> event = getOccuredEvents().poll();
 			runCycle(Collections.singletonList(event));
 		}
 	}

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

@@ -16,12 +16,20 @@ Contributors:
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
 «DEFINE file FOR InterfaceScope-»
-«IF name != null-»
 «FILE getInterfaceName() + '.java'-»
 «getLicenseHeader()»
 package org.yakindu.sct.runtime.java.«getStatemachineName((ExecutionFlow)eContainer)»;
 
-public interface «getInterfaceName()» {
+import org.yakindu.sct.runtime.java.base.Event;
+«IF hasOutgoingEvents()-»
+import org.yakindu.sct.runtime.java.base.notification.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-»
@@ -45,5 +53,4 @@ public interface 
 	«ENDFOREACH-»
 }
 «ENDFILE-»
-«ENDIF-»
 «ENDDEFINE»

+ 22 - 18
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterfaceImpl.xpt

@@ -14,14 +14,19 @@ Contributors:
 «IMPORT sgraph»
 
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
+«EXTENSION org::yakindu::sct::generator::java::templates::Expression»
 
 «DEFINE file FOR InterfaceScope»
-«IF name != null-»
 «FILE getInterfaceImplName() + '.java'-»
 «getLicenseHeader()»
 package org.yakindu.sct.runtime.java.«getStatemachineName((ExecutionFlow)eContainer)»;
 
-public abstract class «getInterfaceImplName()» implements «getInterfaceName()» {
+import org.yakindu.sct.runtime.java.base.notification.EventNotification;
+«IF hasOutgoingEvents()-»
+import org.yakindu.sct.runtime.java.base.notification.NotificationSender;
+«ENDIF-»
+
+public abstract class «getInterfaceImplName()»«getInterfaceImplExtension()» implements «getInterfaceName()» {
 	
 	private «getBaseStatemachineName()» statemachine; 
 	
@@ -30,38 +35,38 @@ public abstract class 
 	}
 	
 	«FOREACH declarations.typeSelect(EventDefinition) AS event-»
-	«IF event.type != Type::void-»
-	private «event.type.getJavaType()» «event.getValueName()»
-	
-	public «event.type.getJavaType()» get«event.getValueName().toFirstUpper()»() {
-		return «event.getValueName()»;
-	} 
-	«ENDIF-»
 	public void raise«event.name.toFirstUpper()»() {
-		statemachine.getOccuredEvents().add(Event.«event.getQualifiedName()»);
+		statemachine.getOccuredEvents().add(«event.getName()»);
 		«IF event.direction ==  Direction::OUT-»
-		statemachine.getOutEvents().add(Event.«event.getQualifiedName()»);
+		statemachine.getOutEvents().add(«event.getName()»);
+		notifyListeners(new EventNotification(«event.getName()»));
 		«ENDIF-»
 	}
+	
 	«IF event.type != Type::void-»
 	public void raise«event.name.toFirstUpper()»(«event.type.getJavaType()» value) {
-		«event.getValueName()» = value;
-		statemachine.getOccuredEvents().add(Event.«event.getQualifiedName()»);
+		«event.getName()».setValue(value);
+		statemachine.getOccuredEvents().add(«event.getName()»);
 		«IF event.direction ==  Direction::OUT-»
-		statemachine.getOutEvents().add(Event.«event.getQualifiedName()»);
+		statemachine.getOutEvents().add(«event.getName()»);
+		notifyListeners(new EventNotification(«event.getName()»));
 		«ENDIF-»
 	}
-	«ENDIF-»
 	
+	public «event.type.getJavaType()» get«event.getValueName().toFirstUpper()»() {
+		return «event.getName()».getValue();
+	}
+	
+	«ENDIF-»
 	«IF event.direction ==  Direction::OUT-»
 	public boolean isRaised«event.name.toFirstUpper()»() {
-		return statemachine.getOutEvents().contains(Event.«event.getQualifiedName()»);
+		return statemachine.getOutEvents().contains(«event.getName()»);
 	}
 	«ENDIF-»
 	«ENDFOREACH-»
 	
 	«FOREACH declarations.typeSelect(VariableDefinition) AS variable-»
-	private «variable.type.getJavaType()» «variable.getValueName()»
+	private «variable.type.getJavaType()» «variable.getValueName()»«variable.getInitialValueAssignment()»;
 	
 	public «variable.type.getJavaType()» get«variable.getValueName().toFirstUpper()»() {
 		return «variable.getValueName()»;
@@ -73,5 +78,4 @@ public abstract class 
 	«ENDFOREACH-»
 }
 «ENDFILE-»
-«ENDIF-»
 «ENDDEFINE»

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

@@ -19,22 +19,29 @@ Contributors:
 «IF name != null-»
 «FILE 'Event.java'-»
 «getLicenseHeader()»
-package org.yakindu.sct.runtime.java.«getStatemachineName()»;
+package org.yakindu.sct.runtime.java.base;
 
-public enum Event {
-	public enum Event {
-		«FOREACH getNamedInterfaceScopeEvents() AS event-»
-  		«event.getQualifiedName()»,
-		«ENDFOREACH-»
-		«FOREACH getUnnamedInterfaceScopeEvents() AS event-»
-		«event.getInternalName()»,
-		«ENDFOREACH-»
-		«FOREACH getInternalScopeEvents() AS event-»
-  		«event.getInternalName()»,
-		«ENDFOREACH-»
-		«FOREACH getTimeEvents() AS timeEvent-»
-		«timeEvent.getName()»,
-		«ENDFOREACH»
+public class Event<DataType> {
+	
+	private DataType value;
+	
+	private String name;
+	
+	public Event(String name, DataType value) {
+		this.name = name;
+		this.value = value;
+	}
+	
+	public String getName() {
+		return name;
+	}
+
+	public DataType getValue() {
+		return value;
+	}
+	
+	public void setValue(DataType value) {
+		this.value = value;
 	}
 }
 «ENDFILE-»

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

@@ -0,0 +1,35 @@
+«REM»
+Copyright (c) 2011 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
+ 	
+@author Markus Muehlbrandt - Initial contribution and API
+«ENDREM»
+«IMPORT sexec»
+«IMPORT stext»
+«IMPORT sgraph»
+
+«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
+
+«DEFINE file FOR ExecutionFlow-»
+«IF name != null-»
+«FILE 'EventNotification.java'-»
+«getLicenseHeader()»
+package org.yakindu.sct.runtime.java.base.notification;
+
+import org.yakindu.sct.runtime.java.base.Event;
+
+public class EventNotification extends Notification<Event<?>> {
+
+	public EventNotification(Event<?> element) {
+		super(NotificationType.EventNotification, element);
+	}
+
+}
+«ENDFILE-»
+«ENDIF-»
+«ENDDEFINE»

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

@@ -17,7 +17,7 @@ import sgraph;
 
 extension org::yakindu::sct::generator::java::templates::Naming;
 
-toCode(Void void) :
+String toCode(Void void) :
 	"/*toCode() called with NULL element. Polymorphic resolver could not match callable method!*/";
 String toCode(Void o, String statechartReference) : 
 	""; //polymorphic placeholder (abstract rule)
@@ -31,11 +31,11 @@ String toCode(Statement statement) :
 String toCode(PrimitiveValueExpression primValue) :
 	primValue.value;
 	
-getterCall(Assignment this) :
-	getContext(varRef)+"getVar"+ varRef.name.toFirstUpper()+ "()";
+String getterCall(Assignment this) :
+	getContext(varRef).toFirstLower()+"getVar"+ varRef.name.toFirstUpper()+ "()";
 	
-setterCall(Assignment this, String textCorpus) :
-	getContext(varRef)+"setVar" + varRef.name.toFirstUpper() + "(" + textCorpus + ");";
+String setterCall(Assignment this, String expression) :
+	getContext(varRef).toFirstLower()+"setVar" + varRef.name.toFirstUpper() + "(" + expression + ");";
 
 /* Assignment */
 String toCode(Assignment this) :
@@ -86,11 +86,11 @@ String toCode(NumericalMultiplyDivideExpression expression) :
 
 String toCode(ElementReferenceExpression exp) :
     if (EventDefinition.isInstance(exp.value)) then
-    	"events.contains(Event."+((EventDefinition)exp.value).getName()+")"
+    	"getOccuredEvents.contains("+((EventDefinition)exp.value).getContext()+((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
-    	"events.contains(Event."+getName((TimeEvent)exp.value)+")";
+    	"getOccuredEvents.contains(Event."+getName((TimeEvent)exp.value)+")";
 
 String getOperator(AdditiveOperator operator) : 
     switch(operator) {
@@ -117,3 +117,9 @@ String getOperator(RelationalOperator operator) :
 	  case (RelationalOperator::notEquals) : " != "
 	  default : ""
 	};
+	
+String toCode(EventRaising this) :
+	if this.value != null then
+		event.getContext().toFirstLower()+".raise"+event.name.toFirstUpper()+"("+value.toCode()+");"
+	else
+		event.getContext().toFirstLower()+".raise"+event.name.toFirstUpper()+"();";

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

@@ -0,0 +1,31 @@
+«REM»
+Copyright (c) 2011 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
+ 	
+@author Markus Muehlbrandt - Initial contribution and API
+«ENDREM»
+«IMPORT sexec»
+«IMPORT stext»
+«IMPORT sgraph»
+
+«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
+
+«DEFINE file FOR ExecutionFlow-»
+«IF name != null-»
+«FILE 'INotificationListener.java'-»
+«getLicenseHeader()»
+package org.yakindu.sct.runtime.java.base.notification;
+
+public interface INotificationListener {
+	
+	public void notify(Notification<?> notification);
+	
+}
+«ENDFILE-»
+«ENDIF-»
+«ENDDEFINE»

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

@@ -0,0 +1,32 @@
+«REM»
+Copyright (c) 2011 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
+ 	
+@author Markus Muehlbrandt - Initial contribution and API
+«ENDREM»
+«IMPORT sexec»
+«IMPORT stext»
+«IMPORT sgraph»
+
+«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
+
+«DEFINE file FOR ExecutionFlow-»
+«IF name != null-»
+«FILE 'INotificationSender.java'-»
+«getLicenseHeader()»
+package org.yakindu.sct.runtime.java.base.notification;
+
+public interface INotificationSender {
+	
+	public boolean addNotificationListener(INotificationListener listener);
+	
+	public boolean removeNotificationListener(INotificationListener listener);
+}
+«ENDFILE-»
+«ENDIF-»
+«ENDDEFINE»

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

@@ -19,13 +19,14 @@ Contributors:
 «getLicenseHeader()»
 package org.yakindu.sct.runtime.java.base;
 
-public interface ITimedStatemachine<TimeEventType> extends IStatemachine {
-	
-	public void raiseTimeEvent(TimeEventType timeEvent);
-	
-	public void setTimerHandler(ITimerHandler<TimeEventType> timerHandler);
-	
-	public ITimerHandler<TimeEventType> getTimerHandler();
+import org.yakindu.sct.runtime.java.base.notification.INotificationListener;
+
+public interface ITimedStatemachine extends
+		IStatemachine, INotificationListener {
+
+	public void setTimerHandler(ITimerHandler timerHandler);
+
+	public ITimerHandler getTimerHandler();
 }
 «ENDFILE-»
 «ENDDEFINE»

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

@@ -20,11 +20,11 @@ Contributors:
 «getLicenseHeader()»
 package org.yakindu.sct.runtime.java.base;
 
-public interface ITimerHandler<TimeEventType> {
+public interface ITimerHandler {
 	
-	public void setTimer(TimeEventType event, long time, boolean periodic);
+	public void setTimer(TimeEvent event);
 	
-	public void resetTimer(TimeEventType event);
+	public void resetTimer(TimeEvent event);
 }
 «ENDFILE-»
 «ENDDEFINE»

+ 14 - 0
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Main.xpt

@@ -29,6 +29,20 @@ Contributors:
 	
 	«EXPAND Event::file FOR this»
 	
+	«EXPAND TimeEvent::file FOR this»
+	
+	«EXPAND EventNotification::file FOR this»
+	
+	«EXPAND INotificationListener::file FOR this»
+	
+	«EXPAND INotificationSender::file FOR this»
+	
+	«EXPAND Notification::file FOR this»
+	
+	«EXPAND NotificationSender::file FOR this»
+	
+	«EXPAND NotificationType::file FOR this»
+	
 	«REM» concrete files «ENDREM»
 	«FOREACH this.scopes.typeSelect(InterfaceScope) AS scope»
 	«EXPAND CustomInterface::file FOR scope»

+ 93 - 57
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Naming.ext

@@ -14,71 +14,83 @@ import stext;
 import sexec;
 import ecore;
 import sgraph;
+extension org::yakindu::sct::generator::java::templates::Expression;
 
 List declaredVariables(ExecutionFlow flow) : flow.scopes.declarations.typeSelect(VariableDefinition);
 
-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);
-	
-getInternalScopeVoidEvents(ExecutionFlow this) :
-	getInternalScopeEvents().select(e|e.type==Type::void);
-	
-getInternalScopeValuedEvents(ExecutionFlow this) :
-	getInternalScopeEvents().select(e|e.type!=Type::void);
-
+getInterfaceScope(ExecutionFlow this) : scopes.typeSelect(InterfaceScope);
+getInterfaceScopeDeclarations(ExecutionFlow this) : getInterfaceScope().declarations;
+getInterfaceScopeVariables(ExecutionFlow this) : getInterfaceScopeDeclarations().typeSelect(VariableDefinition);
+getInterfaceScopeEvents(ExecutionFlow this) : getInterfaceScopeDeclarations().typeSelect(EventDefinition);
+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);
+getInternalScopeVoidEvents(ExecutionFlow this) :getInternalScopeEvents().select(e|e.type==Type::void);
+getInternalScopeValuedEvents(ExecutionFlow this) : getInternalScopeEvents().select(e|e.type!=Type::void);
 getTimeEvents(ExecutionFlow this) : scopes.typeSelect(Scope).declarations.typeSelect(TimeEvent);
 
 String getStatemachineName(ExecutionFlow this) : name.toFirstUpper();
-String getBaseStatemachineName(ExecutionFlow this) : name.toFirstUpper() + "BaseStatemachine";
+String getBaseStatemachineName(ExecutionFlow this) : name.toFirstUpper() + "AbstractBaseStatemachine";
 String getEventBasedStatemachineName(ExecutionFlow this) : name.toFirstUpper() + "EventBasedStatemachine";
 String getCycleBasedStatemachineName(ExecutionFlow this) : name.toFirstUpper() + "CyleBasedStatemachine";
 
-String getInterfaceName(InterfaceScope this) :  "Interface" + name.toFirstUpper(); 
+String getInterfaceName(InterfaceScope this) :  
+	if name!=null then
+		"Interface" + name.toFirstUpper()
+	else
+		"InterfaceDefault";
+		 
 String getInterfaceImplName(InterfaceScope this) :  getInterfaceName() + "Impl";
 String getBaseStatemachineName(InterfaceScope this) : ((ExecutionFlow)eContainer).getBaseStatemachineName();
 
-String getQualifiedName(EventDefinition this) : ((InterfaceScope)eContainer).name.toFirstUpper()+name.toFirstUpper();
+String getQualifiedName(EventDefinition this) : getContext() + name.toFirstUpper();
+		
 String getValueName(EventDefinition this) : "eventValue"+name.toFirstUpper();
 String getInternalName(EventDefinition this) : name.toFirstUpper();
 
+String getInitialValue(EventDefinition this) :
+	if derivation != null then
+		derivation.condition.toCode()
+	else
+		"null";
+
+String getInitialValueAssignment(EventDefinition this) :
+	if derivation != null then
+		" = " + derivation.condition.toCode()
+	else
+		null;
+		
+String getInitialValueAssignment(VariableDefinition this) : 
+	if initialValue != null then
+		" = " + initialValue
+	else
+		null;
+
 String getValueName(VariableDefinition this) : "var"+name.toFirstUpper();
 
-getName(ExecutionState this) :
+String getName(ExecutionState this) :
 	simpleName.replaceAll(" ","").toFirstUpper();
 
-getName(Event this) :
-	getContext() + name.toFirstUpper();
+String getName(Event this) :
+	"Event"+name.toFirstUpper();
 
-getName(TimeEvent this) :
+String getName(TimeEvent this) :
 	name.replaceAll(" ","").toFirstUpper();
 
 String getterVisibility(EventDefinition this) : 
@@ -108,6 +120,16 @@ String getJavaType(Type type) :
 		default : ""
 		};
 
+String getJavaClassType(Type type) :
+		switch (type) {
+		case (Type::real) : "Float"
+		case (Type::integer) : "Integer"
+		case (Type::boolean) : "Boolean"
+		case (Type::string) : "String"
+		case (Type::void) : "Void"
+		default : ""
+		};
+
 cached String functionName(Step step) : 
 	(step.isEffect()) ? step.actionFunctionName() : (
 	(step.isReactionCheck()) ? step.checkFunctionName() : (
@@ -115,16 +137,16 @@ cached String functionName(Step step) :
 	(step.isExitAction()) ? step.exitActionFunctionName() : 
 	" !! unknown function type !!" )));
  
-statemachineEntryFunctionName(EnterState this):
+String statemachineEntryFunctionName(EnterState this):
 	if (this.name != null) then
 		"entry"+name.toFirstUpper().replaceAll(" ","")+"()"
 	else
 		"entry()";
 
-actionFunctionName(Step this) : "actions" + getName(reaction().state()) + this.reaction().name.toFirstUpper(); 
-checkFunctionName(Step this) : "condition" + getName(reaction().state()) + this.reaction().name.toFirstUpper(); 
-entryActionFunctionName(Step this) : "entryActions" + getName(state()); 
-exitActionFunctionName(Step this) : "exitActions" + getName(state()); 
+String actionFunctionName(Step this) : "actions" + getName(reaction().state()) + this.reaction().name.toFirstUpper(); 
+String checkFunctionName(Step this) : "condition" + getName(reaction().state()) + this.reaction().name.toFirstUpper(); 
+String entryActionFunctionName(Step this) : "entryActions" + getName(state()); 
+String exitActionFunctionName(Step this) : "exitActions" + getName(state()); 
 
 isEffect(Step step) : (! Check.isInstance(step)) && Reaction.isInstance(step.eContainer) ;
 isReactionCheck(Step step) : Reaction.isInstance(step.eContainer) && Check.isInstance(step);
@@ -136,19 +158,33 @@ ExecutionState state(Reaction this) : (ExecutionState) eContainer;
 ExecutionState state(Step this) : (ExecutionState) eContainer;
 
 String getContext(Variable this) : 
-	if (InterfaceScope.isInstance(eContainer) && ((InterfaceScope)eContainer).name != null) then  
-		"interface"+((InterfaceScope)eContainer).name.toFirstUpper()+"."
-	
+	if (InterfaceScope.isInstance(eContainer)) then  
+		getInterfaceName((InterfaceScope)eContainer)+"."
 	else 
 		"";
 		
-getContext(Event this) : 
-	if (InterfaceScope.isInstance(eContainer) && ((InterfaceScope)eContainer).name != null) then  
-		((InterfaceScope)eContainer).name.toFirstUpper()
+String getContext(Event this) : 
+	if (InterfaceScope.isInstance(eContainer)) then  
+		getInterfaceName((InterfaceScope)eContainer).toFirstUpper()+"."
 	else 
 		"";
 		
-getLicenseHeader() : "/**
+boolean hasOutgoingEvents(InterfaceScope this) :
+	!declarations.typeSelect(EventDefinition).select(event|event.direction == Direction::OUT).isEmpty;
+	
+String getInterfaceExtension(InterfaceScope this):
+	if (hasOutgoingEvents()) then
+		" extends INotificationSender"
+	else
+		null;
+		
+String getInterfaceImplExtension(InterfaceScope this):
+	if (hasOutgoingEvents()) then
+		" extends NotificationSender"
+	else
+		null;
+		
+String getLicenseHeader() : "/**
  * Copyright (c) 2011 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

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

@@ -0,0 +1,45 @@
+«REM»
+Copyright (c) 2011 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
+ 	
+@author Markus Muehlbrandt - Initial contribution and API
+«ENDREM»
+«IMPORT sexec»
+«IMPORT stext»
+«IMPORT sgraph»
+
+«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
+
+«DEFINE file FOR ExecutionFlow-»
+«IF name != null-»
+«FILE 'Notification.java'-»
+«getLicenseHeader()»
+package org.yakindu.sct.runtime.java.base.notification;
+
+public class Notification<Element> {
+	
+	private NotificationType notificationType;
+	
+	private Element element;
+
+	public Notification(NotificationType notificationType, Element element) {
+		this.notificationType = notificationType;
+		this.element = element;
+	}
+	
+	public NotificationType getNotificationType() {
+		return notificationType;
+	}
+
+	public Element getElement() {
+		return element;
+	}
+}
+«ENDFILE-»
+«ENDIF-»
+«ENDDEFINE»

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

@@ -0,0 +1,47 @@
+«REM»
+Copyright (c) 2011 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
+ 	
+@author Markus Muehlbrandt - Initial contribution and API
+«ENDREM»
+«IMPORT sexec»
+«IMPORT stext»
+«IMPORT sgraph»
+
+«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
+
+«DEFINE file FOR ExecutionFlow-»
+«IF name != null-»
+«FILE 'NotificationSender.java'-»
+«getLicenseHeader()»
+package org.yakindu.sct.runtime.java.base.notification;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class NotificationSender implements INotificationSender {
+
+	private Set<INotificationListener> listeners = new HashSet<INotificationListener>();
+	
+	public boolean addNotificationListener(INotificationListener listener) {
+		return listeners.add(listener);
+	}
+	
+	public boolean removeNotificationListener(INotificationListener listener) {
+		return listeners.remove(listener);
+	}
+	
+	protected void notifyListeners(Notification<?> notification) {
+		for (INotificationListener listener : listeners) {
+			listener.notify(notification);
+		}
+	}
+}
+«ENDFILE-»
+«ENDIF-»
+«ENDDEFINE»

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

@@ -0,0 +1,29 @@
+«REM»
+Copyright (c) 2011 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
+ 	
+@author Markus Muehlbrandt - Initial contribution and API
+«ENDREM»
+«IMPORT sexec»
+«IMPORT stext»
+«IMPORT sgraph»
+
+«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
+
+«DEFINE file FOR ExecutionFlow-»
+«IF name != null-»
+«FILE 'NotificationType.java'-»
+«getLicenseHeader()»
+package org.yakindu.sct.runtime.java.base.notification;
+
+public enum NotificationType {
+	EventNotification,
+}
+«ENDFILE-»
+«ENDIF-»
+«ENDDEFINE»

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

@@ -0,0 +1,40 @@
+«REM»
+Copyright (c) 2011 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
+ 	
+@author Markus Muehlbrandt - Initial contribution and API
+«ENDREM»
+«IMPORT sexec»
+«IMPORT stext»
+«IMPORT sgraph»
+
+«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
+
+«DEFINE file FOR ExecutionFlow-»
+«IF name != null-»
+«FILE 'TimeEvent.java'-»
+«getLicenseHeader()»
+package org.yakindu.sct.runtime.java.base;
+
+public class TimeEvent extends Event<Long> {
+	
+	private boolean periodic;
+	
+	public TimeEvent(String name, Long timeValue, boolean periodic) {
+		super(name, timeValue);
+		this.periodic = periodic;
+	}
+	
+	public boolean isPeriodic(){
+		return periodic;
+	}
+}
+
+«ENDFILE-»
+«ENDIF-»
+«ENDDEFINE»

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

@@ -25,20 +25,22 @@ import java.util.Map;
 import java.util.Timer;
 import java.util.TimerTask;
 
-public class TimerHandler<TimeEventType> implements ITimerHandler<TimeEventType> {
+import org.yakindu.sct.runtime.java.base.notification.EventNotification;
 
-	private final ITimedStatemachine<TimeEventType> statemachine;
+public class TimerHandler implements ITimerHandler {
+
+	private final ITimedStatemachine statemachine;
 
 	private final Timer timer = new Timer();
 
-	private final Map<TimeEventType, TimerTask> timerTaskMap = new HashMap<TimeEventType, TimerTask>();;
+	private final Map<TimeEvent, TimerTask> timerTaskMap = new HashMap<TimeEvent, TimerTask>();;
 
-	public TimerHandler(ITimedStatemachine<TimeEventType> statemachine) {
+	public TimerHandler(ITimedStatemachine statemachine) {
 		this.statemachine = statemachine;
 	}
 
 	@Override
-	public void setTimer(final TimeEventType event, long time, boolean periodic) {
+	public void setTimer(final TimeEvent event) {
 		// Reset existing TimerTask for event. This step isn't necessary if
 		// timer tasks are properly reset by sexec model.
 		if (timerTaskMap.containsKey(event)) {
@@ -49,22 +51,22 @@ public class TimerHandler<TimeEventType> implements ITimerHandler<TimeEventType>
 		timerTaskMap.put(event, new TimerTask() {
 			@Override
 			public void run() {
-				statemachine.raiseTimeEvent(event);
+				statemachine.notify(new EventNotification(event));
 			}
 		});
 		
 		//start scheduling the timer.
-		if (periodic) {
-			timer.scheduleAtFixedRate(timerTaskMap.get(event),time, time);
+		if (event.isPeriodic()) {
+			timer.scheduleAtFixedRate(timerTaskMap.get(event),event.getValue(), event.getValue());
 		}
 		else {
-			timer.schedule(timerTaskMap.get(event), time);
+			timer.schedule(timerTaskMap.get(event), event.getValue());
 		}
 
 	}
 
 	@Override
-	public void resetTimer(TimeEventType event) {
+	public void resetTimer(TimeEvent event) {
 		if (timerTaskMap.containsKey(event) && timerTaskMap.get(event) != null) {
 			timerTaskMap.get(event).cancel();
 			timer.purge();