Support for timed events (both in state machines and activities)

Change-Id: I2eddbe43303a52e8e27b52736155e8dff61617ad
Signed-off-by: jeremie.tatibouet <jeremie.tatibouet@cea.fr>
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/.classpath b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/.classpath
new file mode 100644
index 0000000..b862a29
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>

+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>

+	<classpathentry kind="src" path="src"/>

+	<classpathentry kind="output" path="bin"/>

+</classpath>

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/.project b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/.project
new file mode 100644
index 0000000..5c01366
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>org.eclipse.papyrus.moka.timedfuml.interfaces</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.m2e.core.maven2Builder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.m2e.core.maven2Nature</nature>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/META-INF/MANIFEST.MF b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..181f920
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Timed fUML Interfaces
+Bundle-SymbolicName: org.eclipse.papyrus.moka.timedfuml.interfaces
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: Eclipse Modeling Project
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.papyrus.moka.fuml.statemachines.interfaces;bundle-version="2.0.0";visibility:=reexport
+Export-Package: org.eclipse.papyrus.moka.timedfuml.interfaces.semantics.CommonBehaviors
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/build.properties b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/build.properties
new file mode 100644
index 0000000..41eb6ad
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/build.properties
@@ -0,0 +1,4 @@
+source.. = src/

+output.. = bin/

+bin.includes = META-INF/,\

+               .

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/pom.xml b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/pom.xml
new file mode 100644
index 0000000..6d6bd3b
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/pom.xml
@@ -0,0 +1,17 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

+  <modelVersion>4.0.0</modelVersion>

+ 

+  <!-- Parent POM (i.e., Engines) -->

+  <parent>

+  		<groupId>org.eclipse.papyrus.moka</groupId>

+		<artifactId>org.eclipse.papyrus.moka.bundles.core.engines</artifactId>

+		<version>3.0.0-SNAPSHOT</version>

+  </parent>

+  

+  <!-- POM Description -->

+  <artifactId>org.eclipse.papyrus.moka.timedfuml.interfaces</artifactId>

+  <packaging>eclipse-plugin</packaging>

+  <name>org.eclipse.papyrus.moka.timedfuml.interfaces</name>

+  <version>1.0.0-SNAPSHOT</version>

+  

+</project>
\ No newline at end of file
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/src/org/eclipse/papyrus/moka/timedfuml/interfaces/semantics/CommonBehaviors/ITimedEventOccurrence.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/src/org/eclipse/papyrus/moka/timedfuml/interfaces/semantics/CommonBehaviors/ITimedEventOccurrence.java
new file mode 100644
index 0000000..bf63bb0
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/src/org/eclipse/papyrus/moka/timedfuml/interfaces/semantics/CommonBehaviors/ITimedEventOccurrence.java
@@ -0,0 +1,29 @@
+/*****************************************************************************

+ * Copyright (c) 2017 CEA LIST 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:

+ *   Jeremie Tatibouet (CEA LIST)

+ *   

+ *****************************************************************************/

+

+package org.eclipse.papyrus.moka.timedfuml.interfaces.semantics.CommonBehaviors;

+

+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IRealValue;

+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.IEventOccurrence;

+

+public interface ITimedEventOccurrence extends IEventOccurrence{

+

+	public void setReferenceInstant(double instant);

+	

+	public IRealValue getReferenceInstance();

+	

+	public void setOccurrenceInstant(double instant);

+	

+	public IRealValue getOccurrenceInstant();

+	

+}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/src/org/eclipse/papyrus/moka/timedfuml/interfaces/semantics/CommonBehaviors/ITimedObjectActivation.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/src/org/eclipse/papyrus/moka/timedfuml/interfaces/semantics/CommonBehaviors/ITimedObjectActivation.java
new file mode 100644
index 0000000..363d910
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml.interfaces/src/org/eclipse/papyrus/moka/timedfuml/interfaces/semantics/CommonBehaviors/ITimedObjectActivation.java
@@ -0,0 +1,22 @@
+/*****************************************************************************

+ * Copyright (c) 2017 CEA LIST 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:

+ *   CEA LIST Initial API and implementation

+ *   

+ *****************************************************************************/

+

+package org.eclipse.papyrus.moka.timedfuml.interfaces.semantics.CommonBehaviors;

+

+import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.CommonBehavior.ISM_ObjectActivation;

+

+public interface ITimedObjectActivation extends ISM_ObjectActivation{

+	

+	public void register(ITimedEventOccurrence timedEventOccurrence);

+	

+}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/META-INF/MANIFEST.MF b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/META-INF/MANIFEST.MF
index ae7310d..a102801 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/META-INF/MANIFEST.MF
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/META-INF/MANIFEST.MF
@@ -8,11 +8,16 @@
  org.eclipse.papyrus.moka.discreteevent;bundle-version="3.0.0";visibility:=reexport,
  org.eclipse.papyrus.moka;bundle-version="2.0.100",
  org.eclipse.papyrus.moka.fuml.statemachines;bundle-version="2.0.0";visibility:=reexport,
- org.aspectj.runtime;bundle-version="[1.8.10,2.0.0)"
+ org.aspectj.runtime;bundle-version="[1.8.10,2.0.0)",
+ org.eclipse.uml2.uml,
+ org.eclipse.papyrus.moka.timedfuml.interfaces;bundle-version="1.0.0";visibility:=reexport
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
 Export-Package: org.eclipse.papyrus.moka.timedfuml,
  org.eclipse.papyrus.moka.timedfuml.actions,
  org.eclipse.papyrus.moka.timedfuml.control.queue,
- org.eclipse.papyrus.moka.timedfuml.semantics
+ org.eclipse.papyrus.moka.timedfuml.semantics,
+ org.eclipse.papyrus.moka.timedfuml.semantics.CommonBehaviors,
+ org.eclipse.papyrus.moka.timedfuml.semantics.Loci,
+ org.eclipse.papyrus.moka.timedfuml.semantics.StructuredClassifiers
 Bundle-Vendor: Eclipse Modeling Project
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/TimedUmlExecutionEngine.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/TimedUmlExecutionEngine.java
index f9f88de..27070d8 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/TimedUmlExecutionEngine.java
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/TimedUmlExecutionEngine.java
@@ -18,10 +18,10 @@
 import org.eclipse.papyrus.moka.fuml.control.execution.RootExecution;

 import org.eclipse.papyrus.moka.fuml.control.queue.ExecutionController;

 import org.eclipse.papyrus.moka.fuml.statemachines.StateMachineExecutionEngine;

-import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.Loci.SM_Locus;

 import org.eclipse.papyrus.moka.timedfuml.actions._displayCurrentTimeAction;

 import org.eclipse.papyrus.moka.timedfuml.control.queue.TimedExecutionLoop;

-import org.eclipse.papyrus.moka.timedfuml.semantics.Timed_ExecutionFactory;

+import org.eclipse.papyrus.moka.timedfuml.semantics.Loci.TimedExecutionFactory;

+import org.eclipse.papyrus.moka.timedfuml.semantics.Loci.TimedLocus;

 import org.eclipse.uml2.uml.Behavior;

 

 public class TimedUmlExecutionEngine extends StateMachineExecutionEngine {

@@ -50,9 +50,9 @@
 	

 	@Override

 	public ILocus initializeLocus() {

-		this.locus = new SM_Locus();

+		this.locus = new TimedLocus();

 		locus.setExecutor(new CS_Executor());

-		locus.setFactory(new Timed_ExecutionFactory());

+		locus.setFactory(new TimedExecutionFactory());

 		return this.locus;

 	}

 	

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_acceptAction.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_acceptAction.java
deleted file mode 100644
index 36607ba..0000000
--- a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_acceptAction.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************

- * Copyright (c) 2015 CEA LIST 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:

- *   CEA LIST - Initial API and implementation

- *   

- *****************************************************************************/

-

-package org.eclipse.papyrus.moka.timedfuml.actions;

-

-import org.eclipse.papyrus.moka.discreteevent.actions.Action;

-import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.IObjectActivation;

-

-/**

- * @author ac221913

- *

- */

-public class _acceptAction extends Action {

-

-	protected IObjectActivation objectActivation;

-

-	public _acceptAction(IObjectActivation objectActivation) {

-		super();

-		this.objectActivation = objectActivation;

-	}

-

-	/**

-	 * @see org.eclipse.papyrus.moka.discreteevent.actions.Action#execute()

-	 *

-	 */

-	@Override

-	public void execute() {

-		if (!objectActivation.getWaitingEventAccepters().isEmpty()) {

-			objectActivation._startObjectBehavior();

-		}

-	}

-

-}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_sendAcceptEventOfferAction.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_sendAcceptEventOfferAction.java
deleted file mode 100644
index 9deb9fb..0000000
--- a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_sendAcceptEventOfferAction.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*****************************************************************************

- * Copyright (c) 2016 CEA LIST.

- * 

- * 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:

- *  CEA LIST Initial API and implementation

- *****************************************************************************/

-

-package org.eclipse.papyrus.moka.timedfuml.actions;

-

-import org.eclipse.papyrus.moka.discreteevent.actions.Action;

-import org.eclipse.papyrus.moka.timedfuml.semantics.Timed_AcceptEventActionActivation;

-

-/**

- * @author sg239226

- *

- */

-public class _sendAcceptEventOfferAction extends Action {

-

-	protected Timed_AcceptEventActionActivation actionActivation;

-

-	public _sendAcceptEventOfferAction(Timed_AcceptEventActionActivation actionActivation) {

-		super();

-		this.actionActivation = actionActivation;

-	}

-	

-	@Override

-	public void execute() {

-		this.actionActivation.accept(null);

-	}

-

-}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_sendTimeEventOccurrence.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_sendTimeEventOccurrence.java
new file mode 100644
index 0000000..df1a3f7
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_sendTimeEventOccurrence.java
@@ -0,0 +1,60 @@
+/*****************************************************************************

+ * Copyright (c) 2017 CEA LIST 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:

+ *   CEA LIST Initial API and implementation

+ *   

+ *****************************************************************************/

+

+package org.eclipse.papyrus.moka.timedfuml.actions;

+

+import org.eclipse.papyrus.moka.discreteevent.DEScheduler;

+import org.eclipse.papyrus.moka.discreteevent.actions.Action;

+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IObject_;

+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IReference;

+import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;

+import org.eclipse.papyrus.moka.fuml.Semantics.impl.Classes.Kernel.Reference;

+import org.eclipse.papyrus.moka.timedfuml.semantics.CommonBehaviors.TimedEventOccurrence;

+

+public class _sendTimeEventOccurrence extends Action{

+

+	// Time instant at which the timeout was registered

+	protected double referenceInstant;

+	

+	// Target to which a time event is sent

+	protected IObject_ target;

+	

+	// Visitor that implied the timer setup

+	protected ISemanticVisitor visitor;

+	

+	public _sendTimeEventOccurrence(double referenceInstant, ISemanticVisitor visitor,  IObject_ target) {

+		this.referenceInstant = referenceInstant;

+		this.visitor = visitor;

+		this.target = target;

+	}

+	

+	public ISemanticVisitor getVisitor() {

+		return this.visitor;

+	}

+	

+	

+	@Override

+	public void execute() {

+		// Register a time event occurrence to the target object. This

+		// enables the target object classifier behavior to react (if possible)

+		// to the fact that clock time has evolved.

+		TimedEventOccurrence eventOccurrence = new TimedEventOccurrence();

+		eventOccurrence.setReferenceInstant(this.referenceInstant);

+		eventOccurrence.setOccurrenceInstant(DEScheduler.getInstance().getCurrentTime());

+		IReference targetReference = new Reference();

+		targetReference.setReferent(this.target);

+		eventOccurrence.setTarget(targetReference);

+		eventOccurrence.register();

+	}

+

+}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_send_Action.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_send_Action.java
deleted file mode 100644
index 9c33944..0000000
--- a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_send_Action.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************

- * Copyright (c) 2015 CEA LIST 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:

- *   CEA LIST - Initial API and implementation

- *   

- *****************************************************************************/

-

-package org.eclipse.papyrus.moka.timedfuml.actions;

-

-import org.eclipse.papyrus.moka.discreteevent.actions.Action;

-import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.IObjectActivation;

-

-/**

- * @author ac221913

- *

- */

-public class _send_Action extends Action {

-

-	protected IObjectActivation objectActivation;

-

-	public _send_Action(IObjectActivation objectActivation) {

-		super();

-		this.objectActivation = objectActivation;

-	}

-

-	/**

-	 * @see org.eclipse.papyrus.moka.discreteevent.actions.Action#execute()

-	 *

-	 */

-	@Override

-	public void execute() {

-		if (!objectActivation.getWaitingEventAccepters().isEmpty()) {

-			objectActivation._startObjectBehavior();

-		}

-	}

-

-}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_startObjectBehavior_Action.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_startObjectBehavior_Action.java
deleted file mode 100644
index bedf6e9..0000000
--- a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/actions/_startObjectBehavior_Action.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*****************************************************************************

- * Copyright (c) 2015 CEA LIST 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:

- *   CEA LIST - Initial API and implementation

- *   

- *****************************************************************************/

-

-package org.eclipse.papyrus.moka.timedfuml.actions;

-

-import org.eclipse.papyrus.moka.discreteevent.actions.Action;

-import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.IClassifierBehaviorExecution;

-

-/**

- * @author ac221913

- *

- */

-public class _startObjectBehavior_Action extends Action {

-

-	protected IClassifierBehaviorExecution classifierBehaviorExecution;

-

-	public _startObjectBehavior_Action(IClassifierBehaviorExecution execution) {

-		super();

-		this.classifierBehaviorExecution = execution;

-	}

-

-	/**

-	 * @see org.eclipse.papyrus.moka.discreteevent.actions.Action#execute()

-	 *

-	 */

-	@Override

-	public void execute() {

-		this.classifierBehaviorExecution.getExecution().execute();

-	}

-

-}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Actions/CompleteActions/TimedAcceptEventActionActivation.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Actions/CompleteActions/TimedAcceptEventActionActivation.java
new file mode 100644
index 0000000..bb7ee1a
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Actions/CompleteActions/TimedAcceptEventActionActivation.java
@@ -0,0 +1,51 @@
+/*****************************************************************************

+ * Copyright (c) 2016 CEA LIST.

+ * 

+ * 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:

+ * 	Sahar Guermazi

+ * 	Jeremie Tatibouet (CEA LIST)

+ *  CEA LIST Initial API and implementation

+ *  

+ *****************************************************************************/

+package org.eclipse.papyrus.moka.timedfuml.semantics.Actions.CompleteActions;

+

+import java.util.List;

+

+import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IToken;

+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.IEventOccurrence;

+import org.eclipse.papyrus.moka.fuml.Semantics.impl.Actions.CompleteActions.AcceptEventActionActivation;

+import org.eclipse.papyrus.moka.timedfuml.utils.DESchedulerUtils;

+import org.eclipse.uml2.uml.AcceptEventAction;

+

+public class TimedAcceptEventActionActivation extends AcceptEventActionActivation {

+

+	@Override

+	public void fire(List<IToken> incomingTokens) {

+		// Behaves like in fUML. Then install timers corresponding

+		// to expected time events to the clock (i.e., the DEScheduler).

+		super.fire(incomingTokens);

+		DESchedulerUtils.pushEvents(((AcceptEventAction) this.getNode()).getTriggers(), this, this.getExecutionContext());

+	}

+	

+	@Override

+	public void accept(IEventOccurrence eventOccurrence) {

+		// Cancel remaining timers installed by this visitor (if any)

+		// Behaves like in fUML.

+		DESchedulerUtils.cancelEvents(this);

+		super.accept(eventOccurrence);

+	}

+	

+	@Override

+	public void terminate() {

+		// Behaves like fUML. Cancel remaining timers installed by this

+		// visitor (if any)

+		super.terminate();

+		DESchedulerUtils.cancelEvents(this);

+	}

+

+}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/CommonBehaviors/TimedEventOccurrence.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/CommonBehaviors/TimedEventOccurrence.java
new file mode 100644
index 0000000..30c228d
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/CommonBehaviors/TimedEventOccurrence.java
@@ -0,0 +1,150 @@
+/*****************************************************************************

+ * Copyright (c) 2017 CEA LIST 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:

+ *   CEA LIST Initial API and implementation

+ *   

+ *****************************************************************************/

+

+package org.eclipse.papyrus.moka.timedfuml.semantics.CommonBehaviors;

+

+import java.util.ArrayList;

+import java.util.List;

+

+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IEvaluation;

+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IRealValue;

+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IReference;

+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IValue;

+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.IParameterValue;

+import org.eclipse.papyrus.moka.fuml.Semantics.impl.Classes.Kernel.RealValue;

+import org.eclipse.papyrus.moka.fuml.Semantics.impl.CommonBehaviors.BasicBehaviors.ParameterValue;

+import org.eclipse.papyrus.moka.fuml.Semantics.impl.CommonBehaviors.Communications.EventOccurrence;

+import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.Values.ISM_OpaqueExpressionEvaluation;

+import org.eclipse.papyrus.moka.timedfuml.interfaces.semantics.CommonBehaviors.ITimedEventOccurrence;

+import org.eclipse.papyrus.moka.timedfuml.interfaces.semantics.CommonBehaviors.ITimedObjectActivation;

+import org.eclipse.uml2.uml.TimeEvent;

+import org.eclipse.uml2.uml.Trigger;

+

+public class TimedEventOccurrence extends EventOccurrence implements ITimedEventOccurrence {

+

+	// Time at which the clock accounted for the future

+	// time event occurrence

+	public IRealValue referenceInstant;

+

+	// Instant of time at which this event occurrence

+	// was generated

+	public IRealValue occurrenceInstant;

+

+	@Override

+	public boolean match(Trigger trigger) {

+		// Define the rule to match this event occurrence against a trigger

+		// This event occurrence matches if the following condition hold:

+		// 1] If the trigger is for a TimeEvent

+		// 2] If the time expression can be evaluated

+		// 3] If the occurrence instant (i.e., the time at which this occurrence

+		// occurred) matches the time at which the model element referencing the

+		// trigger was expected to fire. Note that the triggering time can either

+		// relative or absolute.

+		boolean matches = false;

+		if (trigger.getEvent() instanceof TimeEvent) {

+			TimeEvent timeEvent = (TimeEvent) trigger.getEvent();

+			if (timeEvent.getWhen() != null && timeEvent.getWhen().getExpr() != null) {

+				IEvaluation evaluation = this.target.getReferent().getLocus().getFactory()

+						.createEvaluation(timeEvent.getWhen().getExpr());

+				if (evaluation != null) {

+					if (evaluation instanceof ISM_OpaqueExpressionEvaluation) {

+						((ISM_OpaqueExpressionEvaluation) evaluation).setContext(this.target.getReferent());

+					}

+					IRealValue evaluatedInstant = (IRealValue) evaluation.evaluate();

+					if (timeEvent.isRelative()) {

+						matches = this.referenceInstant.getValue()

+								+ evaluatedInstant.getValue() == this.occurrenceInstant.getValue();

+					} else {

+						matches = this.occurrenceInstant.equals(evaluatedInstant);

+					}

+				}

+			}

+		}

+		return matches;

+	}

+

+	@Override

+	public List<IParameterValue> getParameterValues() {

+		// Return a single parameter value. This latter provides the time

+		// at which this event occurrence occurred.

+		List<IParameterValue> parameterValues = new ArrayList<IParameterValue>();

+		IParameterValue parameterValue = new ParameterValue();

+		List<IValue> values = new ArrayList<IValue>();

+		values.add(this.occurrenceInstant);

+		parameterValue.setValues(values);

+		parameterValues.add(parameterValue);

+		return parameterValues;

+	}

+

+	@Override

+	public void sendTo(IReference target) {

+		// Do nothing - the timed event is not sent to a target.

+		// It is registered by an external clock into the event pool

+		// of the active object.

+	}

+

+	@Override

+	public void doSend() {

+		// Do nothing - the timed event is not sent to a target.

+		// It is registered by an external clock into the event pool

+		// of the active object.

+	}

+

+	@Override

+	public void _startObjectBehavior() {

+		// Do nothing - the classifier behavior of that object is empty

+	}

+

+	public void register() {

+		// Register this time event occurrence in the event

+		// pool of the target object.

+		ITimedObjectActivation objectActivation = (ITimedObjectActivation) this.target.getReferent()

+				.getObjectActivation();

+		if(objectActivation != null) {

+			objectActivation.register(this);

+		}

+	}

+

+	@Override

+	public void setReferenceInstant(double instant) {

+		// Set the reference time at which the production of this

+		// event occurrence was scheduled

+		if (this.referenceInstant == null) {

+			this.referenceInstant = new RealValue();

+		}

+		this.referenceInstant.setValue(instant);

+	}

+

+	@Override

+	public IRealValue getReferenceInstance() {

+		// Return the reference time (can be null)

+		return this.referenceInstant;

+	}

+

+	@Override

+	public void setOccurrenceInstant(double instant) {

+		// Set the time at which this event occurrence actually

+		// occurred.

+		if (this.occurrenceInstant == null) {

+			this.occurrenceInstant = new RealValue();

+		}

+		this.occurrenceInstant.setValue(instant);

+	}

+

+	@Override

+	public IRealValue getOccurrenceInstant() {

+		// Return the time at which the occurrence occurred (can be null).

+		return this.occurrenceInstant;

+	}

+

+}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/CommonBehaviors/TimedObjectActivation.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/CommonBehaviors/TimedObjectActivation.java
new file mode 100644
index 0000000..d31008c
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/CommonBehaviors/TimedObjectActivation.java
@@ -0,0 +1,30 @@
+/*****************************************************************************

+ * Copyright (c) 2017 CEA LIST 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:

+ *   CEA LIST Initial API and implementation

+ *   

+ *****************************************************************************/

+

+package org.eclipse.papyrus.moka.timedfuml.semantics.CommonBehaviors;

+

+import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.CommonBehavior.SM_ObjectActivation;

+import org.eclipse.papyrus.moka.timedfuml.interfaces.semantics.CommonBehaviors.ITimedEventOccurrence;

+import org.eclipse.papyrus.moka.timedfuml.interfaces.semantics.CommonBehaviors.ITimedObjectActivation;

+

+public class TimedObjectActivation extends SM_ObjectActivation implements ITimedObjectActivation{

+

+	@Override

+	public void register(ITimedEventOccurrence timedEventOccurrence) {

+		// Add the timed event occurrence at the end of the event pool.

+		// Notify that that a new event occurrence was placed in the event pool.

+		this.eventPool.add(timedEventOccurrence);

+		this.notifyEventArrival();

+	}

+

+}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Loci/TimedExecutionFactory.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Loci/TimedExecutionFactory.java
new file mode 100644
index 0000000..13998ad
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Loci/TimedExecutionFactory.java
@@ -0,0 +1,53 @@
+/*****************************************************************************

+ * Copyright (c) 2016 CEA LIST.

+ * 

+ * 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:

+ * 	Sahar Guermazi

+ *  CEA LIST Initial API and implementation

+ *  

+ *****************************************************************************/

+package org.eclipse.papyrus.moka.timedfuml.semantics.Loci;

+

+import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;

+import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.Loci.SM_ExecutionFactory;

+import org.eclipse.papyrus.moka.timedfuml.semantics.Timed_OpaqueActionActivation;

+import org.eclipse.papyrus.moka.timedfuml.semantics.Timed_SendSignalActionActivation;

+import org.eclipse.papyrus.moka.timedfuml.semantics.Actions.CompleteActions.TimedAcceptEventActionActivation;

+import org.eclipse.papyrus.moka.timedfuml.semantics.StateMachines.TimedStateMachineExecution;

+import org.eclipse.papyrus.moka.timedfuml.utils.DESchedulerUtils;

+import org.eclipse.uml2.uml.AcceptCallAction;

+import org.eclipse.uml2.uml.AcceptEventAction;

+import org.eclipse.uml2.uml.Element;

+import org.eclipse.uml2.uml.OpaqueAction;

+import org.eclipse.uml2.uml.SendSignalAction;

+import org.eclipse.uml2.uml.StateMachine;

+

+public class TimedExecutionFactory extends SM_ExecutionFactory {

+

+	@Override

+	public ISemanticVisitor instantiateVisitor(Element element) {

+		// Extends fUML semantics in the sense that newly introduced

+		// semantic visitors are instantiated instead of fUML visitors

+		ISemanticVisitor visitor = null;

+		if (element instanceof AcceptEventAction 

+				&& !(element instanceof AcceptCallAction)

+				&& DESchedulerUtils.isTimeTriggered(((AcceptEventAction)element).getTriggers())) {

+			visitor = new TimedAcceptEventActionActivation();

+		} else if (element instanceof OpaqueAction) {

+			visitor = new Timed_OpaqueActionActivation();

+		} else if (element instanceof SendSignalAction) {

+			visitor = new Timed_SendSignalActionActivation();

+		} else if(element instanceof StateMachine){

+			visitor = new TimedStateMachineExecution();

+		} else {

+			visitor = super.instantiateVisitor(element);

+		}

+		return visitor;

+	}

+

+}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Loci/TimedLocus.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Loci/TimedLocus.java
new file mode 100644
index 0000000..6be678d
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Loci/TimedLocus.java
@@ -0,0 +1,40 @@
+/*****************************************************************************

+ * Copyright (c) 2017 CEA LIST.

+ *

+ *

+ * 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:

+ *  CEA LIST Initial API and implementation

+ *

+ *****************************************************************************/

+

+package org.eclipse.papyrus.moka.timedfuml.semantics.Loci;

+

+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IObject_;

+import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.Loci.SM_Locus;

+import org.eclipse.papyrus.moka.timedfuml.semantics.StructuredClassifiers.TimedObject;

+import org.eclipse.uml2.uml.Behavior;

+import org.eclipse.uml2.uml.Class;

+

+public class TimedLocus extends SM_Locus {

+

+	public IObject_ instantiate(Class type) {

+		// Behaves like in fUML except that type instance are not

+		// Object_ but TimedObject.

+		IObject_ object = null;

+		if (type instanceof Behavior) {

+			object = super.instantiate(type);

+		} else {

+			object = new TimedObject();

+			object.addType(type);

+			object.createFeatureValues();

+			this.add(object);

+		}

+		return object;

+	}

+	

+}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/OpaqueExpressionEvaluationWithContext.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/OpaqueExpressionEvaluationWithContext.java
deleted file mode 100644
index 810a917..0000000
--- a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/OpaqueExpressionEvaluationWithContext.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*****************************************************************************

- * Copyright (c) 2016 CEA LIST.

- * 

- * 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:

- *  CEA LIST Initial API and implementation

- *****************************************************************************/

-package org.eclipse.papyrus.moka.timedfuml.semantics;

-

-import java.util.ArrayList;

-import java.util.List;

-

-import org.eclipse.papyrus.moka.composites.Semantics.impl.Classes.Kernel.CS_OpaqueExpressionEvaluation;

-import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IObject_;

-import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IValue;

-import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.IParameterValue;

-import org.eclipse.uml2.uml.Behavior;

-import org.eclipse.uml2.uml.OpaqueExpression;

-

-public class OpaqueExpressionEvaluationWithContext extends CS_OpaqueExpressionEvaluation {

-

-	public IObject_ context;

-

-	@Override

-	public List<IValue> executeExpressionBehavior() {

-		// If a behavior is associated with the context OpaqueExpression,

-		// then execute this behavior, and return computed values.

-		// Otherwise, return an empty list of values.

-		List<IValue> evaluation = new ArrayList<IValue>();

-		OpaqueExpression expression = (OpaqueExpression) this.specification;

-		Behavior behavior = expression.getBehavior();

-		if (behavior != null) {

-			List<IParameterValue> inputs = new ArrayList<IParameterValue>();

-			List<IParameterValue> results = this.locus.getExecutor().execute(behavior, context, inputs);

-			for (int i = 0; i < results.size(); i++) { // results.size should be 1

-				IParameterValue parameterValue = results.get(i);

-				List<IValue> values = parameterValue.getValues();

-				for (int j = 0; j < values.size(); j++) {

-					evaluation.add(values.get(j));

-				}

-			}

-		}

-		return evaluation;

-	}

-}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/StateMachines/TimedStateMachineConfiguration.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/StateMachines/TimedStateMachineConfiguration.java
new file mode 100644
index 0000000..4237bda
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/StateMachines/TimedStateMachineConfiguration.java
@@ -0,0 +1,59 @@
+/*****************************************************************************

+ * Copyright (c) 2017 CEA LIST 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:

+ *   CEA LIST Initial API and implementation

+ *   

+ *****************************************************************************/

+package org.eclipse.papyrus.moka.timedfuml.semantics.StateMachines;

+

+import java.util.List;

+

+import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.StateMachines.StateMachineConfiguration;

+import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.IStateActivation;

+import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.IStateMachineExecution;

+import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.ITransitionActivation;

+import org.eclipse.papyrus.moka.timedfuml.utils.DESchedulerUtils;

+import org.eclipse.uml2.uml.Transition;

+

+public class TimedStateMachineConfiguration extends StateMachineConfiguration {

+

+	public TimedStateMachineConfiguration(IStateMachineExecution execution) {

+		super(execution);

+	}

+

+	@Override

+	public boolean register(IStateActivation stateActivation) {

+		// Register the state activation to the state machine configuration.

+		// Install timers corresponding to expected time events to the clock

+		// (i.e. the DEScheduler)

+		boolean registered = super.register(stateActivation);

+		if (registered) {

+			List<ITransitionActivation> transitionActivation = stateActivation.getOutgoingTransitions();

+			for (int i = 1; i <= transitionActivation.size(); i++) {

+				Transition transition = (Transition) transitionActivation.get(i - 1).getNode();

+				DESchedulerUtils.pushEvents(transition.getTriggers(), stateActivation, stateActivation.getExecutionContext());

+			}

+		}

+		return registered;

+	}

+

+	@Override

+	public boolean unregister(IStateActivation stateActivation) {

+		// Unregister the state activation to the state machine configuration.

+		// Cancel timers installed by the unregistered state activation. indeed

+		// if the state activation leaves the configuration that means transitions

+		// outgoing the visited state can no longer be fired

+		boolean unregistered = super.unregister(stateActivation);

+		if (unregistered) {

+			DESchedulerUtils.cancelEvents(stateActivation);

+		}

+		return unregistered;

+	}

+

+}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/StateMachines/TimedStateMachineExecution.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/StateMachines/TimedStateMachineExecution.java
new file mode 100644
index 0000000..29b41cf
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/StateMachines/TimedStateMachineExecution.java
@@ -0,0 +1,29 @@
+/*****************************************************************************

+ * Copyright (c) 2017 CEA LIST 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:

+ *   CEA LIST Initial API and implementation

+ *   

+ *****************************************************************************/

+package org.eclipse.papyrus.moka.timedfuml.semantics.StateMachines;

+

+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IObject_;

+import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.StateMachines.StateMachineExecution;

+

+public class TimedStateMachineExecution extends StateMachineExecution{

+

+	public TimedStateMachineExecution() {

+		super();

+		this.configuration = new TimedStateMachineConfiguration(this);

+	}

+	

+	public TimedStateMachineExecution(IObject_ context) {

+		super();

+		this.configuration = new TimedStateMachineConfiguration(this);

+	}

+}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/StructuredClassifiers/TimedObject.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/StructuredClassifiers/TimedObject.java
new file mode 100644
index 0000000..1238a7d
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/StructuredClassifiers/TimedObject.java
@@ -0,0 +1,38 @@
+/*****************************************************************************

+ * Copyright (c) 2017 CEA LIST.

+ *

+ *

+ * 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:

+ *  CEA LIST Initial API and implementation

+ *

+ *****************************************************************************/

+

+package org.eclipse.papyrus.moka.timedfuml.semantics.StructuredClassifiers;

+

+import java.util.List;

+

+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.IParameterValue;

+import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.StructuredClassifiers.SM_Object;

+import org.eclipse.papyrus.moka.timedfuml.semantics.CommonBehaviors.TimedObjectActivation;

+import org.eclipse.uml2.uml.Class;

+

+public class TimedObject extends SM_Object{

+

+	@Override

+	public void startBehavior(Class classifier, List<IParameterValue> inputs) {

+		///The behavior captured here is almost identical to the one provide by SM_Object.

+		// Instead of using a simple ObjectActivation we use a TimedObjectActivation.

+		// This specialized kind of ObjectActivation allows the registering of time events.

+		if (this.objectActivation == null) {

+			this.objectActivation = new TimedObjectActivation();

+			this.objectActivation.setObject(this);

+		}

+		this.objectActivation.startBehavior(classifier, inputs);

+	}

+	

+}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Timed_AcceptEventActionActivation.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Timed_AcceptEventActionActivation.java
deleted file mode 100644
index fcafefb..0000000
--- a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Timed_AcceptEventActionActivation.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*****************************************************************************

- * Copyright (c) 2016 CEA LIST.

- * 

- * 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:

- * 	Sahar Guermazi

- *  CEA LIST Initial API and implementation

- *****************************************************************************/

-package org.eclipse.papyrus.moka.timedfuml.semantics;

-

-import java.util.List;

-

-import org.eclipse.papyrus.moka.discreteevent.DEScheduler;

-import org.eclipse.papyrus.moka.discreteevent.Event;

-import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IToken;

-import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IEvaluation;

-import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IRealValue;

-import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.IEventOccurrence;

-import org.eclipse.papyrus.moka.fuml.Semantics.impl.Actions.CompleteActions.AcceptEventActionActivation;

-import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.Values.ISM_OpaqueExpressionEvaluation;

-import org.eclipse.papyrus.moka.timedfuml.actions._sendAcceptEventOfferAction;

-import org.eclipse.uml2.uml.AcceptEventAction;

-import org.eclipse.uml2.uml.TimeEvent;

-import org.eclipse.uml2.uml.Trigger;

-

-public class Timed_AcceptEventActionActivation extends AcceptEventActionActivation {

-

-	public Timed_AcceptEventActionActivation() {

-		super();

-	}

-

-	@Override

-	public void fire(List<IToken> incomingTokens) {

-		// Register an event in the DEScheduler (clock manager) and suspend this action.

-		// Note: UML 2.5 does not put any restrictions on the number of triggers with a

-		// time event that may be referenced by a single accept event action.

-		double relativeDate = 0;

-		double absoluteDate = 0;

-		double currentTime = 0;

-		for (Trigger trigger : ((AcceptEventAction) node).getTriggers()) {

-			if (trigger.getEvent() instanceof TimeEvent) {

-				boolean isMissed = false;

-				TimeEvent timeEvent = (TimeEvent) trigger.getEvent();

-				IEvaluation evaluation = null;

-				if (timeEvent.getWhen() != null && timeEvent.getWhen().getExpr() != null) {

-					evaluation = this.getExecutionLocus().getFactory().createEvaluation(timeEvent.getWhen().getExpr());

-					if(evaluation instanceof ISM_OpaqueExpressionEvaluation){

-						((ISM_OpaqueExpressionEvaluation)evaluation).setContext(this.getExecutionContext()) ;

-					}

-					if (timeEvent.isRelative()) {

-						relativeDate = ((IRealValue) evaluation.evaluate()).getValue();

-					} else {

-						absoluteDate = ((IRealValue) evaluation.evaluate()).getValue();

-						currentTime = DEScheduler.getInstance().getCurrentTime();

-						if (absoluteDate < currentTime) {

-							isMissed = true;

-							System.err.println("Time Event is missed, absoluteTime = " + absoluteDate + " > currentTime = "

-									+ currentTime);

-						} else {

-							relativeDate = absoluteDate - currentTime;

-						}

-					}

-					if (!isMissed) {

-						_sendAcceptEventOfferAction sendOfferAction = new _sendAcceptEventOfferAction(this);

-						DEScheduler.getInstance().pushEvent(new Event(relativeDate, sendOfferAction));

-						this.waiting = true;

-						this.firing = false;

-						this.suspend();

-					}

-				}

-			}

-		}

-	}

-

-	@Override

-	public void accept(IEventOccurrence eventOccurrence) {

-		// There is no acceptance of "time event occurrence". The accepted event

-		// occurrence

-		// will always be null at this point.

-		this.sendOffers();

-		this.waiting = false;

-		this.receiveOffer();

-		this.resume();

-	}

-}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Timed_ExecutionFactory.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Timed_ExecutionFactory.java
deleted file mode 100644
index 33b94a7..0000000
--- a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/semantics/Timed_ExecutionFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*****************************************************************************

- * Copyright (c) 2016 CEA LIST.

- * 

- * 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:

- *  CEA LIST Initial API and implementation

- *****************************************************************************/

-package org.eclipse.papyrus.moka.timedfuml.semantics;

-

-import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;

-import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.Loci.SM_ExecutionFactory;

-import org.eclipse.uml2.uml.AcceptEventAction;

-import org.eclipse.uml2.uml.Element;

-import org.eclipse.uml2.uml.Event;

-import org.eclipse.uml2.uml.OpaqueAction;

-import org.eclipse.uml2.uml.SendSignalAction;

-import org.eclipse.uml2.uml.TimeEvent;

-import org.eclipse.uml2.uml.Trigger;

-

-/**

- * @author sg239226

- *

- */

-public class Timed_ExecutionFactory extends SM_ExecutionFactory {

-

-	@Override

-	public ISemanticVisitor instantiateVisitor(Element element) {

-		// Extends fUML semantics in the sense that newly introduced

-		// semantic visitors are instantiated instead of fUML visitors

-

-		ISemanticVisitor visitor = null;

-		if (element instanceof AcceptEventAction) {

-			boolean isTimeEventTriggered = false;

-			for (Element elt : element.getOwnedElements()) {

-				if (elt instanceof Trigger) {

-					Trigger t = (Trigger) elt;

-					if (t.getEvent() != null) {

-						Event e = (Event) t.getEvent();

-						if (e instanceof TimeEvent) {

-							isTimeEventTriggered = true;

-						}

-					}

-				}

-			}

-			if (isTimeEventTriggered) {

-				visitor = new Timed_AcceptEventActionActivation();

-			} else {

-				visitor = super.instantiateVisitor(element);

-			}

-		} else if (element instanceof OpaqueAction) {

-			visitor = new Timed_OpaqueActionActivation();

-		} else if (element instanceof SendSignalAction) {

-			visitor = new Timed_SendSignalActionActivation();

-		} else {

-			visitor = super.instantiateVisitor(element);

-		}

-		return visitor;

-	}

-

-}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/utils/DESchedulerUtils.java b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/utils/DESchedulerUtils.java
new file mode 100644
index 0000000..2992aae
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.timedfuml/src/org/eclipse/papyrus/moka/timedfuml/utils/DESchedulerUtils.java
@@ -0,0 +1,94 @@
+/*****************************************************************************

+ * Copyright (c) 2017 CEA LIST 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:

+ *   CEA LIST Initial API and implementation

+ *   

+ *****************************************************************************/

+package org.eclipse.papyrus.moka.timedfuml.utils;

+

+import java.util.ArrayList;

+import java.util.Iterator;

+import java.util.List;

+

+import org.eclipse.papyrus.moka.discreteevent.DEScheduler;

+import org.eclipse.papyrus.moka.discreteevent.Event;

+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IEvaluation;

+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IObject_;

+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IRealValue;

+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IValue;

+import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;

+import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.Values.ISM_OpaqueExpressionEvaluation;

+import org.eclipse.papyrus.moka.timedfuml.actions._sendTimeEventOccurrence;

+import org.eclipse.uml2.uml.TimeEvent;

+import org.eclipse.uml2.uml.Trigger;

+

+public class DESchedulerUtils {

+

+	public static boolean isTimeTriggered(List<Trigger> triggers) {

+		// Determine if there is at least a trigger that has a TimeEvent.

+		// Return true if one trigger can be found false otherwise

+		boolean timeTriggered = false;

+		Iterator<Trigger> triggerIterator = triggers.iterator();

+		while(!timeTriggered && triggerIterator.hasNext()) {

+			timeTriggered = triggerIterator.next().getEvent() instanceof TimeEvent;

+		}

+		return timeTriggered;

+	}

+	

+	public static void pushEvents(List<Trigger> triggers, ISemanticVisitor visitor, IObject_ context) {

+		// Register timers for triggers that may accept a time event in the future.

+		// When the timer will fire the context object will receive a time event

+		// occurrence.

+		for (Trigger trigger : triggers) {

+			pushEvent(trigger, visitor, context);

+		}

+	}

+

+	private static void pushEvent(Trigger trigger, ISemanticVisitor visitor, IObject_ context) {

+		// Register a timer for a trigger associated to a time event. The specification

+		// of the timer consists in an event registered to the DEScheduler. This event is time 

+		// stamped with the instant at which the timer shall fire.

+		if (context != null && trigger != null && trigger.getEvent() instanceof TimeEvent) {

+			TimeEvent timeEvent = (TimeEvent) trigger.getEvent();

+			if (timeEvent.getWhen() != null && timeEvent.getWhen().getExpr() != null) {

+				IEvaluation evaluation = context.getLocus().getFactory()

+						.createEvaluation(timeEvent.getWhen().getExpr());

+				if(evaluation != null) {

+					if(evaluation instanceof ISM_OpaqueExpressionEvaluation) {

+						((ISM_OpaqueExpressionEvaluation)evaluation).setContext(context);

+					}

+					IValue value = evaluation.evaluate();

+					if(value != null && value instanceof IRealValue) {

+						double clockTime = DEScheduler.getInstance().getCurrentTime();

+						Event clockEvent = new Event(((IRealValue)value).getValue(), new _sendTimeEventOccurrence(clockTime, visitor, context));

+						if(timeEvent.isRelative()){

+							DEScheduler.getInstance().pushEvent(clockEvent);

+						}else {

+							DEScheduler.getInstance().pushEvent(clockEvent, ((IRealValue)value).getValue());

+						}

+					}

+				}

+			}

+		}

+	}

+	

+	public static void cancelEvents(ISemanticVisitor visitor) {

+		// Cancel all timers that may have been installed by the semantic

+		// visitors that was fired by another event.

+		List<Event> toRemoveEvents = new ArrayList<Event>();

+		List<Event> schedulerEvents = DEScheduler.getInstance().getEvents();

+		for(Event event : schedulerEvents) {

+			if(event.getAction() instanceof _sendTimeEventOccurrence

+					&& ((_sendTimeEventOccurrence)event.getAction()).getVisitor() == visitor) {

+				toRemoveEvents.add(event);

+			}

+		}

+		DEScheduler.getInstance().removeAllEvents(toRemoveEvents);

+	}

+}

diff --git a/bundles/core/engines/pom.xml b/bundles/core/engines/pom.xml
index eea622c..0a1993c 100644
--- a/bundles/core/engines/pom.xml
+++ b/bundles/core/engines/pom.xml
@@ -28,6 +28,7 @@
 		<module>org.eclipse.papyrus.moka.fuml.statemachines.interfaces</module>

 		<module>org.eclipse.papyrus.moka.async.fuml</module>

 		<module>org.eclipse.papyrus.moka.timedfuml</module>

+		<module>org.eclipse.papyrus.moka.timedfuml.interfaces</module>

 	</modules>

 	

 </project>

diff --git a/bundles/core/tools/org.eclipse.papyrus.moka.discreteevent/src/org/eclipse/papyrus/moka/discreteevent/DEScheduler.java b/bundles/core/tools/org.eclipse.papyrus.moka.discreteevent/src/org/eclipse/papyrus/moka/discreteevent/DEScheduler.java
index 8a444ab..b53f97d 100644
--- a/bundles/core/tools/org.eclipse.papyrus.moka.discreteevent/src/org/eclipse/papyrus/moka/discreteevent/DEScheduler.java
+++ b/bundles/core/tools/org.eclipse.papyrus.moka.discreteevent/src/org/eclipse/papyrus/moka/discreteevent/DEScheduler.java
@@ -107,7 +107,9 @@
 	}

 	

 	public void pushEvent(Event event, double absoluteDate) {

-		this.pushPullStrategy.pushEvent(event, absoluteDate);

+		if(this.currentTime < absoluteDate) {

+			this.pushPullStrategy.pushEvent(event, absoluteDate);

+		}

 	}

 	

 	public void pushPreRunAction(Action action) {

diff --git a/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUChangeEventOccurence.java b/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUChangeEventOccurence.java
index 4c46812..4330ee7 100644
--- a/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUChangeEventOccurence.java
+++ b/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUChangeEventOccurence.java
@@ -97,7 +97,9 @@
 		// Register the change event occurrence in the event pool. It is added 

 		// to the event pool after any other event already registered in the pool.

 		FMU_ObjectActivation objectActivation = (FMU_ObjectActivation) this.target.getReferent().getObjectActivation();

-		objectActivation.register(this);

+		if(objectActivation != null) {

+			objectActivation.register(this);

+		}

 	}

 	

 	protected Property getObservedProperty(ChangeEvent event){

diff --git a/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUExecutionFactory.java b/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUExecutionFactory.java
index 255e638..2c9bff9 100644
--- a/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUExecutionFactory.java
+++ b/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUExecutionFactory.java
@@ -14,11 +14,11 @@
 package org.eclipse.papyrus.moka.fmu.engine.semantics;

 

 import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;

-import org.eclipse.papyrus.moka.timedfuml.semantics.Timed_ExecutionFactory;

+import org.eclipse.papyrus.moka.timedfuml.semantics.Loci.TimedExecutionFactory;

 import org.eclipse.uml2.uml.AddStructuralFeatureValueAction;

 import org.eclipse.uml2.uml.Element;

 

-public class FMUExecutionFactory extends Timed_ExecutionFactory {

+public class FMUExecutionFactory extends TimedExecutionFactory {

 

 	@Override

 	public ISemanticVisitor instantiateVisitor(Element element) {

diff --git a/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMULocus.java b/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMULocus.java
index 3692827..628250d 100644
--- a/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMULocus.java
+++ b/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMULocus.java
@@ -15,10 +15,10 @@
 

 import org.eclipse.papyrus.moka.fmi.profile.util.FMIProfileUtil;

 import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IObject_;

-import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.Loci.SM_Locus;

+import org.eclipse.papyrus.moka.timedfuml.semantics.Loci.TimedLocus;

 import org.eclipse.uml2.uml.Class;

 

-public class FMULocus extends SM_Locus {

+public class FMULocus extends TimedLocus {

 

 	@Override

 	public IObject_ instantiate(Class type) {

diff --git a/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUObject.java b/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUObject.java
index 7d586dc..ad409f1 100644
--- a/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUObject.java
+++ b/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUObject.java
@@ -26,7 +26,6 @@
 import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IBooleanValue;

 import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IFeatureValue;

 import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IIntegerValue;

-import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IObject_;

 import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IRealValue;

 import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IReference;

 import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IStringValue;

@@ -37,7 +36,7 @@
 import org.eclipse.papyrus.moka.fuml.Semantics.impl.Classes.Kernel.RealValue;

 import org.eclipse.papyrus.moka.fuml.Semantics.impl.Classes.Kernel.Reference;

 import org.eclipse.papyrus.moka.fuml.Semantics.impl.Classes.Kernel.StringValue;

-import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.StructuredClassifiers.SM_Object;

+import org.eclipse.papyrus.moka.timedfuml.semantics.StructuredClassifiers.TimedObject;

 import org.eclipse.papyrus.moka.utils.UMLPrimitiveTypesUtils;

 import org.eclipse.uml2.uml.Class;

 import org.eclipse.uml2.uml.PrimitiveType;

@@ -47,7 +46,7 @@
 import org.eclipse.uml2.uml.util.UMLUtil;

 

 

-public class FMUObject extends SM_Object implements FMUInterface, IObject_ {

+public class FMUObject extends TimedObject implements FMUInterface {

 

 	// FIXME indexes in maps shall be implement with Long

 	protected Map<Integer, Double> realMap = new HashMap<Integer, Double>();

diff --git a/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMU_ObjectActivation.java b/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMU_ObjectActivation.java
index 1349a67..eb604d0 100644
--- a/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMU_ObjectActivation.java
+++ b/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMU_ObjectActivation.java
@@ -14,9 +14,9 @@
 

 package org.eclipse.papyrus.moka.fmu.engine.semantics;

 

-import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.CommonBehavior.SM_ObjectActivation;

+import org.eclipse.papyrus.moka.timedfuml.semantics.CommonBehaviors.TimedObjectActivation;

 

-public class FMU_ObjectActivation extends SM_ObjectActivation{

+public class FMU_ObjectActivation extends TimedObjectActivation{

 

 	public void register(FMUChangeEventOccurence changeEventOccurrence) {

 		// Add the change event occurrence at the end of the event pool.

diff --git a/bundles/fmi/engines/org.eclipse.papyrus.moka.fuml.cosimulation/src/org/eclipse/papyrus/moka/fuml/cosimulation/CosimulationFactory.java b/bundles/fmi/engines/org.eclipse.papyrus.moka.fuml.cosimulation/src/org/eclipse/papyrus/moka/fuml/cosimulation/CosimulationFactory.java
index 3c6e02e..b1595bb 100644
--- a/bundles/fmi/engines/org.eclipse.papyrus.moka.fuml.cosimulation/src/org/eclipse/papyrus/moka/fuml/cosimulation/CosimulationFactory.java
+++ b/bundles/fmi/engines/org.eclipse.papyrus.moka.fuml.cosimulation/src/org/eclipse/papyrus/moka/fuml/cosimulation/CosimulationFactory.java
@@ -15,7 +15,7 @@
 import org.eclipse.papyrus.moka.fuml.cosimulation.semantics.CosimulationAddStructuralFeatureValueActionActivation;

 import org.eclipse.papyrus.moka.fuml.cosimulation.semantics.CosimulationInstanceValueEvaluation;

 import org.eclipse.papyrus.moka.fuml.cosimulation.semantics.CosimulationReadStructuralFeatureActionActivation;

-import org.eclipse.papyrus.moka.timedfuml.semantics.Timed_ExecutionFactory;

+import org.eclipse.papyrus.moka.timedfuml.semantics.Loci.TimedExecutionFactory;

 import org.eclipse.uml2.uml.AddStructuralFeatureValueAction;

 import org.eclipse.uml2.uml.Element;

 import org.eclipse.uml2.uml.InstanceValue;

@@ -25,7 +25,7 @@
  * @author Sahar Guermazi (CEA-LIST)

  *

  */

-public class CosimulationFactory extends Timed_ExecutionFactory {

+public class CosimulationFactory extends TimedExecutionFactory {

 

 	@Override

 	public ISemanticVisitor instantiateVisitor(Element element) {