Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/plugin.xml12
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/DemoQuickfix.java40
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/DemoValidator.java44
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore15
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenFactory.java9
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenPackage.java210
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ExpandedActorClass.java19
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ExpandedRefinedState.java117
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ITransitionChainVisitor.java2
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/TransitionChain.java28
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenFactoryImpl.java11
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java75
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java239
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedRefinedStateImpl.java346
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java63
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenAdapterFactory.java96
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenSwitch.java91
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/quickfix/IRoomQuickfixProvider.java3
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java10
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend5
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CLanguageGenerator.java2
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java8
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend5
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaLanguageGenerator.java2
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java12
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java87
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java78
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/AbstractTransitionChainGenerator.java51
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend103
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ILanguageExtension.java8
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ITypedDataProvider.java35
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend9
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend133
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java38
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java361
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java72
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java123
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java3
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorExporter.java2
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java90
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/SupportUtil.java19
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java4
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java2
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/plugin.xml2
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/ExportDiagramsHandler.java79
-rw-r--r--plugins/org.eclipse.etrice.ui.common/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/editor/DiagramExporter.java18
-rw-r--r--plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/ETricePreferencePage.java30
-rw-r--r--plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/PreferenceConstants.java13
-rw-r--r--plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/PreferenceInitializer.java3
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.zipbin40625 -> 41192 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zipbin117265 -> 117259 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zipbin27511 -> 27511 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/editor/StructureExporter.java2
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/PSocket.java4
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/SocketClient.java7
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java7
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java7
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/ATcpClient.java16
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/ATcpServer.java22
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/PTcpControl.java4
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/PTcpPayload.java4
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/ATimingService.java10
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java10
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java10
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java2
-rw-r--r--tests/org.eclipse.etrice.generator.tests/src/org/eclipse/etrice/generator/base/TestDetailCodeTranslator.java5
68 files changed, 2142 insertions, 801 deletions
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/plugin.xml b/plugins/org.eclipse.etrice.abstractexec.behavior/plugin.xml
index ecdee00b0..d5e518210 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/plugin.xml
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/plugin.xml
@@ -4,11 +4,6 @@
<extension
point="org.eclipse.etrice.core.room.validation">
<validator
- class="org.eclipse.etrice.abstractexec.behavior.DemoValidator"
- classToCheck="org.eclipse.etrice.core.room.ActorClass"
- mode="FAST">
- </validator>
- <validator
class="org.eclipse.etrice.abstractexec.behavior.AbstractExecutionValidator"
classToCheck="org.eclipse.etrice.core.room.ActorClass"
mode="FAST">
@@ -19,12 +14,5 @@
mode="FAST">
</validator>
</extension>
- <extension
- point="org.eclipse.etrice.core.room.ui.quickfix">
- <quickfixProvider
- class="org.eclipse.etrice.abstractexec.behavior.DemoQuickfix"
- code="demo_issue">
- </quickfixProvider>
- </extension>
</plugin>
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/DemoQuickfix.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/DemoQuickfix.java
deleted file mode 100644
index 900343e68..000000000
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/DemoQuickfix.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * 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:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.abstractexec.behavior;
-
-import org.eclipse.etrice.core.ui.quickfix.IRoomQuickfixProvider;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.xtext.ui.editor.model.IXtextDocument;
-import org.eclipse.xtext.ui.editor.model.edit.IModification;
-import org.eclipse.xtext.ui.editor.model.edit.IModificationContext;
-import org.eclipse.xtext.ui.editor.quickfix.IssueResolutionAcceptor;
-import org.eclipse.xtext.validation.Issue;
-
-public class DemoQuickfix implements IRoomQuickfixProvider {
-
- public DemoQuickfix() {
- }
-
- @Override
- public void getResolution(final Issue issue, IssueResolutionAcceptor acceptor) {
- // 3rd arg is image, check ImageHelper how this could work
- acceptor.accept(issue, issue.getData()[0]+"_ac", "change actor class name to "+issue.getData()[0]+"_ac", null, new IModification() {
- public void apply(IModificationContext context) throws BadLocationException {
- IXtextDocument xtextDocument = context.getXtextDocument();
-// String firstLetter = xtextDocument.get(issue.getOffset(), 1);
- xtextDocument.replace(issue.getOffset()+issue.getData()[0].length(), 0, "_ac");
- }
- });
- }
-
-}
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/DemoValidator.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/DemoValidator.java
deleted file mode 100644
index ade8ace17..000000000
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/DemoValidator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * 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:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.abstractexec.behavior;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.room.RoomPackage;
-import org.eclipse.etrice.core.validation.IRoomValidator;
-import org.eclipse.xtext.validation.ValidationMessageAcceptor;
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-public class DemoValidator implements IRoomValidator {
-
- public static final String DEMO_ISSUE_CODE = "demo_issue";
-
- // HOWTO: if validator is running in check mode NORMAL there are issues with marker updates
- // the marker appears grayed and quick fixes aren't available
-
- @Override
- public void validate(EObject object,
- ValidationMessageAcceptor messageAcceptor) {
-
- if (!(object instanceof ActorClass))
- return;
-
- ActorClass ac = (ActorClass) object;
- if (!ac.getName().endsWith("_ac"))
- messageAcceptor.acceptWarning("ActorClass name must end with _ac", ac, RoomPackage.Literals.ROOM_CLASS__NAME, -1, DEMO_ISSUE_CODE, ac.getName());
- }
-
-}
diff --git a/plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore b/plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore
index d91a8de5c..9ab1f68da 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore
+++ b/plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore
@@ -146,6 +146,7 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="transition" eType="ecore:EClass ../../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore#//Transition"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="skipEntry" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
defaultValueLiteral="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="data" eType="ecore:EClass ../../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore#//VarDecl"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ITransitionChainVisitor" instanceTypeName="ITransitionChainVisitor"
abstract="true" interface="true"/>
@@ -166,9 +167,6 @@
<eParameters name="ifitem" eType="ecore:EClass ../../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore#//InterfaceItem"/>
</eOperations>
<eOperations name="hasStateMachine" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- <eOperations name="getCode" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
- <eParameters name="code" eType="ecore:EClass ../../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore#//DetailCode"/>
- </eOperations>
<eOperations name="getTriggerCodeName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eParameters name="mif" eType="ecore:EClass ../../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore#//MessageFromIf"/>
</eOperations>
@@ -207,8 +205,19 @@
<eOperations name="getOrig" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject">
<eParameters name="copy" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
</eOperations>
+ <eOperations name="getData" eType="ecore:EClass ../../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore#//VarDecl">
+ <eParameters name="trans" eType="ecore:EClass ../../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore#//Transition"/>
+ </eOperations>
<eStructuralFeatures xsi:type="ecore:EReference" name="actorClass" eType="ecore:EClass ../../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore#//ActorClass"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="stateMachine" eType="ecore:EClass ../../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore#//StateGraph"
containment="true"/>
</eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="ExpandedRefinedState" eSuperTypes="../../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore#//SimpleState">
+ <eOperations name="init">
+ <eParameters name="rs" eType="ecore:EClass ../../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore#//RefinedState"/>
+ </eOperations>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="inheritedEntry" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="inheritedExit" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="inheritedDo" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
</ecore:EPackage>
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenFactory.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenFactory.java
index b5c49e7b5..da20e8b97 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenFactory.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenFactory.java
@@ -152,6 +152,15 @@ public interface ETriceGenFactory extends EFactory {
ExpandedActorClass createExpandedActorClass();
/**
+ * Returns a new object of class '<em>Expanded Refined State</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Expanded Refined State</em>'.
+ * @generated
+ */
+ ExpandedRefinedState createExpandedRefinedState();
+
+ /**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenPackage.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenPackage.java
index d16d41e04..8eaed9094 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenPackage.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenPackage.java
@@ -11,6 +11,7 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
+import org.eclipse.etrice.core.room.RoomPackage;
/**
* <!-- begin-user-doc -->
@@ -1344,13 +1345,22 @@ public interface ETriceGenPackage extends EPackage {
int TRANSITION_CHAIN__SKIP_ENTRY = 1;
/**
+ * The feature id for the '<em><b>Data</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int TRANSITION_CHAIN__DATA = 2;
+
+ /**
* The number of structural features of the '<em>Transition Chain</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int TRANSITION_CHAIN_FEATURE_COUNT = 2;
+ int TRANSITION_CHAIN_FEATURE_COUNT = 3;
/**
* The meta object id for the '{@link ITransitionChainVisitor <em>ITransition Chain Visitor</em>}' class.
@@ -1428,6 +1438,106 @@ public interface ETriceGenPackage extends EPackage {
int EXPANDED_ACTOR_CLASS_FEATURE_COUNT = 2;
/**
+ * The meta object id for the '{@link org.eclipse.etrice.core.genmodel.etricegen.impl.ExpandedRefinedStateImpl <em>Expanded Refined State</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.etrice.core.genmodel.etricegen.impl.ExpandedRefinedStateImpl
+ * @see org.eclipse.etrice.core.genmodel.etricegen.impl.ETriceGenPackageImpl#getExpandedRefinedState()
+ * @generated
+ */
+ int EXPANDED_REFINED_STATE = 17;
+
+ /**
+ * The feature id for the '<em><b>Docu</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXPANDED_REFINED_STATE__DOCU = RoomPackage.SIMPLE_STATE__DOCU;
+
+ /**
+ * The feature id for the '<em><b>Entry Code</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXPANDED_REFINED_STATE__ENTRY_CODE = RoomPackage.SIMPLE_STATE__ENTRY_CODE;
+
+ /**
+ * The feature id for the '<em><b>Exit Code</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXPANDED_REFINED_STATE__EXIT_CODE = RoomPackage.SIMPLE_STATE__EXIT_CODE;
+
+ /**
+ * The feature id for the '<em><b>Do Code</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXPANDED_REFINED_STATE__DO_CODE = RoomPackage.SIMPLE_STATE__DO_CODE;
+
+ /**
+ * The feature id for the '<em><b>Subgraph</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXPANDED_REFINED_STATE__SUBGRAPH = RoomPackage.SIMPLE_STATE__SUBGRAPH;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXPANDED_REFINED_STATE__NAME = RoomPackage.SIMPLE_STATE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Inherited Entry</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXPANDED_REFINED_STATE__INHERITED_ENTRY = RoomPackage.SIMPLE_STATE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Inherited Exit</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXPANDED_REFINED_STATE__INHERITED_EXIT = RoomPackage.SIMPLE_STATE_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Inherited Do</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXPANDED_REFINED_STATE__INHERITED_DO = RoomPackage.SIMPLE_STATE_FEATURE_COUNT + 2;
+
+ /**
+ * The number of structural features of the '<em>Expanded Refined State</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXPANDED_REFINED_STATE_FEATURE_COUNT = RoomPackage.SIMPLE_STATE_FEATURE_COUNT + 3;
+
+ /**
* The meta object id for the '{@link org.eclipse.etrice.core.genmodel.etricegen.PortKind <em>Port Kind</em>}' enum.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -1435,7 +1545,7 @@ public interface ETriceGenPackage extends EPackage {
* @see org.eclipse.etrice.core.genmodel.etricegen.impl.ETriceGenPackageImpl#getPortKind()
* @generated
*/
- int PORT_KIND = 17;
+ int PORT_KIND = 18;
/**
@@ -2129,6 +2239,17 @@ public interface ETriceGenPackage extends EPackage {
EAttribute getTransitionChain_SkipEntry();
/**
+ * Returns the meta object for the reference '{@link org.eclipse.etrice.core.genmodel.etricegen.TransitionChain#getData <em>Data</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Data</em>'.
+ * @see org.eclipse.etrice.core.genmodel.etricegen.TransitionChain#getData()
+ * @see #getTransitionChain()
+ * @generated
+ */
+ EReference getTransitionChain_Data();
+
+ /**
* Returns the meta object for class '{@link ITransitionChainVisitor <em>ITransition Chain Visitor</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -2183,6 +2304,49 @@ public interface ETriceGenPackage extends EPackage {
EReference getExpandedActorClass_StateMachine();
/**
+ * Returns the meta object for class '{@link org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState <em>Expanded Refined State</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Expanded Refined State</em>'.
+ * @see org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState
+ * @generated
+ */
+ EClass getExpandedRefinedState();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState#getInheritedEntry <em>Inherited Entry</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Inherited Entry</em>'.
+ * @see org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState#getInheritedEntry()
+ * @see #getExpandedRefinedState()
+ * @generated
+ */
+ EAttribute getExpandedRefinedState_InheritedEntry();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState#getInheritedExit <em>Inherited Exit</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Inherited Exit</em>'.
+ * @see org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState#getInheritedExit()
+ * @see #getExpandedRefinedState()
+ * @generated
+ */
+ EAttribute getExpandedRefinedState_InheritedExit();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState#getInheritedDo <em>Inherited Do</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Inherited Do</em>'.
+ * @see org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState#getInheritedDo()
+ * @see #getExpandedRefinedState()
+ * @generated
+ */
+ EAttribute getExpandedRefinedState_InheritedDo();
+
+ /**
* Returns the meta object for enum '{@link org.eclipse.etrice.core.genmodel.etricegen.PortKind <em>Port Kind</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -2755,6 +2919,14 @@ public interface ETriceGenPackage extends EPackage {
EAttribute TRANSITION_CHAIN__SKIP_ENTRY = eINSTANCE.getTransitionChain_SkipEntry();
/**
+ * The meta object literal for the '<em><b>Data</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference TRANSITION_CHAIN__DATA = eINSTANCE.getTransitionChain_Data();
+
+ /**
* The meta object literal for the '{@link ITransitionChainVisitor <em>ITransition Chain Visitor</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -2801,6 +2973,40 @@ public interface ETriceGenPackage extends EPackage {
EReference EXPANDED_ACTOR_CLASS__STATE_MACHINE = eINSTANCE.getExpandedActorClass_StateMachine();
/**
+ * The meta object literal for the '{@link org.eclipse.etrice.core.genmodel.etricegen.impl.ExpandedRefinedStateImpl <em>Expanded Refined State</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.etrice.core.genmodel.etricegen.impl.ExpandedRefinedStateImpl
+ * @see org.eclipse.etrice.core.genmodel.etricegen.impl.ETriceGenPackageImpl#getExpandedRefinedState()
+ * @generated
+ */
+ EClass EXPANDED_REFINED_STATE = eINSTANCE.getExpandedRefinedState();
+
+ /**
+ * The meta object literal for the '<em><b>Inherited Entry</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute EXPANDED_REFINED_STATE__INHERITED_ENTRY = eINSTANCE.getExpandedRefinedState_InheritedEntry();
+
+ /**
+ * The meta object literal for the '<em><b>Inherited Exit</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute EXPANDED_REFINED_STATE__INHERITED_EXIT = eINSTANCE.getExpandedRefinedState_InheritedExit();
+
+ /**
+ * The meta object literal for the '<em><b>Inherited Do</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute EXPANDED_REFINED_STATE__INHERITED_DO = eINSTANCE.getExpandedRefinedState_InheritedDo();
+
+ /**
* The meta object literal for the '{@link org.eclipse.etrice.core.genmodel.etricegen.PortKind <em>Port Kind</em>}' enum.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ExpandedActorClass.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ExpandedActorClass.java
index ce4bb7e60..2f53a0732 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ExpandedActorClass.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ExpandedActorClass.java
@@ -7,11 +7,9 @@
package org.eclipse.etrice.core.genmodel.etricegen;
import org.eclipse.emf.common.util.EList;
-
import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.ContinuationTransition;
-import org.eclipse.etrice.core.room.DetailCode;
import org.eclipse.etrice.core.room.InterfaceItem;
import org.eclipse.etrice.core.room.MessageFromIf;
import org.eclipse.etrice.core.room.State;
@@ -21,6 +19,7 @@ import org.eclipse.etrice.core.room.StateGraphNode;
import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.core.room.TransitionTerminal;
import org.eclipse.etrice.core.room.Trigger;
+import org.eclipse.etrice.core.room.VarDecl;
/**
* <!-- begin-user-doc -->
@@ -146,14 +145,6 @@ public interface ExpandedActorClass extends EObject {
* @model
* @generated
*/
- String getCode(DetailCode code);
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated
- */
String getTriggerCodeName(MessageFromIf mif);
/**
@@ -268,4 +259,12 @@ public interface ExpandedActorClass extends EObject {
*/
EObject getOrig(EObject copy);
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ VarDecl getData(Transition trans);
+
} // ExpandedActorClass
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ExpandedRefinedState.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ExpandedRefinedState.java
new file mode 100644
index 000000000..b651c5bf3
--- /dev/null
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ExpandedRefinedState.java
@@ -0,0 +1,117 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.etrice.core.genmodel.etricegen;
+
+import org.eclipse.etrice.core.room.SimpleState;
+import org.eclipse.etrice.core.room.RefinedState;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Expanded Refined State</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState#getInheritedEntry <em>Inherited Entry</em>}</li>
+ * <li>{@link org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState#getInheritedExit <em>Inherited Exit</em>}</li>
+ * <li>{@link org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState#getInheritedDo <em>Inherited Do</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage#getExpandedRefinedState()
+ * @model
+ * @generated
+ */
+public interface ExpandedRefinedState extends SimpleState {
+ /**
+ * Returns the value of the '<em><b>Inherited Entry</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Inherited Entry</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Inherited Entry</em>' attribute.
+ * @see #setInheritedEntry(String)
+ * @see org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage#getExpandedRefinedState_InheritedEntry()
+ * @model
+ * @generated
+ */
+ String getInheritedEntry();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState#getInheritedEntry <em>Inherited Entry</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Inherited Entry</em>' attribute.
+ * @see #getInheritedEntry()
+ * @generated
+ */
+ void setInheritedEntry(String value);
+
+ /**
+ * Returns the value of the '<em><b>Inherited Exit</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Inherited Exit</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Inherited Exit</em>' attribute.
+ * @see #setInheritedExit(String)
+ * @see org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage#getExpandedRefinedState_InheritedExit()
+ * @model
+ * @generated
+ */
+ String getInheritedExit();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState#getInheritedExit <em>Inherited Exit</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Inherited Exit</em>' attribute.
+ * @see #getInheritedExit()
+ * @generated
+ */
+ void setInheritedExit(String value);
+
+ /**
+ * Returns the value of the '<em><b>Inherited Do</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Inherited Do</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Inherited Do</em>' attribute.
+ * @see #setInheritedDo(String)
+ * @see org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage#getExpandedRefinedState_InheritedDo()
+ * @model
+ * @generated
+ */
+ String getInheritedDo();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState#getInheritedDo <em>Inherited Do</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Inherited Do</em>' attribute.
+ * @see #getInheritedDo()
+ * @generated
+ */
+ void setInheritedDo(String value);
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ void init(RefinedState rs);
+
+} // ExpandedRefinedState
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ITransitionChainVisitor.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ITransitionChainVisitor.java
index 7bbfb2825..70a95dedd 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ITransitionChainVisitor.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ITransitionChainVisitor.java
@@ -12,7 +12,7 @@ import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.Transition;
public interface ITransitionChainVisitor {
- String genTypedData();
+ String genTypedData(TransitionChain tc);
String genActionOperationCall(Transition tr);
String genEntryOperationCall(State state);
String genExitOperationCall(State state);
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/TransitionChain.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/TransitionChain.java
index b58096349..0e50c39cb 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/TransitionChain.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/TransitionChain.java
@@ -10,6 +10,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.Transition;
+import org.eclipse.etrice.core.room.VarDecl;
/**
* <!-- begin-user-doc -->
@@ -21,6 +22,7 @@ import org.eclipse.etrice.core.room.Transition;
* <ul>
* <li>{@link org.eclipse.etrice.core.genmodel.etricegen.TransitionChain#getTransition <em>Transition</em>}</li>
* <li>{@link org.eclipse.etrice.core.genmodel.etricegen.TransitionChain#isSkipEntry <em>Skip Entry</em>}</li>
+ * <li>{@link org.eclipse.etrice.core.genmodel.etricegen.TransitionChain#getData <em>Data</em>}</li>
* </ul>
* </p>
*
@@ -83,6 +85,32 @@ public interface TransitionChain extends EObject {
void setSkipEntry(boolean value);
/**
+ * Returns the value of the '<em><b>Data</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Data</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Data</em>' reference.
+ * @see #setData(VarDecl)
+ * @see org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage#getTransitionChain_Data()
+ * @model
+ * @generated
+ */
+ VarDecl getData();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.etrice.core.genmodel.etricegen.TransitionChain#getData <em>Data</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Data</em>' reference.
+ * @see #getData()
+ * @generated
+ */
+ void setData(VarDecl value);
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @model kind="operation"
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenFactoryImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenFactoryImpl.java
index 59192983e..562824933 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenFactoryImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenFactoryImpl.java
@@ -75,6 +75,7 @@ public class ETriceGenFactoryImpl extends EFactoryImpl implements ETriceGenFacto
case ETriceGenPackage.ACTIVE_TRIGGER: return createActiveTrigger();
case ETriceGenPackage.TRANSITION_CHAIN: return createTransitionChain();
case ETriceGenPackage.EXPANDED_ACTOR_CLASS: return createExpandedActorClass();
+ case ETriceGenPackage.EXPANDED_REFINED_STATE: return createExpandedRefinedState();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
@@ -255,6 +256,16 @@ public class ETriceGenFactoryImpl extends EFactoryImpl implements ETriceGenFacto
* <!-- end-user-doc -->
* @generated
*/
+ public ExpandedRefinedState createExpandedRefinedState() {
+ ExpandedRefinedStateImpl expandedRefinedState = new ExpandedRefinedStateImpl();
+ return expandedRefinedState;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public PortKind createPortKindFromString(EDataType eDataType, String initialValue) {
PortKind result = PortKind.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java
index 7b1159e9e..0dc35269d 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java
@@ -22,6 +22,7 @@ import org.eclipse.etrice.core.genmodel.etricegen.ConnectionInstance;
import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenFactory;
import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState;
import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
@@ -167,6 +168,13 @@ public class ETriceGenPackageImpl extends EPackageImpl implements ETriceGenPacka
* <!-- end-user-doc -->
* @generated
*/
+ private EClass expandedRefinedStateEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
private EEnum portKindEEnum = null;
/**
@@ -814,6 +822,15 @@ public class ETriceGenPackageImpl extends EPackageImpl implements ETriceGenPacka
* <!-- end-user-doc -->
* @generated
*/
+ public EReference getTransitionChain_Data() {
+ return (EReference)transitionChainEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EClass getITransitionChainVisitor() {
return iTransitionChainVisitorEClass;
}
@@ -859,6 +876,42 @@ public class ETriceGenPackageImpl extends EPackageImpl implements ETriceGenPacka
* <!-- end-user-doc -->
* @generated
*/
+ public EClass getExpandedRefinedState() {
+ return expandedRefinedStateEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getExpandedRefinedState_InheritedEntry() {
+ return (EAttribute)expandedRefinedStateEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getExpandedRefinedState_InheritedExit() {
+ return (EAttribute)expandedRefinedStateEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getExpandedRefinedState_InheritedDo() {
+ return (EAttribute)expandedRefinedStateEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EEnum getPortKind() {
return portKindEEnum;
}
@@ -968,6 +1021,7 @@ public class ETriceGenPackageImpl extends EPackageImpl implements ETriceGenPacka
transitionChainEClass = createEClass(TRANSITION_CHAIN);
createEReference(transitionChainEClass, TRANSITION_CHAIN__TRANSITION);
createEAttribute(transitionChainEClass, TRANSITION_CHAIN__SKIP_ENTRY);
+ createEReference(transitionChainEClass, TRANSITION_CHAIN__DATA);
iTransitionChainVisitorEClass = createEClass(ITRANSITION_CHAIN_VISITOR);
@@ -977,6 +1031,11 @@ public class ETriceGenPackageImpl extends EPackageImpl implements ETriceGenPacka
createEReference(expandedActorClassEClass, EXPANDED_ACTOR_CLASS__ACTOR_CLASS);
createEReference(expandedActorClassEClass, EXPANDED_ACTOR_CLASS__STATE_MACHINE);
+ expandedRefinedStateEClass = createEClass(EXPANDED_REFINED_STATE);
+ createEAttribute(expandedRefinedStateEClass, EXPANDED_REFINED_STATE__INHERITED_ENTRY);
+ createEAttribute(expandedRefinedStateEClass, EXPANDED_REFINED_STATE__INHERITED_EXIT);
+ createEAttribute(expandedRefinedStateEClass, EXPANDED_REFINED_STATE__INHERITED_DO);
+
// Create enums
portKindEEnum = createEEnum(PORT_KIND);
}
@@ -1020,6 +1079,7 @@ public class ETriceGenPackageImpl extends EPackageImpl implements ETriceGenPacka
sapInstanceEClass.getESuperTypes().add(this.getInterfaceItemInstance());
sppInstanceEClass.getESuperTypes().add(this.getInstanceBase());
serviceImplInstanceEClass.getESuperTypes().add(this.getInterfaceItemInstance());
+ expandedRefinedStateEClass.getESuperTypes().add(theRoomPackage.getSimpleState());
// Initialize classes and features; add operations and parameters
initEClass(rootEClass, Root.class, "Root", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@@ -1119,6 +1179,7 @@ public class ETriceGenPackageImpl extends EPackageImpl implements ETriceGenPacka
initEClass(transitionChainEClass, TransitionChain.class, "TransitionChain", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getTransitionChain_Transition(), theRoomPackage.getTransition(), null, "transition", null, 0, 1, TransitionChain.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getTransitionChain_SkipEntry(), ecorePackage.getEBoolean(), "skipEntry", "false", 0, 1, TransitionChain.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getTransitionChain_Data(), theRoomPackage.getVarDecl(), null, "data", null, 0, 1, TransitionChain.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
addEOperation(transitionChainEClass, theRoomPackage.getState(), "getStateContext", 0, 1, IS_UNIQUE, IS_ORDERED);
@@ -1151,9 +1212,6 @@ public class ETriceGenPackageImpl extends EPackageImpl implements ETriceGenPacka
addEOperation(expandedActorClassEClass, ecorePackage.getEBoolean(), "hasStateMachine", 0, 1, IS_UNIQUE, IS_ORDERED);
- op = addEOperation(expandedActorClassEClass, ecorePackage.getEString(), "getCode", 0, 1, IS_UNIQUE, IS_ORDERED);
- addEParameter(op, theRoomPackage.getDetailCode(), "code", 0, 1, IS_UNIQUE, IS_ORDERED);
-
op = addEOperation(expandedActorClassEClass, ecorePackage.getEString(), "getTriggerCodeName", 0, 1, IS_UNIQUE, IS_ORDERED);
addEParameter(op, theRoomPackage.getMessageFromIf(), "mif", 0, 1, IS_UNIQUE, IS_ORDERED);
@@ -1196,6 +1254,17 @@ public class ETriceGenPackageImpl extends EPackageImpl implements ETriceGenPacka
op = addEOperation(expandedActorClassEClass, ecorePackage.getEObject(), "getOrig", 0, 1, IS_UNIQUE, IS_ORDERED);
addEParameter(op, ecorePackage.getEObject(), "copy", 0, 1, IS_UNIQUE, IS_ORDERED);
+ op = addEOperation(expandedActorClassEClass, theRoomPackage.getVarDecl(), "getData", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, theRoomPackage.getTransition(), "trans", 0, 1, IS_UNIQUE, IS_ORDERED);
+
+ initEClass(expandedRefinedStateEClass, ExpandedRefinedState.class, "ExpandedRefinedState", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getExpandedRefinedState_InheritedEntry(), ecorePackage.getEString(), "inheritedEntry", null, 0, 1, ExpandedRefinedState.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getExpandedRefinedState_InheritedExit(), ecorePackage.getEString(), "inheritedExit", null, 0, 1, ExpandedRefinedState.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getExpandedRefinedState_InheritedDo(), ecorePackage.getEString(), "inheritedDo", null, 0, 1, ExpandedRefinedState.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ op = addEOperation(expandedRefinedStateEClass, null, "init", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, theRoomPackage.getRefinedState(), "rs", 0, 1, IS_UNIQUE, IS_ORDERED);
+
// Initialize enums and add enum literals
initEEnum(portKindEEnum, PortKind.class, "PortKind");
addEEnumLiteral(portKindEEnum, PortKind.EXTERNAL);
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
index a62525b05..7a7bc5d54 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
@@ -6,6 +6,7 @@
*/
package org.eclipse.etrice.core.genmodel.etricegen.impl;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@@ -31,6 +32,7 @@ import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger;
import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenFactory;
import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState;
import org.eclipse.etrice.core.genmodel.etricegen.IDiagnostician;
import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
import org.eclipse.etrice.core.naming.RoomNameProvider;
@@ -39,7 +41,6 @@ import org.eclipse.etrice.core.room.ActorCommunicationType;
import org.eclipse.etrice.core.room.ChoicePoint;
import org.eclipse.etrice.core.room.ChoicepointTerminal;
import org.eclipse.etrice.core.room.ContinuationTransition;
-import org.eclipse.etrice.core.room.DetailCode;
import org.eclipse.etrice.core.room.EntryPoint;
import org.eclipse.etrice.core.room.ExitPoint;
import org.eclipse.etrice.core.room.ExternalPort;
@@ -51,6 +52,7 @@ import org.eclipse.etrice.core.room.MessageFromIf;
import org.eclipse.etrice.core.room.NonInitialTransition;
import org.eclipse.etrice.core.room.Port;
import org.eclipse.etrice.core.room.ProtocolClass;
+import org.eclipse.etrice.core.room.RefableType;
import org.eclipse.etrice.core.room.RefinedState;
import org.eclipse.etrice.core.room.RoomFactory;
import org.eclipse.etrice.core.room.RoomPackage;
@@ -89,7 +91,7 @@ import org.eclipse.etrice.core.room.util.RoomHelpers;
*/
public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActorClass {
- private class NodeData {
+ private static class NodeData {
private LinkedList<Transition> inTrans = new LinkedList<Transition>();
private LinkedList<Transition> outTrans = new LinkedList<Transition>();
private LinkedList<Transition> loopTrans = null;
@@ -126,6 +128,29 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
return loopTrans;
}
}
+
+ /**
+ * transition chains may merge in a choice point or in an entry or exit point.
+ * We call all merged transition chains a transition chain bundle
+ *
+ */
+ private static class TransitionChainBundle {
+ private ArrayList<TransitionChain> chains = new ArrayList<TransitionChain>();
+ private VarDecl commonData = null;
+ }
+
+ private static class TransitionToChainBundleMap extends HashMap<Transition, TransitionChainBundle> {
+ private static final long serialVersionUID = 1L;
+
+ void put(Transition t, TransitionChain tc) {
+ TransitionChainBundle tcb = get(t);
+ if (tcb==null) {
+ tcb = new TransitionChainBundle();
+ put(t, tcb);
+ }
+ tcb.chains.add(tc);
+ }
+ }
/**
* The cached value of the '{@link #getActorClass() <em>Actor Class</em>}' reference.
@@ -158,7 +183,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
private HashMap<State, LinkedList<ActiveTrigger>> state2triggers = null;
private HashMap<String, MessageFromIf> triggerstring2mif = null;
private LinkedList<TransitionChain> trchains = null;
- private HashMap<Transition, TransitionChain> trans2chain = null;
+ private TransitionToChainBundleMap trans2chainBundle = null;
private HashMap<EObject, EObject> copy2orig = null;
/**
@@ -271,19 +296,19 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
private void buildStateGraph() {
// create a list of super classes, super first, sub-classes last
- LinkedList<StateGraph> sms = new LinkedList<StateGraph>();
+ ArrayList<StateGraph> sms = new ArrayList<StateGraph>();
ActorClass orig = getActorClass();
if (orig.getStateMachine()!=null)
- sms.addFirst(orig.getStateMachine());
+ sms.add(0, orig.getStateMachine());
while (orig.getBase()!=null) {
orig = orig.getBase();
if (orig.getStateMachine()!=null)
- sms.addFirst(orig.getStateMachine());
+ sms.add(0, orig.getStateMachine());
}
// create a self contained copy of all actor classes
// references to interface items (ports, saps and spps) point to contents of the original actor class
- //Collection<StateGraph> all = EcoreUtil.copyAll(sms);
+ // Collection<StateGraph> all = EcoreUtil.copyAll(sms);
// we use the copier directly since we need access to the map
Copier copier = new Copier();
Collection<StateGraph> all = copier.copyAll(sms);
@@ -293,14 +318,23 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
copy2orig.put(c, o);
}
- // remove self from this list
- StateGraph self = null;
- for (Iterator<StateGraph> it = all.iterator(); it.hasNext();) {
- self = it.next();
- }
- all.remove(self);
+ if (getActorClass().getStateMachine()!=null) {
+ // last state machine is ours
+ StateGraph self = null;
+ for (Iterator<StateGraph> it = all.iterator(); it.hasNext();) {
+ self = it.next();
+ }
+
+ // flag own objects
+ TreeIterator<EObject> it = self.eAllContents();
+ while (it.hasNext()) {
+ EObject obj = it.next();
+ if (obj instanceof StateGraphItem)
+ addOwnObject((StateGraphItem)obj);
+ }
+ }
- // now we move all base class state machine contents to our state machine
+ // now we move all state machine contents to our state machine
StateGraph sm = RoomFactory.eINSTANCE.createStateGraph();
setStateMachine(sm);
for (StateGraph sml : all) {
@@ -310,75 +344,34 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
sm.getTransitions().addAll(sml.getTransitions());
}
- // then we relocate the refined state contents to their respective base state and remove all refined states
- relocateRefinedStateContents(sm, true);
-
- if (getActorClass().getStateMachine()!=null) {
- TreeIterator<EObject> it = self.eAllContents();
- while (it.hasNext()) {
- EObject obj = it.next();
- if (obj instanceof StateGraphItem)
- addOwnObject((StateGraphItem)obj);
- }
-
- sm.getChPoints().addAll(self.getChPoints());
- sm.getStates().addAll(self.getStates());
- sm.getTrPoints().addAll(self.getTrPoints());
- sm.getTransitions().addAll(self.getTransitions());
-
- // then we relocate the refined state contents to their respective base state while keeping all refined states
- relocateRefinedStateContents(sm, false);
- }
+ introduceExpandedRefinedStates(sm);
}
/**
- * remove refined states and relocate their respective contents to the
- * corresponding base state
- *
- * This task is simplified by the fact that transition terminals point to SimpleStates only.
- * Otherwise we had to redirect those references here.
+ * replace refined state with a ExpandedRefinedState but as replacement of the ultimate SimpleState
+ * the refined state is targeting
*
* @param sg - the current context (will be called recursively)
- * @param remove - if true the refined states are removed, if false they are moved
- * to be siblings of their base states
*/
- private void relocateRefinedStateContents(StateGraph sg, boolean remove) {
- LinkedList<RefinedState> refinedstates = new LinkedList<RefinedState>();
- for (State s : sg.getStates()) {
+ private void introduceExpandedRefinedStates(StateGraph sg) {
+ // need to make a copy of the list because we will modify the original list
+ ArrayList<State> states = new ArrayList<State>(sg.getStates());
+ for (State s : states) {
if (s instanceof RefinedState) {
RefinedState rs = (RefinedState) s;
- refinedstates.add(rs);
- State bs = RoomHelpers.getBaseState(rs);
- if (!remove) {
- StateGraph parent = (StateGraph) bs.eContainer();
- parent.getStates().add(rs);
- }
-
- // relocate contents
- StateGraph fromSG = rs.getSubgraph();
- if (fromSG!=null) {
- StateGraph toSG = bs.getSubgraph();
- if (toSG==null) {
- toSG = RoomFactory.eINSTANCE.createStateGraph();
- bs.setSubgraph(toSG);
- }
- toSG.getChPoints().addAll(fromSG.getChPoints());
- toSG.getStates().addAll(fromSG.getStates());
- toSG.getTrPoints().addAll(fromSG.getTrPoints());
- toSG.getTransitions().addAll(fromSG.getTransitions());
- }
+
+ ExpandedRefinedState state = ETriceGenFactory.eINSTANCE.createExpandedRefinedState();
+ state.init(rs);
+ copy2orig.put(state, getOrig(rs));
+ if (isOwnObject(rs))
+ addOwnObject(state);
}
}
- if (remove) {
- // remove empty refined states
- sg.getStates().removeAll(refinedstates);
- }
-
- // recurse down into states
+ // recurse down into sub graph
for (State s : sg.getStates()) {
if (s.getSubgraph()!=null)
- relocateRefinedStateContents(s.getSubgraph(), remove);
+ introduceExpandedRefinedStates(s.getSubgraph());
}
}
@@ -744,6 +737,9 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
if (t instanceof TriggeredTransition) {
VarDecl data = null;
+
+ // TODO: after introduction of VarDecl after 'action' leave this to validation
+
boolean first = true;
for (Trigger tr : ((TriggeredTransition)t).getTriggers()) {
for (MessageFromIf mif : tr.getMsgFromIfPairs()) {
@@ -774,6 +770,8 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
if (first)
validationError("Triggered transition has to have a message from interface!", t, RoomPackage.eINSTANCE.getTriggeredTransition_Triggers());
+
+ tc.setData(data);
}
collectChainTransitions(tc, t);
@@ -782,7 +780,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
}
private void collectChainTransitions(TransitionChain tc, Transition t) {
- trans2chain.put(t, tc);
+ trans2chainBundle.put(t, tc);
// should always hold true
// assert(t instanceof NonInitialTransition): "A transition chain must not contain initial transitions!";
@@ -811,12 +809,9 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
}
}
- private void findTriggeredTransitionChains(StateGraph sg) {
+ private void findTransitionChains(StateGraph sg, Class<?> cls) {
for (Transition t : sg.getTransitions()) {
- if (t instanceof TriggeredTransition) {
- addTransitionChain(t);
- }
- else if (t instanceof InitialTransition) {
+ if (cls.isInstance(t) || t instanceof InitialTransition) {
addTransitionChain(t);
}
}
@@ -824,24 +819,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
// recurse into sub graphs of states
for (State s : sg.getStates()) {
if (s.getSubgraph()!=null)
- findTriggeredTransitionChains(s.getSubgraph());
- }
- }
-
- private void findGuardedTransitionChains(StateGraph sg) {
- for (Transition t : sg.getTransitions()) {
- if (t instanceof GuardedTransition) {
- addTransitionChain(t);
- }
- else if (t instanceof InitialTransition) {
- addTransitionChain(t);
- }
- }
-
- // recurse into sub graphs of states
- for (State s : sg.getStates()) {
- if (s.getSubgraph()!=null)
- findGuardedTransitionChains(s.getSubgraph());
+ findTransitionChains(s.getSubgraph(), cls);
}
}
@@ -864,7 +842,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
state2triggers = new HashMap<State, LinkedList<ActiveTrigger>>();
triggerstring2mif = new HashMap<String, MessageFromIf>();
trchains = new LinkedList<TransitionChain>();
- trans2chain = new HashMap<Transition, TransitionChain>();
+ trans2chainBundle = new TransitionToChainBundleMap();
copy2orig = new HashMap<EObject, EObject>();
buildStateGraph();
@@ -876,18 +854,45 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
return;
if (getActorClass().getCommType()==ActorCommunicationType.DATA_DRIVEN) {
- findGuardedTransitionChains(getStateMachine());
+ findTransitionChains(getStateMachine(), GuardedTransition.class);
}
else {
// event driven state machine
findLeafStateTriggers(getStateMachine());
fillTriggerStringMap();
- findTriggeredTransitionChains(getStateMachine());
+ findTransitionChains(getStateMachine(), TriggeredTransition.class);
+ computeCommonChainData();
checkTransitionChains(getStateMachine());
}
}
/**
+ *
+ */
+ private void computeCommonChainData() {
+ for (TransitionChainBundle tcb : trans2chainBundle.values()) {
+ if (tcb.chains.size()==1)
+ tcb.commonData = tcb.chains.get(0).getData();
+ else {
+ ArrayList<RefableType> types = new ArrayList<RefableType>();
+ for (TransitionChain chain : tcb.chains) {
+ if (chain.getData()!=null)
+ types.add(chain.getData().getRefType());
+ else
+ types.add(null);
+ }
+ RefableType rt = RoomHelpers.getLastCommonSuperType(types);
+ if (rt!=null) {
+ VarDecl vd = RoomFactory.eINSTANCE.createVarDecl();
+ vd.setName("data");
+ vd.setRefType(rt);
+ tcb.commonData = vd;
+ }
+ }
+ }
+ }
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
@@ -905,7 +910,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
state2triggers = null;
triggerstring2mif = null;
trchains = null;
- trans2chain = null;
+ trans2chainBundle = null;
copy2orig = null;
}
@@ -986,22 +991,6 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
* <!-- end-user-doc -->
* @generated NOT
*/
- public String getCode(DetailCode code) {
- if (code.getCommands().isEmpty())
- return "";
-
- String result = "";
- for (String cmd : code.getCommands()) {
- result += cmd + "\n";
- }
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated NOT
- */
public String getTriggerCodeName(MessageFromIf mif) {
return "TRIG_"+mif.getFrom().getName()+"__"+mif.getMessage().getName();
}
@@ -1128,7 +1117,27 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
* @generated NOT
*/
public TransitionChain getChain(Transition trans) {
- return trans2chain.get(trans);
+ TransitionChainBundle tcb = trans2chainBundle.get(trans);
+ if (tcb.chains.isEmpty())
+ return null;
+
+ return tcb.chains.get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public VarDecl getData(Transition trans) {
+ TransitionChainBundle tcb = trans2chainBundle.get(trans);
+ if (tcb.chains.isEmpty())
+ return null;
+
+ if (tcb.chains.size()==1)
+ return tcb.chains.get(0).getData();
+
+ return tcb.commonData;
}
/**
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedRefinedStateImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedRefinedStateImpl.java
new file mode 100644
index 000000000..731432271
--- /dev/null
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedRefinedStateImpl.java
@@ -0,0 +1,346 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.etrice.core.genmodel.etricegen.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState;
+import org.eclipse.etrice.core.room.NonInitialTransition;
+import org.eclipse.etrice.core.room.RefinedState;
+import org.eclipse.etrice.core.room.RoomFactory;
+import org.eclipse.etrice.core.room.State;
+import org.eclipse.etrice.core.room.StateGraph;
+import org.eclipse.etrice.core.room.StateTerminal;
+import org.eclipse.etrice.core.room.SubStateTrPointTerminal;
+import org.eclipse.etrice.core.room.Transition;
+import org.eclipse.etrice.core.room.impl.SimpleStateImpl;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Expanded Refined State</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.etrice.core.genmodel.etricegen.impl.ExpandedRefinedStateImpl#getInheritedEntry <em>Inherited Entry</em>}</li>
+ * <li>{@link org.eclipse.etrice.core.genmodel.etricegen.impl.ExpandedRefinedStateImpl#getInheritedExit <em>Inherited Exit</em>}</li>
+ * <li>{@link org.eclipse.etrice.core.genmodel.etricegen.impl.ExpandedRefinedStateImpl#getInheritedDo <em>Inherited Do</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class ExpandedRefinedStateImpl extends SimpleStateImpl implements ExpandedRefinedState {
+ /**
+ * The default value of the '{@link #getInheritedEntry() <em>Inherited Entry</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInheritedEntry()
+ * @generated
+ * @ordered
+ */
+ protected static final String INHERITED_ENTRY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getInheritedEntry() <em>Inherited Entry</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInheritedEntry()
+ * @generated
+ * @ordered
+ */
+ protected String inheritedEntry = INHERITED_ENTRY_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getInheritedExit() <em>Inherited Exit</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInheritedExit()
+ * @generated
+ * @ordered
+ */
+ protected static final String INHERITED_EXIT_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getInheritedExit() <em>Inherited Exit</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInheritedExit()
+ * @generated
+ * @ordered
+ */
+ protected String inheritedExit = INHERITED_EXIT_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getInheritedDo() <em>Inherited Do</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInheritedDo()
+ * @generated
+ * @ordered
+ */
+ protected static final String INHERITED_DO_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getInheritedDo() <em>Inherited Do</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInheritedDo()
+ * @generated
+ * @ordered
+ */
+ protected String inheritedDo = INHERITED_DO_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ExpandedRefinedStateImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return ETriceGenPackage.Literals.EXPANDED_REFINED_STATE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getInheritedEntry() {
+ return inheritedEntry;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setInheritedEntry(String newInheritedEntry) {
+ String oldInheritedEntry = inheritedEntry;
+ inheritedEntry = newInheritedEntry;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_ENTRY, oldInheritedEntry, inheritedEntry));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getInheritedExit() {
+ return inheritedExit;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setInheritedExit(String newInheritedExit) {
+ String oldInheritedExit = inheritedExit;
+ inheritedExit = newInheritedExit;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_EXIT, oldInheritedExit, inheritedExit));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getInheritedDo() {
+ return inheritedDo;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setInheritedDo(String newInheritedDo) {
+ String oldInheritedDo = inheritedDo;
+ inheritedDo = newInheritedDo;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_DO, oldInheritedDo, inheritedDo));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void init(RefinedState rs) {
+ setName(rs.getName());
+
+ // the next assignments take over the code and docu and state graph objects from rs
+ // but this is a copy and thus does no harm
+ setEntryCode(rs.getEntryCode());
+ setExitCode(rs.getExitCode());
+ setDoCode(rs.getDoCode());
+ setDocu(rs.getDocu());
+ setSubgraph(rs.getSubgraph());
+
+ // now we collect the inherited detail code
+ setInheritedEntry(RoomHelpers.getInheritedEntryCode(rs));
+ setInheritedExit(RoomHelpers.getInheritedExitCode(rs));
+ setInheritedDo(RoomHelpers.getInheritedDoCode(rs));
+
+ // remove refined state from its container
+ ((StateGraph)rs.eContainer()).getStates().remove(rs);
+
+ // put new state in place of SimpleState which is the ultimate target of the refined state
+ State bs = RoomHelpers.getBaseState(rs);
+ StateGraph parent = (StateGraph) bs.eContainer();
+ parent.getStates().add(this);
+ parent.getStates().remove(bs);
+ for (Transition trans : parent.getTransitions()) {
+ if (trans.getTo() instanceof StateTerminal) {
+ if (((StateTerminal)trans.getTo()).getState()==bs)
+ ((StateTerminal)trans.getTo()).setState(this);
+ }
+ else if (trans.getTo() instanceof SubStateTrPointTerminal) {
+ if (((SubStateTrPointTerminal)trans.getTo()).getState()==bs)
+ ((SubStateTrPointTerminal)trans.getTo()).setState(this);
+ }
+ if (trans instanceof NonInitialTransition) {
+ if (((NonInitialTransition)trans).getFrom() instanceof StateTerminal) {
+ if (((StateTerminal)((NonInitialTransition)trans).getFrom()).getState()==bs)
+ ((StateTerminal)((NonInitialTransition)trans).getFrom()).setState(this);
+ }
+ else if (((NonInitialTransition)trans).getFrom() instanceof SubStateTrPointTerminal) {
+ if (((SubStateTrPointTerminal)((NonInitialTransition)trans).getFrom()).getState()==bs)
+ ((SubStateTrPointTerminal)((NonInitialTransition)trans).getFrom()).setState(this);
+ }
+ }
+ }
+
+ // move contents of base state to this state
+ StateGraph fromSG = bs.getSubgraph();
+ if (fromSG!=null) {
+ StateGraph toSG = getSubgraph();
+ if (toSG==null) {
+ toSG = RoomFactory.eINSTANCE.createStateGraph();
+ setSubgraph(toSG);
+ }
+ toSG.getChPoints().addAll(fromSG.getChPoints());
+ toSG.getStates().addAll(fromSG.getStates());
+ toSG.getTrPoints().addAll(fromSG.getTrPoints());
+ toSG.getTransitions().addAll(fromSG.getTransitions());
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_ENTRY:
+ return getInheritedEntry();
+ case ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_EXIT:
+ return getInheritedExit();
+ case ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_DO:
+ return getInheritedDo();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_ENTRY:
+ setInheritedEntry((String)newValue);
+ return;
+ case ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_EXIT:
+ setInheritedExit((String)newValue);
+ return;
+ case ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_DO:
+ setInheritedDo((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_ENTRY:
+ setInheritedEntry(INHERITED_ENTRY_EDEFAULT);
+ return;
+ case ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_EXIT:
+ setInheritedExit(INHERITED_EXIT_EDEFAULT);
+ return;
+ case ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_DO:
+ setInheritedDo(INHERITED_DO_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_ENTRY:
+ return INHERITED_ENTRY_EDEFAULT == null ? inheritedEntry != null : !INHERITED_ENTRY_EDEFAULT.equals(inheritedEntry);
+ case ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_EXIT:
+ return INHERITED_EXIT_EDEFAULT == null ? inheritedExit != null : !INHERITED_EXIT_EDEFAULT.equals(inheritedExit);
+ case ETriceGenPackage.EXPANDED_REFINED_STATE__INHERITED_DO:
+ return INHERITED_DO_EDEFAULT == null ? inheritedDo != null : !INHERITED_DO_EDEFAULT.equals(inheritedDo);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (inheritedEntry: ");
+ result.append(inheritedEntry);
+ result.append(", inheritedExit: ");
+ result.append(inheritedExit);
+ result.append(", inheritedDo: ");
+ result.append(inheritedDo);
+ result.append(')');
+ return result.toString();
+ }
+
+} //ExpandedRefinedStateImpl
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java
index 826b0dec7..b2fe47bd9 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java
@@ -32,6 +32,7 @@ import org.eclipse.etrice.core.room.SubStateTrPointTerminal;
import org.eclipse.etrice.core.room.TrPoint;
import org.eclipse.etrice.core.room.TrPointTerminal;
import org.eclipse.etrice.core.room.Transition;
+import org.eclipse.etrice.core.room.VarDecl;
import org.eclipse.etrice.core.room.TransitionChainStartTransition;
import org.eclipse.etrice.core.room.TransitionPoint;
@@ -44,6 +45,7 @@ import org.eclipse.etrice.core.room.TransitionPoint;
* <ul>
* <li>{@link org.eclipse.etrice.core.genmodel.etricegen.impl.TransitionChainImpl#getTransition <em>Transition</em>}</li>
* <li>{@link org.eclipse.etrice.core.genmodel.etricegen.impl.TransitionChainImpl#isSkipEntry <em>Skip Entry</em>}</li>
+ * <li>{@link org.eclipse.etrice.core.genmodel.etricegen.impl.TransitionChainImpl#getData <em>Data</em>}</li>
* </ul>
* </p>
*
@@ -81,6 +83,16 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
protected boolean skipEntry = SKIP_ENTRY_EDEFAULT;
/**
+ * The cached value of the '{@link #getData() <em>Data</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getData()
+ * @generated
+ * @ordered
+ */
+ protected VarDecl data;
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
@@ -161,6 +173,44 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ * @generated
+ */
+ public VarDecl getData() {
+ if (data != null && data.eIsProxy()) {
+ InternalEObject oldData = (InternalEObject)data;
+ data = (VarDecl)eResolveProxy(oldData);
+ if (data != oldData) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, ETriceGenPackage.TRANSITION_CHAIN__DATA, oldData, data));
+ }
+ }
+ return data;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public VarDecl basicGetData() {
+ return data;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setData(VarDecl newData) {
+ VarDecl oldData = data;
+ data = newData;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, ETriceGenPackage.TRANSITION_CHAIN__DATA, oldData, data));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @generated NOT
*/
public State getStateContext() {
@@ -201,7 +251,7 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
ExpandedActorClass ac = getExpandedActorClass();
StringBuilder result = new StringBuilder();
- result.append(tcv.genTypedData());
+ result.append(tcv.genTypedData(this));
genChainCode(getTransition(), ac, tcv, result);
return result.toString();
}
@@ -300,6 +350,9 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
return basicGetTransition();
case ETriceGenPackage.TRANSITION_CHAIN__SKIP_ENTRY:
return isSkipEntry();
+ case ETriceGenPackage.TRANSITION_CHAIN__DATA:
+ if (resolve) return getData();
+ return basicGetData();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -318,6 +371,9 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
case ETriceGenPackage.TRANSITION_CHAIN__SKIP_ENTRY:
setSkipEntry((Boolean)newValue);
return;
+ case ETriceGenPackage.TRANSITION_CHAIN__DATA:
+ setData((VarDecl)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -336,6 +392,9 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
case ETriceGenPackage.TRANSITION_CHAIN__SKIP_ENTRY:
setSkipEntry(SKIP_ENTRY_EDEFAULT);
return;
+ case ETriceGenPackage.TRANSITION_CHAIN__DATA:
+ setData((VarDecl)null);
+ return;
}
super.eUnset(featureID);
}
@@ -352,6 +411,8 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
return transition != null;
case ETriceGenPackage.TRANSITION_CHAIN__SKIP_ENTRY:
return skipEntry != SKIP_ENTRY_EDEFAULT;
+ case ETriceGenPackage.TRANSITION_CHAIN__DATA:
+ return data != null;
}
return super.eIsSet(featureID);
}
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenAdapterFactory.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenAdapterFactory.java
index 01811d86c..356ede60e 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenAdapterFactory.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenAdapterFactory.java
@@ -10,13 +10,13 @@ import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.genmodel.etricegen.*;
import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger;
import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
import org.eclipse.etrice.core.genmodel.etricegen.BindingInstance;
import org.eclipse.etrice.core.genmodel.etricegen.ConnectionInstance;
import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState;
import org.eclipse.etrice.core.genmodel.etricegen.IDiagnostician;
import org.eclipse.etrice.core.genmodel.etricegen.ITransitionChainVisitor;
import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
@@ -29,6 +29,10 @@ import org.eclipse.etrice.core.genmodel.etricegen.ServiceImplInstance;
import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance;
import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
+import org.eclipse.etrice.core.room.SimpleState;
+import org.eclipse.etrice.core.room.State;
+import org.eclipse.etrice.core.room.StateGraphItem;
+import org.eclipse.etrice.core.room.StateGraphNode;
/**
* <!-- begin-user-doc -->
@@ -155,6 +159,26 @@ public class ETriceGenAdapterFactory extends AdapterFactoryImpl {
return createExpandedActorClassAdapter();
}
@Override
+ public Adapter caseExpandedRefinedState(ExpandedRefinedState object) {
+ return createExpandedRefinedStateAdapter();
+ }
+ @Override
+ public Adapter caseStateGraphItem(StateGraphItem object) {
+ return createStateGraphItemAdapter();
+ }
+ @Override
+ public Adapter caseStateGraphNode(StateGraphNode object) {
+ return createStateGraphNodeAdapter();
+ }
+ @Override
+ public Adapter caseState(State object) {
+ return createStateAdapter();
+ }
+ @Override
+ public Adapter caseSimpleState(SimpleState object) {
+ return createSimpleStateAdapter();
+ }
+ @Override
public Adapter defaultCase(EObject object) {
return createEObjectAdapter();
}
@@ -413,6 +437,76 @@ public class ETriceGenAdapterFactory extends AdapterFactoryImpl {
}
/**
+ * Creates a new adapter for an object of class '{@link org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState <em>Expanded Refined State</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState
+ * @generated
+ */
+ public Adapter createExpandedRefinedStateAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.etrice.core.room.StateGraphItem <em>State Graph Item</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.etrice.core.room.StateGraphItem
+ * @generated
+ */
+ public Adapter createStateGraphItemAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.etrice.core.room.StateGraphNode <em>State Graph Node</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.etrice.core.room.StateGraphNode
+ * @generated
+ */
+ public Adapter createStateGraphNodeAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.etrice.core.room.State <em>State</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.etrice.core.room.State
+ * @generated
+ */
+ public Adapter createStateAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.etrice.core.room.SimpleState <em>Simple State</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.etrice.core.room.SimpleState
+ * @generated
+ */
+ public Adapter createSimpleStateAdapter() {
+ return null;
+ }
+
+ /**
* Creates a new adapter for the default case.
* <!-- begin-user-doc -->
* This default implementation returns null.
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenSwitch.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenSwitch.java
index 82bc99dc7..32460d46d 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenSwitch.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenSwitch.java
@@ -9,13 +9,13 @@ package org.eclipse.etrice.core.genmodel.etricegen.util;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.Switch;
-import org.eclipse.etrice.core.genmodel.etricegen.*;
import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger;
import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
import org.eclipse.etrice.core.genmodel.etricegen.BindingInstance;
import org.eclipse.etrice.core.genmodel.etricegen.ConnectionInstance;
import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState;
import org.eclipse.etrice.core.genmodel.etricegen.IDiagnostician;
import org.eclipse.etrice.core.genmodel.etricegen.ITransitionChainVisitor;
import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
@@ -28,6 +28,10 @@ import org.eclipse.etrice.core.genmodel.etricegen.ServiceImplInstance;
import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance;
import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
+import org.eclipse.etrice.core.room.SimpleState;
+import org.eclipse.etrice.core.room.State;
+import org.eclipse.etrice.core.room.StateGraphItem;
+import org.eclipse.etrice.core.room.StateGraphNode;
/**
* <!-- begin-user-doc -->
@@ -189,6 +193,16 @@ public class ETriceGenSwitch<T> extends Switch<T> {
if (result == null) result = defaultCase(theEObject);
return result;
}
+ case ETriceGenPackage.EXPANDED_REFINED_STATE: {
+ ExpandedRefinedState expandedRefinedState = (ExpandedRefinedState)theEObject;
+ T result = caseExpandedRefinedState(expandedRefinedState);
+ if (result == null) result = caseSimpleState(expandedRefinedState);
+ if (result == null) result = caseState(expandedRefinedState);
+ if (result == null) result = caseStateGraphNode(expandedRefinedState);
+ if (result == null) result = caseStateGraphItem(expandedRefinedState);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
default: return defaultCase(theEObject);
}
}
@@ -449,6 +463,81 @@ public class ETriceGenSwitch<T> extends Switch<T> {
}
/**
+ * Returns the result of interpreting the object as an instance of '<em>Expanded Refined State</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Expanded Refined State</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseExpandedRefinedState(ExpandedRefinedState object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>State Graph Item</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>State Graph Item</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseStateGraphItem(StateGraphItem object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>State Graph Node</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>State Graph Node</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseStateGraphNode(StateGraphNode object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>State</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>State</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseState(State object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Simple State</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Simple State</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseSimpleState(SimpleState object) {
+ return null;
+ }
+
+ /**
* Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/quickfix/IRoomQuickfixProvider.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/quickfix/IRoomQuickfixProvider.java
index decbbb840..077a7bfaa 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/quickfix/IRoomQuickfixProvider.java
+++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/quickfix/IRoomQuickfixProvider.java
@@ -1,8 +1,5 @@
package org.eclipse.etrice.core.ui.quickfix;
-import java.util.List;
-
-import org.eclipse.xtext.ui.editor.quickfix.IssueResolution;
import org.eclipse.xtext.ui.editor.quickfix.IssueResolutionAcceptor;
import org.eclipse.xtext.validation.Issue;
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java
index 99ac54bb5..571c0d163 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java
@@ -733,16 +733,6 @@ public class ValidationUtil {
if (((SubStateTrPointTerminal) tgt).getTrPoint() instanceof ExitPoint)
return Result.error("sub state exit point can not be transition target", tgt, RoomPackage.eINSTANCE.getSubStateTrPointTerminal_TrPoint(), 0);
// sub state EntryPoint is valid as destination
- for (Transition t : sg.getTransitions()) {
- if (t==trans)
- continue;
-
- if (t.getTo() instanceof SubStateTrPointTerminal) {
- SubStateTrPointTerminal tpt = (SubStateTrPointTerminal)t.getTo();
- if (tpt.getTrPoint()==((SubStateTrPointTerminal) tgt).getTrPoint())
- return Result.error("target transition point already is connected", tgt, RoomPackage.eINSTANCE.getSubStateTrPointTerminal_TrPoint(), 0);
- }
- }
}
return Result.ok();
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
index 482e18916..e4afca200 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
@@ -36,7 +36,7 @@ class CExtensions implements ILanguageExtension {
override String getTypedDataDefinition(Message m) {
- return chainGenerator.generateTypedData(m)
+ return chainGenerator.generateTypedData(m.data)
}
// in C no access levels can be defined
@@ -150,4 +150,7 @@ class CExtensions implements ILanguageExtension {
"\"" + s + "\"";
}
+ override String superCall(String baseClassName, String method, String args) {
+ ""
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CLanguageGenerator.java b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CLanguageGenerator.java
index 23aa154b4..f7fcbe96d 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CLanguageGenerator.java
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CLanguageGenerator.java
@@ -6,7 +6,7 @@ import org.eclipse.etrice.generator.generic.AbstractTransitionChainGenerator;
public class CLanguageGenerator extends AbstractTransitionChainGenerator {
- protected String[] generateArglistAndTypedData(VarDecl data) {
+ public String[] generateArglistAndTypedData(VarDecl data) {
if (data==null)
return new String[] {"", "", ""};
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java
index 2e246cb36..a6234c72c 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java
@@ -5,6 +5,7 @@ import com.google.inject.Singleton;
import java.util.List;
import org.eclipse.etrice.core.room.Message;
import org.eclipse.etrice.core.room.RoomClass;
+import org.eclipse.etrice.core.room.VarDecl;
import org.eclipse.etrice.generator.generic.AbstractTransitionChainGenerator;
import org.eclipse.etrice.generator.generic.ILanguageExtension;
import org.eclipse.xtext.util.Pair;
@@ -18,7 +19,8 @@ public class CExtensions implements ILanguageExtension {
private AbstractTransitionChainGenerator chainGenerator;
public String getTypedDataDefinition(final Message m) {
- String _generateTypedData = this.chainGenerator.generateTypedData(m);
+ VarDecl _data = m.getData();
+ String _generateTypedData = this.chainGenerator.generateTypedData(_data);
return _generateTypedData;
}
@@ -239,4 +241,8 @@ public class CExtensions implements ILanguageExtension {
String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, "\"");
return _operator_plus_1;
}
+
+ public String superCall(final String baseClassName, final String method, final String args) {
+ return "";
+ }
}
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend
index 751ffe8f9..526943ad5 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend
@@ -34,7 +34,7 @@ class JavaExtensions implements ILanguageExtension {
override String getTypedDataDefinition(Message m) {
- return chainGenerator.generateTypedData(m)
+ return chainGenerator.generateTypedData(m.data)
}
@@ -98,4 +98,7 @@ class JavaExtensions implements ILanguageExtension {
override String toCharArrayExpr(String s){
"\"" + s + "\".toCharArray()"
}
+ override String superCall(String baseClassName, String method, String args) {
+ "super."+method+"("+args+");"
+ }
}
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaLanguageGenerator.java b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaLanguageGenerator.java
index 89223d5bf..670788c6e 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaLanguageGenerator.java
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaLanguageGenerator.java
@@ -7,7 +7,7 @@ import org.eclipse.etrice.generator.generic.AbstractTransitionChainGenerator;
public class JavaLanguageGenerator extends AbstractTransitionChainGenerator {
@Override
- protected String[] generateArglistAndTypedData(VarDecl data) {
+ public String[] generateArglistAndTypedData(VarDecl data) {
if (data==null)
return new String[] {"", "", ""};
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java
index 18695aa27..79231f74f 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java
@@ -5,6 +5,7 @@ import com.google.inject.Singleton;
import java.util.List;
import org.eclipse.etrice.core.room.Message;
import org.eclipse.etrice.core.room.RoomClass;
+import org.eclipse.etrice.core.room.VarDecl;
import org.eclipse.etrice.generator.generic.AbstractTransitionChainGenerator;
import org.eclipse.etrice.generator.generic.ILanguageExtension;
import org.eclipse.xtext.util.Pair;
@@ -18,7 +19,8 @@ public class JavaExtensions implements ILanguageExtension {
private AbstractTransitionChainGenerator chainGenerator;
public String getTypedDataDefinition(final Message m) {
- String _generateTypedData = this.chainGenerator.generateTypedData(m);
+ VarDecl _data = m.getData();
+ String _generateTypedData = this.chainGenerator.generateTypedData(_data);
return _generateTypedData;
}
@@ -134,4 +136,12 @@ public class JavaExtensions implements ILanguageExtension {
String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, "\".toCharArray()");
return _operator_plus_1;
}
+
+ public String superCall(final String baseClassName, final String method, final String args) {
+ String _operator_plus = StringExtensions.operator_plus("super.", method);
+ String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, "(");
+ String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, args);
+ String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, ");");
+ return _operator_plus_3;
+ }
}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java
index f3ec3c502..188c675e0 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java
@@ -16,17 +16,23 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.etrice.core.ConfigStandaloneSetup;
+import org.eclipse.etrice.core.room.DataClass;
+import org.eclipse.etrice.core.room.DetailCode;
+import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.RoomModel;
import org.eclipse.etrice.core.scoping.PlatformRelativeUriResolver;
import org.eclipse.etrice.core.genmodel.builder.GeneratorModelBuilder;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.genmodel.etricegen.IDiagnostician;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
import org.eclipse.xtext.diagnostics.Severity;
@@ -52,6 +58,12 @@ public abstract class AbstractGenerator {
public static final int GENERATOR_ERROR = 1;
private static boolean terminateOnError = true;
+ private static AbstractGenerator instance = null;
+
+ protected static ILineOutput output = new StdLineOutput();
+ private static Injector injector;
+
+ private HashMap<DetailCode, String> detailcode2string = new HashMap<DetailCode, String>();
public static void setTerminateOnError(boolean terminateOnError) {
AbstractGenerator.terminateOnError = terminateOnError;
@@ -61,14 +73,18 @@ public abstract class AbstractGenerator {
return terminateOnError;
}
- protected static ILineOutput output = new StdLineOutput();
- private static Injector injector;
-
public static void setOutput(ILineOutput out) {
if (out!=null)
output = out;
}
+ public static AbstractGenerator getInstance() {
+ return instance;
+ }
+
+ protected AbstractGenerator() {
+ instance = this;
+ }
/**
* creates an instance of the generator and invokes the {@link #runGenerator(String[])} method
@@ -100,6 +116,9 @@ public abstract class AbstractGenerator {
@Inject
protected PlatformRelativeUriResolver uriResolver;
+ @Inject
+ protected ITranslationProvider translationProvider;
+
protected IResourceValidator validator;
/**
@@ -147,6 +166,9 @@ public abstract class AbstractGenerator {
logger.logError("-- terminating", null);
return null;
}
+
+ translateDetailCodes(gmRoot);
+
URI genModelURI = genModelPath!=null? URI.createFileURI(genModelPath) : URI.createFileURI("tmp.rim");
Resource genResource = rs.createResource(genModelURI);
genResource.getContents().add(gmRoot);
@@ -240,6 +262,65 @@ public abstract class AbstractGenerator {
}
/**
+ * create detail code translations once and for all
+ * @param gmRoot
+ */
+ protected void translateDetailCodes(Root gmRoot) {
+ for (ExpandedActorClass xpac : gmRoot.getXpActorClasses()) {
+ DetailCodeTranslator dct = new DetailCodeTranslator(xpac.getActorClass(), translationProvider);
+ translateDetailCodesOfTree(xpac.getActorClass(), dct);
+ translateDetailCodesOfTree(xpac.getStateMachine(), dct);
+ }
+
+ for (DataClass dc : gmRoot.getUsedDataClasses()) {
+ DetailCodeTranslator dct = new DetailCodeTranslator(dc, translationProvider);
+ translateDetailCodesOfTree(dc, dct);
+ }
+
+ for (ProtocolClass pc : gmRoot.getUsedProtocolClasses()) {
+ if (pc.getConjugate()!=null) {
+ DetailCodeTranslator dct = new DetailCodeTranslator(pc.getConjugate(), translationProvider);
+ translateDetailCodesOfTree(pc.getConjugate(), dct);
+ }
+ if (pc.getRegular()!=null) {
+ DetailCodeTranslator dct = new DetailCodeTranslator(pc.getRegular(), translationProvider);
+ translateDetailCodesOfTree(pc.getRegular(), dct);
+ }
+
+ DetailCodeTranslator dct = new DetailCodeTranslator(pc, translationProvider);
+ translateDetailCodesOfTree(pc.getUserCode1(), dct);
+ translateDetailCodesOfTree(pc.getUserCode2(), dct);
+ translateDetailCodesOfTree(pc.getUserCode3(), dct);
+ }
+ }
+
+ protected void translateDetailCodesOfTree(EObject container, DetailCodeTranslator dct) {
+ if (container==null)
+ return;
+ if (container instanceof DetailCode) {
+ DetailCode dc = (DetailCode) container;
+ detailcode2string.put(dc, dct.translateDetailCode(dc));
+ return;
+ }
+
+ TreeIterator<EObject> it = container.eAllContents();
+ while (it.hasNext()) {
+ EObject obj = it.next();
+ if (obj instanceof DetailCode) {
+ DetailCode dc = (DetailCode) obj;
+ detailcode2string.put(dc, dct.translateDetailCode(dc));
+ }
+ }
+ }
+
+ public String getTranslatedCode(DetailCode dc) {
+ String code = detailcode2string.get(dc);
+ if (code==null)
+ return "";
+ return code;
+ }
+
+ /**
* abstract method which is finally called by {@link #createAndRunGenerator(Module, String[])}
* @param args
* @return GENERATOR_OK or GENERATOR_ERROR
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java
index 8cbbcc90a..cd2793766 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java
@@ -16,12 +16,16 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Attribute;
+import org.eclipse.etrice.core.room.DataClass;
import org.eclipse.etrice.core.room.DetailCode;
import org.eclipse.etrice.core.room.InterfaceItem;
import org.eclipse.etrice.core.room.Message;
import org.eclipse.etrice.core.room.Operation;
+import org.eclipse.etrice.core.room.PortClass;
+import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.util.RoomHelpers;
/**
@@ -34,22 +38,35 @@ public class DetailCodeTranslator {
int pos = 0;
}
- private ActorClass ac;
private ITranslationProvider provider;
- private HashMap<String, InterfaceItem> name2item;
- private HashMap<String, Attribute> name2attr;
- private HashMap<String, Operation> name2op;
+ private HashMap<String, InterfaceItem> name2item = new HashMap<String, InterfaceItem>();
+ private HashMap<String, Attribute> name2attr = new HashMap<String, Attribute>();
+ private HashMap<String, Operation> name2op = new HashMap<String, Operation>();
public DetailCodeTranslator(ActorClass ac, ITranslationProvider provider) {
- this.ac = ac;
+ this((EObject) ac, provider);
+ }
+
+ public DetailCodeTranslator(ProtocolClass pc, ITranslationProvider provider) {
+ this((EObject) pc, provider);
+ }
+
+ public DetailCodeTranslator(PortClass pc, ITranslationProvider provider) {
+ this((EObject) pc, provider);
+ }
+
+ public DetailCodeTranslator(DataClass dc, ITranslationProvider provider) {
+ this((EObject) dc, provider);
+ }
+
+ private DetailCodeTranslator(EObject container, ITranslationProvider provider) {
this.provider = provider;
-
- prepare();
+ prepare(container);
}
public String translateDetailCode(DetailCode code) {
if (code==null)
- return null;
+ return "";
// concatenate lines
StringBuilder text = new StringBuilder();
@@ -357,24 +374,39 @@ public class DetailCodeTranslator {
return Character.isDigit(c) || Character.isLetter(c) || c=='_';
}
- private void prepare() {
- name2item = new HashMap<String, InterfaceItem>();
- List<InterfaceItem> items = RoomHelpers.getAllInterfaceItems(ac);
- for (InterfaceItem item : items) {
- name2item.put(item.getName(), item);
- }
+ private void prepare(EObject container) {
+ if (container instanceof ActorClass) {
+ ActorClass ac = (ActorClass) container;
- name2attr = new HashMap<String, Attribute>();
- List<Attribute> attributes = RoomHelpers.getAllAttributes(ac);
- for (Attribute attribute : attributes) {
- name2attr.put(attribute.getName(), attribute);
+ List<InterfaceItem> items = RoomHelpers.getAllInterfaceItems(ac);
+ for (InterfaceItem item : items) {
+ name2item.put(item.getName(), item);
+ }
}
+
+ List<Attribute> attributes = null;
+ if (container instanceof ActorClass)
+ attributes = RoomHelpers.getAllAttributes((ActorClass) container);
+ else if (container instanceof DataClass)
+ attributes = RoomHelpers.getAllAttributes((DataClass) container);
+ else if (container instanceof PortClass)
+ attributes = ((PortClass) container).getAttributes();
+ if (attributes!=null)
+ for (Attribute attribute : attributes) {
+ name2attr.put(attribute.getName(), attribute);
+ }
- name2op = new HashMap<String, Operation>();
- List<Operation> operations = RoomHelpers.getAllOperations(ac);
- for (Operation operation : operations) {
- name2op.put(operation.getName(), operation);
- }
+ List<? extends Operation> operations = null;
+ if (container instanceof ActorClass)
+ operations = RoomHelpers.getAllOperations((ActorClass) container);
+ else if (container instanceof DataClass)
+ operations = RoomHelpers.getAllOperations((DataClass) container);
+ else if (container instanceof PortClass)
+ operations = ((PortClass) container).getOperations();
+ if (operations!=null)
+ for (Operation operation : operations) {
+ name2op.put(operation.getName(), operation);
+ }
}
private String translateTags(String text, DetailCode code) {
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/AbstractTransitionChainGenerator.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/AbstractTransitionChainGenerator.java
index 4b2a84d1b..293b2a711 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/AbstractTransitionChainGenerator.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/AbstractTransitionChainGenerator.java
@@ -15,35 +15,22 @@ package org.eclipse.etrice.generator.generic;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
import org.eclipse.etrice.core.room.InitialTransition;
-import org.eclipse.etrice.core.room.Message;
-import org.eclipse.etrice.core.room.MessageFromIf;
import org.eclipse.etrice.core.room.Transition;
-import org.eclipse.etrice.core.room.Trigger;
import org.eclipse.etrice.core.room.TriggeredTransition;
import org.eclipse.etrice.core.room.VarDecl;
import org.eclipse.etrice.generator.base.AbstractGenerator;
-import org.eclipse.etrice.generator.base.DetailCodeTranslator;
/**
* base class for
* @author Henrik Rentz-Reichert
*
*/
-public abstract class AbstractTransitionChainGenerator {
+public abstract class AbstractTransitionChainGenerator implements ITypedDataProvider {
- public String generateExecuteChain(ExpandedActorClass ac, TransitionChain tc, DetailCodeTranslator dct) {
- TransitionChainVisitor tcv = new TransitionChainVisitor(dct);
+ public String generateExecuteChain(ExpandedActorClass ac, TransitionChain tc) {
+ TransitionChainVisitor tcv = new TransitionChainVisitor(ac, this);
AbstractGenerator.getInjector().injectMembers(tcv);
-
- String dataArg = "";
- String typedData = "";
- if (tc.getTransition() instanceof TriggeredTransition) {
- VarDecl data = ((TriggeredTransition)tc.getTransition()).getTriggers().get(0).getMsgFromIfPairs().get(0).getMessage().getData();
- String[] result = generateArglistAndTypedData(data);
- dataArg = result[0];
- typedData = result[1];
- }
- tcv.init(tc, dataArg, typedData);
+ tcv.init(tc);
return tc.genExecuteChain(tcv);
}
@@ -57,34 +44,18 @@ public abstract class AbstractTransitionChainGenerator {
if (!(chain.getTransition() instanceof TriggeredTransition))
return "";
- Trigger trigger = ((TriggeredTransition)chain.getTransition()).getTriggers().get(0);
- MessageFromIf mif = trigger.getMsgFromIfPairs().get(0);
-
- return generateTypedArgumentList(mif.getMessage());
+ return generateTypedArgumentList(xpac.getData(t));
}
- public String generateArgumentList(Message m) {
- return generateArglistAndTypedData(m.getData())[0];
+ public String generateArgumentList(VarDecl data) {
+ return generateArglistAndTypedData(data)[0];
}
- public String generateTypedData(Message m) {
- return generateArglistAndTypedData(m.getData())[1];
+ public String generateTypedData(VarDecl data) {
+ return generateArglistAndTypedData(data)[1];
}
- public String generateTypedArgumentList(Message m) {
- return generateArglistAndTypedData(m.getData())[2];
+ public String generateTypedArgumentList(VarDecl data) {
+ return generateArglistAndTypedData(data)[2];
}
-
- /**
- * return three strings used by the generator
- *
- * @param data the variable declaration
- * @return an array of three strings
- * <ol>
- * <li>the string that performs the cast from generic_data to the correct type and assigns it to a new variabley</li>
- * <li>the data as it appears in a method call</li>
- * <li>the data as it is used in the method declaration</li>
- * </ol>
- */
- protected abstract String[] generateArglistAndTypedData(VarDecl data);
}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend
index e77d2e783..beeeba29f 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend
@@ -23,11 +23,11 @@ import org.eclipse.etrice.core.room.GuardedTransition
import org.eclipse.etrice.core.room.TriggeredTransition
import org.eclipse.etrice.core.room.NonInitialTransition
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState
import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger
import org.eclipse.etrice.generator.generic.RoomExtensions
-import org.eclipse.etrice.generator.base.DetailCodeTranslator
-import org.eclipse.etrice.generator.base.ITranslationProvider
import static extension org.eclipse.etrice.generator.base.CodegenHelpers.*
+import org.eclipse.etrice.generator.base.AbstractGenerator
import org.eclipse.xtext.util.Pair
import static org.eclipse.xtext.util.Tuples.*
@@ -37,7 +37,6 @@ class GenericStateMachineGenerator {
@Inject protected extension RoomExtensions roomExt
@Inject protected extension GenericProtocolClassGenerator pcGen
@Inject protected extension org.eclipse.etrice.generator.generic.AbstractTransitionChainGenerator languageGen
- @Inject protected ITranslationProvider translator
def private genStateIdConstants(ExpandedActorClass xpac, ActorClass ac) {
// with inheritance we exclude inherited base states
@@ -90,8 +89,6 @@ class GenericStateMachineGenerator {
}
def genStateMachine(ExpandedActorClass xpac, ActorClass ac) {
- translator.setActorClass(ac)
- var dct = new DetailCodeTranslator(ac, translator)
var async = ac.commType==ActorCommunicationType::ASYNCHRONOUS
var eventDriven = ac.commType==ActorCommunicationType::EVENT_DRIVEN
var dataDriven = ac.commType==ActorCommunicationType::DATA_DRIVEN
@@ -113,21 +110,7 @@ class GenericStateMachineGenerator {
/* Entry and Exit Codes */
«FOR state : xpac.stateMachine.getStateList()»
«IF !langExt.usesInheritance || xpac.isOwnObject(state)»
- «IF state.hasEntryCode()»
- «langExt.accessLevelProtected»void «state.getEntryCodeOperationName()»(«langExt.selfPointer(ac.name, false)») {
- «xpac.getEntryCode(state, dct)»
- }
- «ENDIF»
- «IF state.hasExitCode()»
- «langExt.accessLevelProtected»void «state.getExitCodeOperationName()»(«langExt.selfPointer(ac.name, false)») {
- «xpac.getExitCode(state, dct)»
- }
- «ENDIF»
- «IF state.hasDoCode()»
- static void «state.getDoCodeOperationName()»(«langExt.selfPointer(ac.name, false)») {
- «xpac.getDoCode(state, dct)»
- }
- «ENDIF»
+ «xpac.genActionCodeMethods(state)»
«ENDIF»
«ENDFOR»
@@ -137,7 +120,7 @@ class GenericStateMachineGenerator {
«var start = xpac.getChain(tr).transition»
«var hasArgs = start instanceof NonInitialTransition && !(start instanceof GuardedTransition)»
«langExt.accessLevelProtected»void «tr.getActionCodeOperationName()»(«langExt.selfPointer(ac.name, hasArgs)»«IF hasArgs»InterfaceItemBase ifitem«languageGen.generateArgumentList(xpac, tr)»«ENDIF») {
- «xpac.getActionCode(tr, dct)»
+ «AbstractGenerator::getInstance().getTranslatedCode(tr.action)»
}
«ENDIF»
«ENDFOR»
@@ -176,7 +159,7 @@ class GenericStateMachineGenerator {
«FOR tc : allchains»
case «tc.getChainId()»:
{
- «xpac.generateExecuteChain(tc, dct)»
+ «xpac.generateExecuteChain(tc)»
}
«ENDFOR»
}
@@ -247,10 +230,10 @@ class GenericStateMachineGenerator {
«IF handleEvents»
if (!handleSystemEvent(ifitem, evt, generic_data)) {
- «genStateSwitch(xpac, dct)»
+ «genStateSwitch(xpac)»
}
«ELSE»
- «genStateSwitch(xpac, dct)»
+ «genStateSwitch(xpac)»
«ENDIF»
if (chain != NOT_CAUGHT) {
exitTo(«langExt.selfPointer(true)»«langExt.memberAccess»state, catching_state, is_handler);
@@ -265,7 +248,7 @@ class GenericStateMachineGenerator {
//******************************************
'''}
- def private genStateSwitch(ExpandedActorClass xpac, DetailCodeTranslator dct) {
+ def private genStateSwitch(ExpandedActorClass xpac) {
var async = xpac.actorClass.commType==ActorCommunicationType::ASYNCHRONOUS
var eventDriven = xpac.actorClass.commType==ActorCommunicationType::EVENT_DRIVEN
var dataDriven = xpac.actorClass.commType==ActorCommunicationType::DATA_DRIVEN
@@ -279,20 +262,20 @@ class GenericStateMachineGenerator {
«IF !atlist.isEmpty»
switch(trigger) {
case POLLING:
- «genDataDrivenTriggers(xpac, state, dct)»
+ «genDataDrivenTriggers(xpac, state)»
break;
- «genEventDrivenTriggers(xpac, state, atlist, dct)»
+ «genEventDrivenTriggers(xpac, state, atlist)»
}
«ELSE»
- «genDataDrivenTriggers(xpac, state, dct)»
+ «genDataDrivenTriggers(xpac, state)»
«ENDIF»
«ELSEIF dataDriven»
- «genDataDrivenTriggers(xpac, state, dct)»
+ «genDataDrivenTriggers(xpac, state)»
«ELSEIF eventDriven»
«var atlist = xpac.getActiveTriggers(state)»
«IF !atlist.isEmpty»
switch(trigger) {
- «genEventDrivenTriggers(xpac, state, atlist, dct)»
+ «genEventDrivenTriggers(xpac, state, atlist)»
}
«ENDIF»
«ENDIF»
@@ -302,12 +285,12 @@ class GenericStateMachineGenerator {
'''
}
- def private genDataDrivenTriggers(ExpandedActorClass xpac, State state, DetailCodeTranslator dct) {
+ def private genDataDrivenTriggers(ExpandedActorClass xpac, State state) {
'''
«genDoCodes(state)»
«var transitions = xpac.getOutgoingTransitionsHierarchical(state).filter(t|t instanceof GuardedTransition)»
«FOR tr : transitions»
- if («dct.translateDetailCode((tr as GuardedTransition).guard)»)
+ if («AbstractGenerator::getInstance().getTranslatedCode((tr as GuardedTransition).guard)»)
{
«var chain = xpac.getChain(tr)»
chain = «chain.getChainId()»;
@@ -322,7 +305,7 @@ class GenericStateMachineGenerator {
'''
}
- def private genEventDrivenTriggers(ExpandedActorClass xpac, State state, List<ActiveTrigger> atlist, DetailCodeTranslator dct) {
+ def private genEventDrivenTriggers(ExpandedActorClass xpac, State state, List<ActiveTrigger> atlist) {
'''
«FOR at : atlist»
case «xpac.getTriggerCodeName(at.trigger)»:
@@ -330,7 +313,7 @@ class GenericStateMachineGenerator {
«IF needData»{ «at.msg.getTypedDataDefinition()»«ENDIF»
«FOR tt : at.transitions SEPARATOR " else "»
«var chain = xpac.getChain(tt)»
- «guard(chain.transition, at.trigger, xpac, dct)»
+ «guard(chain.transition, at.trigger, xpac)»
{
chain = «chain.getChainId()»;
catching_state = «chain.getContextId()»;
@@ -345,16 +328,16 @@ class GenericStateMachineGenerator {
}
def genExtra(ExpandedActorClass xpac, ActorClass ac) {''''''}
- def private dispatch guard(TriggeredTransition tt, String trigger, ExpandedActorClass ac, DetailCodeTranslator dct) {
+ def private dispatch guard(TriggeredTransition tt, String trigger, ExpandedActorClass ac) {
var tr = tt.triggers.findFirst(e|ac.isMatching(e, trigger))
'''
«IF tr.hasGuard()»
- if («dct.translateDetailCode(tr.guard.guard)»)
+ if («AbstractGenerator::getInstance().getTranslatedCode(tr.guard.guard)»)
«ENDIF»
'''
}
- def private dispatch guard(Transition t, String trigger, ExpandedActorClass ac, DetailCodeTranslator dct) {
+ def private dispatch guard(Transition t, String trigger, ExpandedActorClass ac) {
'''
/* error */
'''
@@ -369,4 +352,50 @@ class GenericStateMachineGenerator {
«ENDIF»
'''}
+ def private genActionCodeMethods(ExpandedActorClass xpac, State state) {
+ val selfPtr = langExt.selfPointer(xpac.actorClass.name, false)
+ val entryOp = state.getEntryCodeOperationName()
+ val exitOp = state.getExitCodeOperationName()
+ val doOp = state.getDoCodeOperationName()
+ var entry = AbstractGenerator::getInstance().getTranslatedCode(state.entryCode)
+ var exit = AbstractGenerator::getInstance().getTranslatedCode(state.exitCode)
+ var docode = AbstractGenerator::getInstance().getTranslatedCode(state.doCode)
+ if (state instanceof ExpandedRefinedState) {
+ val rs = state as ExpandedRefinedState
+ if (langExt.usesInheritance) {
+ // we call the super method in the generated code
+ val baseName = xpac.actorClass.base.name
+ if (!rs.inheritedEntry.empty)
+ entry = langExt.superCall(baseName, entryOp, "") + entry
+ if (!rs.inheritedExit.empty)
+ exit = exit + langExt.superCall(baseName, exitOp, "")
+ if (!rs.inheritedDo.empty)
+ docode = langExt.superCall(baseName, doOp, "") + docode
+ }
+ else {
+ // the inherited code is added directly
+ entry = rs.inheritedEntry + entry
+ exit = exit + rs.inheritedExit
+ docode = rs.inheritedDo + docode
+ }
+ }
+ '''
+ «IF !entry.empty»
+ «langExt.accessLevelProtected»void «entryOp»(«selfPtr») {
+ «entry»
+ }
+ «ENDIF»
+ «IF !exit.empty»
+ «langExt.accessLevelProtected»void «exitOp»(«selfPtr») {
+ «exit»
+ }
+ «ENDIF»
+ «IF !docode.empty»
+ «langExt.accessLevelProtected» void «doOp»(«selfPtr») {
+ «docode»
+ }
+ «ENDIF»
+ '''
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ILanguageExtension.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ILanguageExtension.java
index b954ff547..a96e00f35 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ILanguageExtension.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ILanguageExtension.java
@@ -170,4 +170,12 @@ public interface ILanguageExtension {
* @return expression assignable to char array
*/
String toCharArrayExpr(String s);
+
+ /**
+ * @param baseClassName the name of the base class
+ * @param method the method to be called
+ * @param arguments the argument list
+ * @return super.method for Java, baseClassName::method for C++, empty for C
+ */
+ String superCall(String baseClassName, String method, String arguments);
} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ITypedDataProvider.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ITypedDataProvider.java
new file mode 100644
index 000000000..2d485bd0a
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ITypedDataProvider.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.generator.generic;
+
+import org.eclipse.etrice.core.room.VarDecl;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public interface ITypedDataProvider {
+
+ /**
+ * return three strings used by the generator
+ *
+ * @param data the variable declaration
+ * @return an array of three strings
+ * <ol>
+ * <li>the string that performs the cast from generic_data to the correct type and assigns it to a new variabley</li>
+ * <li>the data as it appears in a method call</li>
+ * <li>the data as it is used in the method declaration</li>
+ * </ol>
+ */
+ String[] generateArglistAndTypedData(VarDecl data);
+}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend
index 3ae42ca48..ec4c12701 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend
@@ -24,9 +24,8 @@ import org.eclipse.etrice.core.room.VarDecl
import org.eclipse.etrice.core.room.ComplexType
import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
-import org.eclipse.etrice.generator.base.DetailCodeTranslator
+import org.eclipse.etrice.generator.base.AbstractGenerator
import org.eclipse.etrice.core.genmodel.base.ILogger
-import org.eclipse.etrice.generator.base.ITranslationProvider
import org.eclipse.emf.common.util.EList
import org.eclipse.etrice.core.room.RefableType
@@ -35,7 +34,6 @@ import org.eclipse.etrice.core.room.RefableType
class ProcedureHelpers {
@Inject extension ILanguageExtension languageExt
- @Inject public ITranslationProvider translator
@Inject extension ConfigExtension
@Inject extension TypeHelpers
@Inject ILogger logger
@@ -197,15 +195,12 @@ class ProcedureHelpers {
}
def operationsImplementation(ActorClass ac) {
- translator.setActorClass(ac)
- var dct = new DetailCodeTranslator(ac, translator)
-
'''
/*--------------------- operations ---------------------*/
«FOR operation : ac.operations»
«IF !(languageExt.usesInheritance && operation.constructor)»
«operationSignature(operation, ac.name, false)» {
- «dct.translateDetailCode(operation.detailCode)»
+ «AbstractGenerator::getInstance().getTranslatedCode(operation.detailCode)»
}
«ENDIF»
«ENDFOR»
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend
index 57552b27d..ab59f7054 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend
@@ -14,46 +14,47 @@
collection of convenience functions for code generation
*/
-package org.eclipse.etrice.generator.generic
-
-import com.google.inject.Singleton
-import java.io.File
-import java.util.ArrayList
-import java.util.List
-import org.eclipse.emf.ecore.EObject
-import org.eclipse.etrice.core.room.ActorClass
-import org.eclipse.etrice.core.room.Attribute
-import org.eclipse.etrice.core.room.DataClass
-import org.eclipse.etrice.core.room.DetailCode
-import org.eclipse.etrice.core.room.ExternalPort
-import org.eclipse.etrice.core.room.InitialTransition
-import org.eclipse.etrice.core.room.Message
-import org.eclipse.etrice.core.room.MessageHandler
-import org.eclipse.etrice.core.room.Port
-import org.eclipse.etrice.core.room.PortClass
-import org.eclipse.etrice.core.room.ProtocolClass
-import org.eclipse.etrice.core.room.RefinedState
-import org.eclipse.etrice.core.room.SimpleState
-import org.eclipse.etrice.core.room.SAPRef
-import org.eclipse.etrice.core.room.SPPRef
-import org.eclipse.etrice.core.room.ServiceImplementation
-import org.eclipse.etrice.core.room.State
-import org.eclipse.etrice.core.room.StateGraph
-import org.eclipse.etrice.core.room.Transition
-import org.eclipse.etrice.core.room.TransitionPoint
-import org.eclipse.etrice.core.room.Trigger
-import org.eclipse.etrice.core.room.RoomClass
-import org.eclipse.etrice.core.room.RoomModel
-import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger
-import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass
-import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance
-import org.eclipse.etrice.core.genmodel.etricegen.PortInstance
-import org.eclipse.etrice.core.genmodel.etricegen.ServiceImplInstance
-import org.eclipse.etrice.core.genmodel.etricegen.SAPInstance
-import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain
-import org.eclipse.etrice.generator.base.DetailCodeTranslator
-
-import static extension org.eclipse.etrice.generator.base.CodegenHelpers.*
+package org.eclipse.etrice.generator.generic
+
+import com.google.inject.Singleton
+import java.io.File
+import java.util.ArrayList
+import java.util.List
+import org.eclipse.emf.ecore.EObject
+import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState
+import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance
+import org.eclipse.etrice.core.genmodel.etricegen.PortInstance
+import org.eclipse.etrice.core.genmodel.etricegen.SAPInstance
+import org.eclipse.etrice.core.genmodel.etricegen.ServiceImplInstance
+import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain
+import org.eclipse.etrice.core.room.ActorClass
+import org.eclipse.etrice.core.room.Attribute
+import org.eclipse.etrice.core.room.DataClass
+import org.eclipse.etrice.core.room.DetailCode
+import org.eclipse.etrice.core.room.ExternalPort
+import org.eclipse.etrice.core.room.InitialTransition
+import org.eclipse.etrice.core.room.Message
+import org.eclipse.etrice.core.room.MessageHandler
+import org.eclipse.etrice.core.room.Port
+import org.eclipse.etrice.core.room.PortClass
+import org.eclipse.etrice.core.room.ProtocolClass
+import org.eclipse.etrice.core.room.RoomClass
+import org.eclipse.etrice.core.room.RoomModel
+import org.eclipse.etrice.core.room.SAPRef
+import org.eclipse.etrice.core.room.SPPRef
+import org.eclipse.etrice.core.room.ServiceImplementation
+import org.eclipse.etrice.core.room.SimpleState
+import org.eclipse.etrice.core.room.State
+import org.eclipse.etrice.core.room.StateGraph
+import org.eclipse.etrice.core.room.Transition
+import org.eclipse.etrice.core.room.TransitionPoint
+import org.eclipse.etrice.core.room.Trigger
+
+import static org.eclipse.etrice.generator.base.CodegenHelpers.*
+
+import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
@Singleton
class RoomExtensions {
@@ -481,48 +482,42 @@ class RoomExtensions {
// TODO. in the following methods handle inheritance language independent and proper
def boolean empty(DetailCode dc) {
- dc==null || dc.commands.empty
+ dc.detailCode==""
}
-
+
def boolean hasEntryCode(State s) {
- !s.entryCode.empty
+ if (!s.entryCode.empty)
+ return true
+
+ if (s instanceof ExpandedRefinedState)
+ return !(s as ExpandedRefinedState).inheritedEntry.empty
+
+ return false
}
def boolean hasExitCode(State s) {
- !s.exitCode.empty
+ if (!s.exitCode.empty)
+ return true
+
+ if (s instanceof ExpandedRefinedState)
+ return !(s as ExpandedRefinedState).inheritedExit.empty
+
+ return false
}
def boolean hasDoCode(State s) {
- !s.doCode.empty
- }
-
- def String getEntryCode(ExpandedActorClass ac, State s, DetailCodeTranslator dct) {
- if (s instanceof RefinedState)
- getEntryCode(ac, (s as RefinedState).target, dct)+dct.translateDetailCode(s.entryCode)
- else
- dct.translateDetailCode(s.entryCode)
- }
-
- def String getExitCode(ExpandedActorClass ac, State s, DetailCodeTranslator dct) {
- if (s instanceof RefinedState)
- dct.translateDetailCode(s.exitCode)+getExitCode(ac, (s as RefinedState).target, dct)
- else
- dct.translateDetailCode(s.exitCode)
- }
-
- def String getDoCode(ExpandedActorClass ac, State s, DetailCodeTranslator dct) {
- if (s instanceof RefinedState)
- dct.translateDetailCode(s.doCode)+getDoCode(ac, (s as RefinedState).target, dct)
- else
- dct.translateDetailCode(s.doCode)
+ if (!s.doCode.empty)
+ return true
+
+ if (s instanceof ExpandedRefinedState)
+ return !(s as ExpandedRefinedState).inheritedDo.empty
+
+ return false
}
def boolean hasActionCode(Transition t) {
t.action!=null && t.action.commands.size>0
}
- def String getActionCode(ExpandedActorClass ac, Transition t, DetailCodeTranslator dct) {
- dct.translateDetailCode(t.action)
- }
def String getContextId(TransitionChain tc) {
tc.getStateContext().getStateId()
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java
index 7a590e925..c090e2952 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java
@@ -12,6 +12,7 @@
package org.eclipse.etrice.generator.generic;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.genmodel.etricegen.ITransitionChainVisitor;
import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
import org.eclipse.etrice.core.room.CPBranchTransition;
@@ -20,9 +21,8 @@ import org.eclipse.etrice.core.room.GuardedTransition;
import org.eclipse.etrice.core.room.InitialTransition;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.Transition;
-import org.eclipse.etrice.core.room.TriggeredTransition;
+import org.eclipse.etrice.generator.base.AbstractGenerator;
import org.eclipse.etrice.generator.base.CodegenHelpers;
-import org.eclipse.etrice.generator.base.DetailCodeTranslator;
import com.google.inject.Inject;
@@ -36,25 +36,19 @@ import com.google.inject.Inject;
public class TransitionChainVisitor implements ITransitionChainVisitor {
@Inject private ILanguageExtension langExt;
- private DetailCodeTranslator dct;
- private String typedData;
- private String dataArg;
+ private ExpandedActorClass xpac;
+ private ITypedDataProvider dataProvider;
private boolean dataDriven;
- protected TransitionChainVisitor(DetailCodeTranslator dct) {
- this.dct = dct;
+ protected TransitionChainVisitor(ExpandedActorClass xpac, ITypedDataProvider dataProvider) {
+ this.xpac = xpac;
+ this.dataProvider = dataProvider;
}
- protected void init(TransitionChain tc, String dataArg, String typedData) {
- this.dataArg = dataArg;
- this.typedData = typedData;
-
+ protected void init(TransitionChain tc) {
dataDriven = false;
- if (tc.getTransition() instanceof TriggeredTransition) {
- dataDriven = false;
- }
- else if (tc.getTransition() instanceof GuardedTransition) {
+ if (tc.getTransition() instanceof GuardedTransition) {
dataDriven = true;
}
else if (tc.getTransition() instanceof InitialTransition) {
@@ -65,13 +59,18 @@ public class TransitionChainVisitor implements ITransitionChainVisitor {
// ITransitionChainVisitor interface
public String genActionOperationCall(Transition tr) {
+
if (tr.getAction()!=null && !tr.getAction().getCommands().isEmpty()) {
if (tr instanceof InitialTransition)
return CodegenHelpers.getActionCodeOperationName(tr)+"("+langExt.selfPointer(false)+");\n";
else if (dataDriven)
return CodegenHelpers.getActionCodeOperationName(tr)+"("+langExt.selfPointer(false)+");\n";
- else
+ else {
+ String[] result = dataProvider.generateArglistAndTypedData(xpac.getData(tr));
+ String dataArg = result[0];
+
return CodegenHelpers.getActionCodeOperationName(tr)+"("+langExt.selfPointer(true)+"ifitem"+dataArg+");\n";
+ }
}
return "";
}
@@ -90,7 +89,7 @@ public class TransitionChainVisitor implements ITransitionChainVisitor {
if (!isFirst )
result = "}\nelse ";
- result += "if ("+dct.translateDetailCode(tr.getCondition())+") {\n";
+ result += "if ("+AbstractGenerator.getInstance().getTranslatedCode(tr.getCondition())+") {\n";
return result;
}
@@ -108,8 +107,9 @@ public class TransitionChainVisitor implements ITransitionChainVisitor {
return "return " + CodegenHelpers.getGenStateId(state) + ";";
}
- public String genTypedData() {
- return typedData;
+ public String genTypedData(TransitionChain tc) {
+ String[] result = dataProvider.generateArglistAndTypedData(tc.getData());
+ return result[1];
}
}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend
index 62aa7999d..f2f94fdd7 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend
@@ -56,6 +56,6 @@ class TypeHelpers {
}
def String getTypedDataDefinition(Message m) {
- return chainGenerator.generateTypedData(m)
+ return chainGenerator.generateTypedData(m.data)
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java
index 7a5db871a..460c57a2c 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java
@@ -7,6 +7,7 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState;
import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.ActorCommunicationType;
@@ -22,9 +23,8 @@ import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.core.room.Trigger;
import org.eclipse.etrice.core.room.TriggeredTransition;
+import org.eclipse.etrice.generator.base.AbstractGenerator;
import org.eclipse.etrice.generator.base.CodegenHelpers;
-import org.eclipse.etrice.generator.base.DetailCodeTranslator;
-import org.eclipse.etrice.generator.base.ITranslationProvider;
import org.eclipse.etrice.generator.generic.AbstractTransitionChainGenerator;
import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator;
import org.eclipse.etrice.generator.generic.ILanguageExtension;
@@ -53,9 +53,6 @@ public class GenericStateMachineGenerator {
@Inject
protected AbstractTransitionChainGenerator languageGen;
- @Inject
- protected ITranslationProvider translator;
-
private String genStateIdConstants(final ExpandedActorClass xpac, final ActorClass ac) {
int _xifexpression = (int) 0;
boolean _usesInheritance = this.langExt.usesInheritance();
@@ -179,9 +176,6 @@ public class GenericStateMachineGenerator {
public StringConcatenation genStateMachine(final ExpandedActorClass xpac, final ActorClass ac) {
StringConcatenation _xblockexpression = null;
{
- this.translator.setActorClass(ac);
- DetailCodeTranslator _detailCodeTranslator = new DetailCodeTranslator(ac, this.translator);
- DetailCodeTranslator dct = _detailCodeTranslator;
ActorCommunicationType _commType = ac.getCommType();
boolean _operator_equals = ObjectExtensions.operator_equals(_commType, ActorCommunicationType.ASYNCHRONOUS);
boolean async = _operator_equals;
@@ -239,70 +233,9 @@ public class GenericStateMachineGenerator {
_operator_or_1 = BooleanExtensions.operator_or(_operator_not, _isOwnObject);
}
if (_operator_or_1) {
- {
- boolean _hasEntryCode = this.roomExt.hasEntryCode(state);
- if (_hasEntryCode) {
- String _accessLevelProtected = this.langExt.accessLevelProtected();
- _builder.append(_accessLevelProtected, "");
- _builder.append("void ");
- String _entryCodeOperationName = CodegenHelpers.getEntryCodeOperationName(state);
- _builder.append(_entryCodeOperationName, "");
- _builder.append("(");
- String _name = ac.getName();
- String _selfPointer = this.langExt.selfPointer(_name, false);
- _builder.append(_selfPointer, "");
- _builder.append(") {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- String _entryCode = this.roomExt.getEntryCode(xpac, state, dct);
- _builder.append(_entryCode, " ");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- }
- }
- {
- boolean _hasExitCode = this.roomExt.hasExitCode(state);
- if (_hasExitCode) {
- String _accessLevelProtected_1 = this.langExt.accessLevelProtected();
- _builder.append(_accessLevelProtected_1, "");
- _builder.append("void ");
- String _exitCodeOperationName = CodegenHelpers.getExitCodeOperationName(state);
- _builder.append(_exitCodeOperationName, "");
- _builder.append("(");
- String _name_1 = ac.getName();
- String _selfPointer_1 = this.langExt.selfPointer(_name_1, false);
- _builder.append(_selfPointer_1, "");
- _builder.append(") {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- String _exitCode = this.roomExt.getExitCode(xpac, state, dct);
- _builder.append(_exitCode, " ");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- }
- }
- {
- boolean _hasDoCode = this.roomExt.hasDoCode(state);
- if (_hasDoCode) {
- _builder.append("static void ");
- String _doCodeOperationName = CodegenHelpers.getDoCodeOperationName(state);
- _builder.append(_doCodeOperationName, "");
- _builder.append("(");
- String _name_2 = ac.getName();
- String _selfPointer_2 = this.langExt.selfPointer(_name_2, false);
- _builder.append(_selfPointer_2, "");
- _builder.append(") {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- String _doCode = this.roomExt.getDoCode(xpac, state, dct);
- _builder.append(_doCode, " ");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- }
- }
+ StringConcatenation _genActionCodeMethods = this.genActionCodeMethods(xpac, state);
+ _builder.append(_genActionCodeMethods, "");
+ _builder.newLineIfNotEmpty();
}
}
}
@@ -345,15 +278,15 @@ public class GenericStateMachineGenerator {
}
boolean hasArgs = _operator_and_1;
_builder.newLineIfNotEmpty();
- String _accessLevelProtected_2 = this.langExt.accessLevelProtected();
- _builder.append(_accessLevelProtected_2, "");
+ String _accessLevelProtected = this.langExt.accessLevelProtected();
+ _builder.append(_accessLevelProtected, "");
_builder.append("void ");
String _actionCodeOperationName = CodegenHelpers.getActionCodeOperationName(tr);
_builder.append(_actionCodeOperationName, "");
_builder.append("(");
- String _name_3 = ac.getName();
- String _selfPointer_3 = this.langExt.selfPointer(_name_3, hasArgs);
- _builder.append(_selfPointer_3, "");
+ String _name = ac.getName();
+ String _selfPointer = this.langExt.selfPointer(_name, hasArgs);
+ _builder.append(_selfPointer, "");
{
if (hasArgs) {
_builder.append("InterfaceItemBase ifitem");
@@ -364,8 +297,10 @@ public class GenericStateMachineGenerator {
_builder.append(") {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- String _actionCode = this.roomExt.getActionCode(xpac, tr, dct);
- _builder.append(_actionCode, " ");
+ AbstractGenerator _instance = AbstractGenerator.getInstance();
+ DetailCode _action = tr.getAction();
+ String _translatedCode = _instance.getTranslatedCode(_action);
+ _builder.append(_translatedCode, " ");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
@@ -397,9 +332,9 @@ public class GenericStateMachineGenerator {
String _accessLevelPrivate = this.langExt.accessLevelPrivate();
_builder.append(_accessLevelPrivate, "");
_builder.append("void exitTo(");
- String _name_4 = ac.getName();
- String _selfPointer_4 = this.langExt.selfPointer(_name_4, true);
- _builder.append(_selfPointer_4, "");
+ String _name_1 = ac.getName();
+ String _selfPointer_1 = this.langExt.selfPointer(_name_1, true);
+ _builder.append(_selfPointer_1, "");
_builder.append("int current, int to, boolean handler) {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
@@ -421,14 +356,14 @@ public class GenericStateMachineGenerator {
_builder.append("\t\t\t");
_builder.append("\t");
{
- boolean _hasExitCode_1 = this.roomExt.hasExitCode(state_1);
- if (_hasExitCode_1) {
+ boolean _hasExitCode = this.roomExt.hasExitCode(state_1);
+ if (_hasExitCode) {
_builder.append("if (!handler) ");
- String _exitCodeOperationName_1 = CodegenHelpers.getExitCodeOperationName(state_1);
- _builder.append(_exitCodeOperationName_1, " ");
+ String _exitCodeOperationName = CodegenHelpers.getExitCodeOperationName(state_1);
+ _builder.append(_exitCodeOperationName, " ");
_builder.append("(");
- String _selfPointer_5 = this.langExt.selfPointer(false);
- _builder.append(_selfPointer_5, " ");
+ String _selfPointer_2 = this.langExt.selfPointer(false);
+ _builder.append(_selfPointer_2, " ");
_builder.append(");");
}
}
@@ -490,9 +425,9 @@ public class GenericStateMachineGenerator {
String _accessLevelPrivate_1 = this.langExt.accessLevelPrivate();
_builder.append(_accessLevelPrivate_1, "");
_builder.append("int executeTransitionChain(");
- String _name_5 = ac.getName();
- String _selfPointer_6 = this.langExt.selfPointer(_name_5, true);
- _builder.append(_selfPointer_6, "");
+ String _name_2 = ac.getName();
+ String _selfPointer_3 = this.langExt.selfPointer(_name_2, true);
+ _builder.append(_selfPointer_3, "");
_builder.append("int chain");
{
if (handleEvents) {
@@ -524,7 +459,7 @@ public class GenericStateMachineGenerator {
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t");
- String _generateExecuteChain = this.languageGen.generateExecuteChain(xpac, tc, dct);
+ String _generateExecuteChain = this.languageGen.generateExecuteChain(xpac, tc);
_builder.append(_generateExecuteChain, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
@@ -561,9 +496,9 @@ public class GenericStateMachineGenerator {
String _accessLevelPrivate_2 = this.langExt.accessLevelPrivate();
_builder.append(_accessLevelPrivate_2, "");
_builder.append("int enterHistory(");
- String _name_6 = ac.getName();
- String _selfPointer_7 = this.langExt.selfPointer(_name_6, true);
- _builder.append(_selfPointer_7, "");
+ String _name_3 = ac.getName();
+ String _selfPointer_4 = this.langExt.selfPointer(_name_3, true);
+ _builder.append(_selfPointer_4, "");
_builder.append("int state, boolean handler, boolean skip_entry) {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
@@ -588,14 +523,14 @@ public class GenericStateMachineGenerator {
_builder.append("\t\t\t");
_builder.append("\t");
{
- boolean _hasEntryCode_1 = this.roomExt.hasEntryCode(state_2);
- if (_hasEntryCode_1) {
+ boolean _hasEntryCode = this.roomExt.hasEntryCode(state_2);
+ if (_hasEntryCode) {
_builder.append("if (!(skip_entry || handler)) ");
- String _entryCodeOperationName_1 = CodegenHelpers.getEntryCodeOperationName(state_2);
- _builder.append(_entryCodeOperationName_1, " ");
+ String _entryCodeOperationName = CodegenHelpers.getEntryCodeOperationName(state_2);
+ _builder.append(_entryCodeOperationName, " ");
_builder.append("(");
- String _selfPointer_8 = this.langExt.selfPointer(false);
- _builder.append(_selfPointer_8, " ");
+ String _selfPointer_5 = this.langExt.selfPointer(false);
+ _builder.append(_selfPointer_5, " ");
_builder.append(");");
}
}
@@ -648,8 +583,8 @@ public class GenericStateMachineGenerator {
_builder.append("\t");
_builder.append("\t");
_builder.append("state = executeTransitionChain(");
- String _selfPointer_9 = this.langExt.selfPointer(true);
- _builder.append(_selfPointer_9, " ");
+ String _selfPointer_6 = this.langExt.selfPointer(true);
+ _builder.append(_selfPointer_6, " ");
TransitionChain _chain_1 = xpac.getChain(sub_initt);
String _chainId_1 = this.roomExt.getChainId(_chain_1);
_builder.append(_chainId_1, " ");
@@ -754,9 +689,9 @@ public class GenericStateMachineGenerator {
}
}
_builder.append("void executeInitTransition(");
- String _name_7 = ac.getName();
- String _selfPointer_10 = this.langExt.selfPointer(_name_7, false);
- _builder.append(_selfPointer_10, "");
+ String _name_4 = ac.getName();
+ String _selfPointer_7 = this.langExt.selfPointer(_name_4, false);
+ _builder.append(_selfPointer_7, "");
_builder.append(") {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
@@ -773,8 +708,8 @@ public class GenericStateMachineGenerator {
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("int next = executeTransitionChain(");
- String _selfPointer_11 = this.langExt.selfPointer(true);
- _builder.append(_selfPointer_11, " ");
+ String _selfPointer_8 = this.langExt.selfPointer(true);
+ _builder.append(_selfPointer_8, " ");
_builder.append("chain");
{
if (handleEvents) {
@@ -790,8 +725,8 @@ public class GenericStateMachineGenerator {
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("next = enterHistory(");
- String _selfPointer_12 = this.langExt.selfPointer(true);
- _builder.append(_selfPointer_12, " ");
+ String _selfPointer_9 = this.langExt.selfPointer(true);
+ _builder.append(_selfPointer_9, " ");
_builder.append("next, ");
String _booleanConstant_2 = this.langExt.booleanConstant(false);
_builder.append(_booleanConstant_2, " ");
@@ -802,8 +737,8 @@ public class GenericStateMachineGenerator {
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("setState(");
- String _selfPointer_13 = this.langExt.selfPointer(true);
- _builder.append(_selfPointer_13, " ");
+ String _selfPointer_10 = this.langExt.selfPointer(true);
+ _builder.append(_selfPointer_10, " ");
_builder.append("next);");
_builder.newLineIfNotEmpty();
_builder.append("}");
@@ -822,9 +757,9 @@ public class GenericStateMachineGenerator {
}
}
_builder.append("void receiveEvent(");
- String _name_8 = ac.getName();
- String _selfPointer_14 = this.langExt.selfPointer(_name_8, handleEvents);
- _builder.append(_selfPointer_14, "");
+ String _name_5 = ac.getName();
+ String _selfPointer_11 = this.langExt.selfPointer(_name_5, handleEvents);
+ _builder.append(_selfPointer_11, "");
{
if (handleEvents) {
_builder.append("InterfaceItemBase ifitem, int evt, ");
@@ -896,7 +831,7 @@ public class GenericStateMachineGenerator {
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
- StringConcatenation _genStateSwitch = this.genStateSwitch(xpac, dct);
+ StringConcatenation _genStateSwitch = this.genStateSwitch(xpac);
_builder.append(_genStateSwitch, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t");
@@ -904,7 +839,7 @@ public class GenericStateMachineGenerator {
_builder.newLine();
} else {
_builder.append("\t");
- StringConcatenation _genStateSwitch_1 = this.genStateSwitch(xpac, dct);
+ StringConcatenation _genStateSwitch_1 = this.genStateSwitch(xpac);
_builder.append(_genStateSwitch_1, " ");
_builder.newLineIfNotEmpty();
}
@@ -914,16 +849,16 @@ public class GenericStateMachineGenerator {
_builder.newLine();
_builder.append("\t\t");
_builder.append("exitTo(");
- String _selfPointer_15 = this.langExt.selfPointer(true);
- _builder.append(_selfPointer_15, " ");
+ String _selfPointer_12 = this.langExt.selfPointer(true);
+ _builder.append(_selfPointer_12, " ");
String _memberAccess_5 = this.langExt.memberAccess();
_builder.append(_memberAccess_5, " ");
_builder.append("state, catching_state, is_handler);");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("int next = executeTransitionChain(");
- String _selfPointer_16 = this.langExt.selfPointer(true);
- _builder.append(_selfPointer_16, " ");
+ String _selfPointer_13 = this.langExt.selfPointer(true);
+ _builder.append(_selfPointer_13, " ");
_builder.append("chain");
{
if (handleEvents) {
@@ -934,14 +869,14 @@ public class GenericStateMachineGenerator {
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("next = enterHistory(");
- String _selfPointer_17 = this.langExt.selfPointer(true);
- _builder.append(_selfPointer_17, " ");
+ String _selfPointer_14 = this.langExt.selfPointer(true);
+ _builder.append(_selfPointer_14, " ");
_builder.append("next, is_handler, skip_entry);");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("setState(");
- String _selfPointer_18 = this.langExt.selfPointer(true);
- _builder.append(_selfPointer_18, " ");
+ String _selfPointer_15 = this.langExt.selfPointer(true);
+ _builder.append(_selfPointer_15, " ");
_builder.append("next);");
_builder.newLineIfNotEmpty();
_builder.append("\t");
@@ -962,7 +897,7 @@ public class GenericStateMachineGenerator {
return _xblockexpression;
}
- private StringConcatenation genStateSwitch(final ExpandedActorClass xpac, final DetailCodeTranslator dct) {
+ private StringConcatenation genStateSwitch(final ExpandedActorClass xpac) {
StringConcatenation _xblockexpression = null;
{
ActorClass _actorClass = xpac.getActorClass();
@@ -1022,7 +957,7 @@ public class GenericStateMachineGenerator {
_builder.append("\t");
_builder.append("\t");
_builder.append("\t");
- StringConcatenation _genDataDrivenTriggers = this.genDataDrivenTriggers(xpac, state, dct);
+ StringConcatenation _genDataDrivenTriggers = this.genDataDrivenTriggers(xpac, state);
_builder.append(_genDataDrivenTriggers, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t");
@@ -1033,7 +968,7 @@ public class GenericStateMachineGenerator {
_builder.append("\t");
_builder.append("\t");
_builder.append("\t");
- StringConcatenation _genEventDrivenTriggers = this.genEventDrivenTriggers(xpac, state, atlist, dct);
+ StringConcatenation _genEventDrivenTriggers = this.genEventDrivenTriggers(xpac, state, atlist);
_builder.append(_genEventDrivenTriggers, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t");
@@ -1043,7 +978,7 @@ public class GenericStateMachineGenerator {
} else {
_builder.append("\t");
_builder.append("\t");
- StringConcatenation _genDataDrivenTriggers_1 = this.genDataDrivenTriggers(xpac, state, dct);
+ StringConcatenation _genDataDrivenTriggers_1 = this.genDataDrivenTriggers(xpac, state);
_builder.append(_genDataDrivenTriggers_1, " ");
_builder.newLineIfNotEmpty();
}
@@ -1052,7 +987,7 @@ public class GenericStateMachineGenerator {
if (dataDriven) {
_builder.append("\t");
_builder.append("\t");
- StringConcatenation _genDataDrivenTriggers_2 = this.genDataDrivenTriggers(xpac, state, dct);
+ StringConcatenation _genDataDrivenTriggers_2 = this.genDataDrivenTriggers(xpac, state);
_builder.append(_genDataDrivenTriggers_2, " ");
_builder.newLineIfNotEmpty();
} else {
@@ -1073,7 +1008,7 @@ public class GenericStateMachineGenerator {
_builder.append("\t");
_builder.append("\t");
_builder.append("\t");
- StringConcatenation _genEventDrivenTriggers_1 = this.genEventDrivenTriggers(xpac, state, atlist_1, dct);
+ StringConcatenation _genEventDrivenTriggers_1 = this.genEventDrivenTriggers(xpac, state, atlist_1);
_builder.append(_genEventDrivenTriggers_1, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t");
@@ -1099,7 +1034,7 @@ public class GenericStateMachineGenerator {
return _xblockexpression;
}
- private StringConcatenation genDataDrivenTriggers(final ExpandedActorClass xpac, final State state, final DetailCodeTranslator dct) {
+ private StringConcatenation genDataDrivenTriggers(final ExpandedActorClass xpac, final State state) {
StringConcatenation _builder = new StringConcatenation();
StringConcatenation _genDoCodes = this.genDoCodes(state);
_builder.append(_genDoCodes, "");
@@ -1116,9 +1051,10 @@ public class GenericStateMachineGenerator {
{
for(final Transition tr : transitions) {
_builder.append("if (");
+ AbstractGenerator _instance = AbstractGenerator.getInstance();
DetailCode _guard = ((GuardedTransition) tr).getGuard();
- String _translateDetailCode = dct.translateDetailCode(_guard);
- _builder.append(_translateDetailCode, "");
+ String _translatedCode = _instance.getTranslatedCode(_guard);
+ _builder.append(_translatedCode, "");
_builder.append(")");
_builder.newLineIfNotEmpty();
_builder.append("{");
@@ -1170,7 +1106,7 @@ public class GenericStateMachineGenerator {
return _builder;
}
- private StringConcatenation genEventDrivenTriggers(final ExpandedActorClass xpac, final State state, final List<ActiveTrigger> atlist, final DetailCodeTranslator dct) {
+ private StringConcatenation genEventDrivenTriggers(final ExpandedActorClass xpac, final State state, final List<ActiveTrigger> atlist) {
StringConcatenation _builder = new StringConcatenation();
{
for(final ActiveTrigger at : atlist) {
@@ -1210,7 +1146,7 @@ public class GenericStateMachineGenerator {
_builder.append("\t");
Transition _transition = chain.getTransition();
String _trigger_1 = at.getTrigger();
- StringConcatenation _guard = this.guard(_transition, _trigger_1, xpac, dct);
+ StringConcatenation _guard = this.guard(_transition, _trigger_1, xpac);
_builder.append(_guard, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t");
@@ -1278,7 +1214,7 @@ public class GenericStateMachineGenerator {
return _builder;
}
- private StringConcatenation _guard(final TriggeredTransition tt, final String trigger, final ExpandedActorClass ac, final DetailCodeTranslator dct) {
+ private StringConcatenation _guard(final TriggeredTransition tt, final String trigger, final ExpandedActorClass ac) {
StringConcatenation _xblockexpression = null;
{
EList<Trigger> _triggers = tt.getTriggers();
@@ -1295,10 +1231,11 @@ public class GenericStateMachineGenerator {
boolean _hasGuard = this.roomExt.hasGuard(tr);
if (_hasGuard) {
_builder.append("if (");
+ AbstractGenerator _instance = AbstractGenerator.getInstance();
Guard _guard = tr.getGuard();
DetailCode _guard_1 = _guard.getGuard();
- String _translateDetailCode = dct.translateDetailCode(_guard_1);
- _builder.append(_translateDetailCode, "");
+ String _translatedCode = _instance.getTranslatedCode(_guard_1);
+ _builder.append(_translatedCode, "");
_builder.append(")");
_builder.newLineIfNotEmpty();
}
@@ -1308,7 +1245,7 @@ public class GenericStateMachineGenerator {
return _xblockexpression;
}
- private StringConcatenation _guard(final Transition t, final String trigger, final ExpandedActorClass ac, final DetailCodeTranslator dct) {
+ private StringConcatenation _guard(final Transition t, final String trigger, final ExpandedActorClass ac) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("/* error */");
_builder.newLine();
@@ -1340,11 +1277,149 @@ public class GenericStateMachineGenerator {
return _builder;
}
- private StringConcatenation guard(final Transition tt, final String trigger, final ExpandedActorClass ac, final DetailCodeTranslator dct) {
+ private StringConcatenation genActionCodeMethods(final ExpandedActorClass xpac, final State state) {
+ StringConcatenation _xblockexpression = null;
+ {
+ ActorClass _actorClass = xpac.getActorClass();
+ String _name = _actorClass.getName();
+ String _selfPointer = this.langExt.selfPointer(_name, false);
+ final String selfPtr = _selfPointer;
+ String _entryCodeOperationName = CodegenHelpers.getEntryCodeOperationName(state);
+ final String entryOp = _entryCodeOperationName;
+ String _exitCodeOperationName = CodegenHelpers.getExitCodeOperationName(state);
+ final String exitOp = _exitCodeOperationName;
+ String _doCodeOperationName = CodegenHelpers.getDoCodeOperationName(state);
+ final String doOp = _doCodeOperationName;
+ AbstractGenerator _instance = AbstractGenerator.getInstance();
+ DetailCode _entryCode = state.getEntryCode();
+ String _translatedCode = _instance.getTranslatedCode(_entryCode);
+ String entry = _translatedCode;
+ AbstractGenerator _instance_1 = AbstractGenerator.getInstance();
+ DetailCode _exitCode = state.getExitCode();
+ String _translatedCode_1 = _instance_1.getTranslatedCode(_exitCode);
+ String exit = _translatedCode_1;
+ AbstractGenerator _instance_2 = AbstractGenerator.getInstance();
+ DetailCode _doCode = state.getDoCode();
+ String _translatedCode_2 = _instance_2.getTranslatedCode(_doCode);
+ String docode = _translatedCode_2;
+ if ((state instanceof ExpandedRefinedState)) {
+ {
+ final ExpandedRefinedState rs = ((ExpandedRefinedState) state);
+ boolean _usesInheritance = this.langExt.usesInheritance();
+ if (_usesInheritance) {
+ {
+ ActorClass _actorClass_1 = xpac.getActorClass();
+ ActorClass _base = _actorClass_1.getBase();
+ String _name_1 = _base.getName();
+ final String baseName = _name_1;
+ String _inheritedEntry = rs.getInheritedEntry();
+ boolean _isEmpty = _inheritedEntry.isEmpty();
+ boolean _operator_not = BooleanExtensions.operator_not(_isEmpty);
+ if (_operator_not) {
+ String _superCall = this.langExt.superCall(baseName, entryOp, "");
+ String _operator_plus = StringExtensions.operator_plus(_superCall, entry);
+ entry = _operator_plus;
+ }
+ String _inheritedExit = rs.getInheritedExit();
+ boolean _isEmpty_1 = _inheritedExit.isEmpty();
+ boolean _operator_not_1 = BooleanExtensions.operator_not(_isEmpty_1);
+ if (_operator_not_1) {
+ String _superCall_1 = this.langExt.superCall(baseName, exitOp, "");
+ String _operator_plus_1 = StringExtensions.operator_plus(exit, _superCall_1);
+ exit = _operator_plus_1;
+ }
+ String _inheritedDo = rs.getInheritedDo();
+ boolean _isEmpty_2 = _inheritedDo.isEmpty();
+ boolean _operator_not_2 = BooleanExtensions.operator_not(_isEmpty_2);
+ if (_operator_not_2) {
+ String _superCall_2 = this.langExt.superCall(baseName, doOp, "");
+ String _operator_plus_2 = StringExtensions.operator_plus(_superCall_2, docode);
+ docode = _operator_plus_2;
+ }
+ }
+ } else {
+ {
+ String _inheritedEntry_1 = rs.getInheritedEntry();
+ String _operator_plus_3 = StringExtensions.operator_plus(_inheritedEntry_1, entry);
+ entry = _operator_plus_3;
+ String _inheritedExit_1 = rs.getInheritedExit();
+ String _operator_plus_4 = StringExtensions.operator_plus(exit, _inheritedExit_1);
+ exit = _operator_plus_4;
+ String _inheritedDo_1 = rs.getInheritedDo();
+ String _operator_plus_5 = StringExtensions.operator_plus(_inheritedDo_1, docode);
+ docode = _operator_plus_5;
+ }
+ }
+ }
+ }
+ StringConcatenation _builder = new StringConcatenation();
+ {
+ boolean _isEmpty_3 = entry.isEmpty();
+ boolean _operator_not_3 = BooleanExtensions.operator_not(_isEmpty_3);
+ if (_operator_not_3) {
+ String _accessLevelProtected = this.langExt.accessLevelProtected();
+ _builder.append(_accessLevelProtected, "");
+ _builder.append("void ");
+ _builder.append(entryOp, "");
+ _builder.append("(");
+ _builder.append(selfPtr, "");
+ _builder.append(") {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append(entry, " ");
+ _builder.newLineIfNotEmpty();
+ _builder.append("}");
+ _builder.newLine();
+ }
+ }
+ {
+ boolean _isEmpty_4 = exit.isEmpty();
+ boolean _operator_not_4 = BooleanExtensions.operator_not(_isEmpty_4);
+ if (_operator_not_4) {
+ String _accessLevelProtected_1 = this.langExt.accessLevelProtected();
+ _builder.append(_accessLevelProtected_1, "");
+ _builder.append("void ");
+ _builder.append(exitOp, "");
+ _builder.append("(");
+ _builder.append(selfPtr, "");
+ _builder.append(") {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append(exit, " ");
+ _builder.newLineIfNotEmpty();
+ _builder.append("}");
+ _builder.newLine();
+ }
+ }
+ {
+ boolean _isEmpty_5 = docode.isEmpty();
+ boolean _operator_not_5 = BooleanExtensions.operator_not(_isEmpty_5);
+ if (_operator_not_5) {
+ String _accessLevelProtected_2 = this.langExt.accessLevelProtected();
+ _builder.append(_accessLevelProtected_2, "");
+ _builder.append(" void ");
+ _builder.append(doOp, "");
+ _builder.append("(");
+ _builder.append(selfPtr, "");
+ _builder.append(") {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append(docode, " ");
+ _builder.newLineIfNotEmpty();
+ _builder.append("}");
+ _builder.newLine();
+ }
+ }
+ _xblockexpression = (_builder);
+ }
+ return _xblockexpression;
+ }
+
+ private StringConcatenation guard(final Transition tt, final String trigger, final ExpandedActorClass ac) {
if (tt instanceof TriggeredTransition) {
- return _guard((TriggeredTransition)tt, trigger, ac, dct);
+ return _guard((TriggeredTransition)tt, trigger, ac);
} else {
- return _guard(tt, trigger, ac, dct);
+ return _guard(tt, trigger, ac);
}
}
}
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java
index c9244c22f..18c1d39c4 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java
@@ -15,8 +15,7 @@ import org.eclipse.etrice.core.room.RefableType;
import org.eclipse.etrice.core.room.StandardOperation;
import org.eclipse.etrice.core.room.VarDecl;
import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.etrice.generator.base.DetailCodeTranslator;
-import org.eclipse.etrice.generator.base.ITranslationProvider;
+import org.eclipse.etrice.generator.base.AbstractGenerator;
import org.eclipse.etrice.generator.generic.ConfigExtension;
import org.eclipse.etrice.generator.generic.ILanguageExtension;
import org.eclipse.etrice.generator.generic.TypeHelpers;
@@ -35,9 +34,6 @@ public class ProcedureHelpers {
private ILanguageExtension languageExt;
@Inject
- public ITranslationProvider translator;
-
- @Inject
private ConfigExtension _configExtension;
@Inject
@@ -605,47 +601,41 @@ public class ProcedureHelpers {
}
public StringConcatenation operationsImplementation(final ActorClass ac) {
- StringConcatenation _xblockexpression = null;
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("/*--------------------- operations ---------------------*/");
+ _builder.newLine();
{
- this.translator.setActorClass(ac);
- DetailCodeTranslator _detailCodeTranslator = new DetailCodeTranslator(ac, this.translator);
- DetailCodeTranslator dct = _detailCodeTranslator;
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/*--------------------- operations ---------------------*/");
- _builder.newLine();
- {
- EList<StandardOperation> _operations = ac.getOperations();
- for(final StandardOperation operation : _operations) {
- {
- boolean _operator_and = false;
- boolean _usesInheritance = this.languageExt.usesInheritance();
- if (!_usesInheritance) {
- _operator_and = false;
- } else {
- boolean _isConstructor = RoomHelpers.isConstructor(operation);
- _operator_and = BooleanExtensions.operator_and(_usesInheritance, _isConstructor);
- }
- boolean _operator_not = BooleanExtensions.operator_not(_operator_and);
- if (_operator_not) {
- String _name = ac.getName();
- StringConcatenation _operationSignature = this.operationSignature(operation, _name, false);
- _builder.append(_operationSignature, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- DetailCode _detailCode = operation.getDetailCode();
- String _translateDetailCode = dct.translateDetailCode(_detailCode);
- _builder.append(_translateDetailCode, " ");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- }
+ EList<StandardOperation> _operations = ac.getOperations();
+ for(final StandardOperation operation : _operations) {
+ {
+ boolean _operator_and = false;
+ boolean _usesInheritance = this.languageExt.usesInheritance();
+ if (!_usesInheritance) {
+ _operator_and = false;
+ } else {
+ boolean _isConstructor = RoomHelpers.isConstructor(operation);
+ _operator_and = BooleanExtensions.operator_and(_usesInheritance, _isConstructor);
+ }
+ boolean _operator_not = BooleanExtensions.operator_not(_operator_and);
+ if (_operator_not) {
+ String _name = ac.getName();
+ StringConcatenation _operationSignature = this.operationSignature(operation, _name, false);
+ _builder.append(_operationSignature, "");
+ _builder.append(" {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ AbstractGenerator _instance = AbstractGenerator.getInstance();
+ DetailCode _detailCode = operation.getDetailCode();
+ String _translatedCode = _instance.getTranslatedCode(_detailCode);
+ _builder.append(_translatedCode, " ");
+ _builder.newLineIfNotEmpty();
+ _builder.append("}");
+ _builder.newLine();
}
}
}
- _xblockexpression = (_builder);
}
- return _xblockexpression;
+ return _builder;
}
private StringConcatenation operationSignature(final Operation operation, final String classname, final boolean isDeclaration) {
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java
index 67c1d56c8..822647c58 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java
@@ -11,6 +11,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState;
import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
import org.eclipse.etrice.core.genmodel.etricegen.SAPInstance;
@@ -31,7 +32,6 @@ import org.eclipse.etrice.core.room.Port;
import org.eclipse.etrice.core.room.PortClass;
import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.RefableType;
-import org.eclipse.etrice.core.room.RefinedState;
import org.eclipse.etrice.core.room.RoomClass;
import org.eclipse.etrice.core.room.RoomModel;
import org.eclipse.etrice.core.room.SAPRef;
@@ -47,8 +47,8 @@ import org.eclipse.etrice.core.room.TransitionPoint;
import org.eclipse.etrice.core.room.Trigger;
import org.eclipse.etrice.core.room.TriggeredTransition;
import org.eclipse.etrice.core.room.VarDecl;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.generator.base.CodegenHelpers;
-import org.eclipse.etrice.generator.base.DetailCodeTranslator;
import org.eclipse.xtext.xbase.lib.BooleanExtensions;
import org.eclipse.xtext.xbase.lib.CollectionExtensions;
import org.eclipse.xtext.xbase.lib.ComparableExtensions;
@@ -853,88 +853,57 @@ public class RoomExtensions {
}
public boolean empty(final DetailCode dc) {
- boolean _operator_or = false;
- boolean _operator_equals = ObjectExtensions.operator_equals(dc, null);
- if (_operator_equals) {
- _operator_or = true;
- } else {
- EList<String> _commands = dc.getCommands();
- boolean _isEmpty = _commands.isEmpty();
- _operator_or = BooleanExtensions.operator_or(_operator_equals, _isEmpty);
- }
- return _operator_or;
+ String _detailCode = RoomHelpers.getDetailCode(dc);
+ boolean _operator_equals = ObjectExtensions.operator_equals(_detailCode, "");
+ return _operator_equals;
}
public boolean hasEntryCode(final State s) {
- DetailCode _entryCode = s.getEntryCode();
- boolean _empty = this.empty(_entryCode);
- boolean _operator_not = BooleanExtensions.operator_not(_empty);
- return _operator_not;
+ DetailCode _entryCode = s.getEntryCode();
+ boolean _empty = this.empty(_entryCode);
+ boolean _operator_not = BooleanExtensions.operator_not(_empty);
+ if (_operator_not) {
+ return true;
+ }
+ if ((s instanceof ExpandedRefinedState)) {
+ String _inheritedEntry = ((ExpandedRefinedState) s).getInheritedEntry();
+ boolean _isEmpty = _inheritedEntry.isEmpty();
+ boolean _operator_not_1 = BooleanExtensions.operator_not(_isEmpty);
+ return _operator_not_1;
+ }
+ return false;
}
public boolean hasExitCode(final State s) {
- DetailCode _exitCode = s.getExitCode();
- boolean _empty = this.empty(_exitCode);
- boolean _operator_not = BooleanExtensions.operator_not(_empty);
- return _operator_not;
- }
-
- public boolean hasDoCode(final State s) {
- DetailCode _doCode = s.getDoCode();
- boolean _empty = this.empty(_doCode);
- boolean _operator_not = BooleanExtensions.operator_not(_empty);
- return _operator_not;
- }
-
- public String getEntryCode(final ExpandedActorClass ac, final State s, final DetailCodeTranslator dct) {
- String _xifexpression = null;
- if ((s instanceof RefinedState)) {
- State _target = ((RefinedState) s).getTarget();
- String _entryCode = this.getEntryCode(ac, _target, dct);
- DetailCode _entryCode_1 = s.getEntryCode();
- String _translateDetailCode = dct.translateDetailCode(_entryCode_1);
- String _operator_plus = StringExtensions.operator_plus(_entryCode, _translateDetailCode);
- _xifexpression = _operator_plus;
- } else {
- DetailCode _entryCode_2 = s.getEntryCode();
- String _translateDetailCode_1 = dct.translateDetailCode(_entryCode_2);
- _xifexpression = _translateDetailCode_1;
- }
- return _xifexpression;
- }
-
- public String getExitCode(final ExpandedActorClass ac, final State s, final DetailCodeTranslator dct) {
- String _xifexpression = null;
- if ((s instanceof RefinedState)) {
DetailCode _exitCode = s.getExitCode();
- String _translateDetailCode = dct.translateDetailCode(_exitCode);
- State _target = ((RefinedState) s).getTarget();
- String _exitCode_1 = this.getExitCode(ac, _target, dct);
- String _operator_plus = StringExtensions.operator_plus(_translateDetailCode, _exitCode_1);
- _xifexpression = _operator_plus;
- } else {
- DetailCode _exitCode_2 = s.getExitCode();
- String _translateDetailCode_1 = dct.translateDetailCode(_exitCode_2);
- _xifexpression = _translateDetailCode_1;
- }
- return _xifexpression;
+ boolean _empty = this.empty(_exitCode);
+ boolean _operator_not = BooleanExtensions.operator_not(_empty);
+ if (_operator_not) {
+ return true;
+ }
+ if ((s instanceof ExpandedRefinedState)) {
+ String _inheritedExit = ((ExpandedRefinedState) s).getInheritedExit();
+ boolean _isEmpty = _inheritedExit.isEmpty();
+ boolean _operator_not_1 = BooleanExtensions.operator_not(_isEmpty);
+ return _operator_not_1;
+ }
+ return false;
}
- public String getDoCode(final ExpandedActorClass ac, final State s, final DetailCodeTranslator dct) {
- String _xifexpression = null;
- if ((s instanceof RefinedState)) {
+ public boolean hasDoCode(final State s) {
DetailCode _doCode = s.getDoCode();
- String _translateDetailCode = dct.translateDetailCode(_doCode);
- State _target = ((RefinedState) s).getTarget();
- String _doCode_1 = this.getDoCode(ac, _target, dct);
- String _operator_plus = StringExtensions.operator_plus(_translateDetailCode, _doCode_1);
- _xifexpression = _operator_plus;
- } else {
- DetailCode _doCode_2 = s.getDoCode();
- String _translateDetailCode_1 = dct.translateDetailCode(_doCode_2);
- _xifexpression = _translateDetailCode_1;
- }
- return _xifexpression;
+ boolean _empty = this.empty(_doCode);
+ boolean _operator_not = BooleanExtensions.operator_not(_empty);
+ if (_operator_not) {
+ return true;
+ }
+ if ((s instanceof ExpandedRefinedState)) {
+ String _inheritedDo = ((ExpandedRefinedState) s).getInheritedDo();
+ boolean _isEmpty = _inheritedDo.isEmpty();
+ boolean _operator_not_1 = BooleanExtensions.operator_not(_isEmpty);
+ return _operator_not_1;
+ }
+ return false;
}
public boolean hasActionCode(final Transition t) {
@@ -953,12 +922,6 @@ public class RoomExtensions {
return _operator_and;
}
- public String getActionCode(final ExpandedActorClass ac, final Transition t, final DetailCodeTranslator dct) {
- DetailCode _action = t.getAction();
- String _translateDetailCode = dct.translateDetailCode(_action);
- return _translateDetailCode;
- }
-
public String getContextId(final TransitionChain tc) {
State _stateContext = tc.getStateContext();
String _stateId = this.getStateId(_stateContext);
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java
index 977106d7c..7b8e0ad3a 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java
@@ -59,7 +59,8 @@ public class TypeHelpers {
}
public String getTypedDataDefinition(final Message m) {
- String _generateTypedData = this.chainGenerator.generateTypedData(m);
+ VarDecl _data = m.getData();
+ String _generateTypedData = this.chainGenerator.generateTypedData(_data);
return _generateTypedData;
}
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorExporter.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorExporter.java
index 49f6e1519..2c42e10cf 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorExporter.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorExporter.java
@@ -25,7 +25,7 @@ import org.eclipse.ui.PlatformUI;
public class BehaviorExporter {
- private static final String SUFFIX = "_behavior.jpg";
+ private static final String SUFFIX = "_behavior";
public static void export(ActorClass ac, String folder) {
DiagramAccess da = new DiagramAccess();
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java
index 6947fd242..ea21832dd 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java
@@ -236,9 +236,9 @@ public class StateSupport {
else
y += height/2;
- boolean inherited = SupportUtil.isInherited(getDiagram(), s);
- Color lineColor = manageColor(inherited?INHERITED_COLOR:LINE_COLOR);
- Color bgColor = manageColor(inherited?INHERITED_BACKGROUND:BACKGROUND);
+ boolean showInherited = SupportUtil.showAsInherited(getDiagram(), s);
+ Color lineColor = manageColor(showInherited?INHERITED_COLOR:LINE_COLOR);
+ Color bgColor = manageColor(showInherited?INHERITED_BACKGROUND:BACKGROUND);
IGaService gaService = Graphiti.getGaService();
{
final Rectangle invisibleRectangle = gaService.createInvisibleRectangle(containerShape);
@@ -318,7 +318,7 @@ public class StateSupport {
while (!borderGA.getGraphicsAlgorithmChildren().isEmpty()) {
EcoreUtil.delete(borderGA.getGraphicsAlgorithmChildren().get(0), true);
}
- Color lineColor = manageColor(SupportUtil.isInherited(getDiagram(), s)?INHERITED_COLOR:LINE_COLOR);
+ Color lineColor = manageColor(SupportUtil.showAsInherited(getDiagram(), s)?INHERITED_COLOR:LINE_COLOR);
addHints(s, (RoundedRectangle) borderGA, lineColor);
}
@@ -339,22 +339,22 @@ public class StateSupport {
private static class PropertyFeature extends AbstractCustomFeature {
private boolean doneChanges = false;
- private boolean inherited;
+ private boolean editable;
- public PropertyFeature(IFeatureProvider fp, boolean inherited) {
+ public PropertyFeature(IFeatureProvider fp, boolean editable) {
super(fp);
- this.inherited = inherited;
+ this.editable = editable;
}
@Override
public String getName() {
- return inherited? "Edit State..." : "View State";
+ return editable? "Edit State..." : "View State";
}
@Override
public String getDescription() {
- return inherited? "Edit State Properties" : "View State Properties";
+ return editable? "Edit State Properties" : "View State Properties";
}
@Override
@@ -386,7 +386,11 @@ public class StateSupport {
}
private void adjustSubgraphLabels(State s, ActorClass ac) {
- if (RoomHelpers.hasSubStructure(s, ac)) {
+ if (s instanceof RefinedState)
+ // the name hasn't changed, nothing to do
+ return;
+
+ if (RoomHelpers.hasDirectSubStructure(s)) {
// update the path text in the sub graph
ContainerShape subShape = ContextSwitcher.getContext(getDiagram(), s.getSubgraph());
if (subShape!=null && !subShape.getChildren().isEmpty()) {
@@ -395,9 +399,10 @@ public class StateSupport {
if (ga instanceof Text)
((Text)ga).setValue(RoomNameProvider.getStateGraphLabel(s.getSubgraph()));
}
- for (State sub : s.getSubgraph().getStates()) {
- adjustSubgraphLabels(sub, ac);
- }
+ if (s.getSubgraph()!=null)
+ for (State sub : s.getSubgraph().getStates()) {
+ adjustSubgraphLabels(sub, ac);
+ }
}
}
@@ -410,9 +415,9 @@ public class StateSupport {
EcoreUtil.delete(invisibleRect.getGraphicsAlgorithmChildren().get(0), true);
}
- boolean inherited = SupportUtil.isInherited(getDiagram(), s);
- Color lineColor = manageColor(inherited?INHERITED_COLOR:LINE_COLOR);
- Color bgColor = manageColor(inherited?INHERITED_BACKGROUND:BACKGROUND);
+ boolean showInherite = SupportUtil.showAsInherited(getDiagram(), s);
+ Color lineColor = manageColor(showInherite?INHERITED_COLOR:LINE_COLOR);
+ Color bgColor = manageColor(showInherite?INHERITED_BACKGROUND:BACKGROUND);
createFigure(s, invisibleRect, lineColor, bgColor);
GraphicsAlgorithm ga = container.getChildren().get(0).getGraphicsAlgorithm();
@@ -450,8 +455,10 @@ public class StateSupport {
PictogramElement pe = context.getPictogramElements()[0];
Object bo = getBusinessObjectForPictogramElement(pe);
if (bo instanceof State) {
- State targetting = SupportUtil.getTargettingState((State) bo, getDiagram());
- if (targetting.getSubgraph()!=null)
+// State targetting = SupportUtil.getTargettingState((State) bo, getDiagram());
+// if (targetting.getSubgraph()!=null)
+// return true;
+ if (RoomHelpers.hasSubStructure((State) bo, SupportUtil.getActorClass(getDiagram())))
return true;
}
return false;
@@ -463,9 +470,16 @@ public class StateSupport {
ContainerShape container = (ContainerShape)context.getPictogramElements()[0];
Object bo = getBusinessObjectForPictogramElement(container);
if (bo instanceof State) {
- State targetting = SupportUtil.getTargettingState((State) bo, getDiagram());
- if (targetting.getSubgraph()!=null) {
- ContextSwitcher.switchTo(getDiagram(), targetting.getSubgraph());
+ //State targetting = SupportUtil.getTargettingState((State) bo, getDiagram());
+ State hasSub = (State) bo;
+ while (!RoomHelpers.hasDirectSubStructure(hasSub)) {
+ if (hasSub instanceof RefinedState)
+ hasSub = ((RefinedState) hasSub).getTarget();
+ else
+ return;
+ }
+ if (hasSub.getSubgraph()!=null) {
+ ContextSwitcher.switchTo(getDiagram(), hasSub.getSubgraph());
}
}
}
@@ -498,8 +512,9 @@ public class StateSupport {
PictogramElement pe = context.getPictogramElements()[0];
Object bo = getBusinessObjectForPictogramElement(pe);
if (bo instanceof State) {
- if (((State) bo).getSubgraph()==null)
- return true;
+ ActorClass ac = SupportUtil.getActorClass(getDiagram());
+ boolean isBaseClassState = RoomHelpers.getActorClass((State) bo)!=ac;
+ return isBaseClassState || !RoomHelpers.hasSubStructure((State) bo, ac);
}
return false;
}
@@ -515,8 +530,8 @@ public class StateSupport {
StateGraph newSG = null;
- boolean inherited = SupportUtil.isInherited(getDiagram(), s);
- if (inherited) {
+ boolean isBaseClassState = RoomHelpers.getActorClass(s)!=SupportUtil.getActorClass(getDiagram());
+ if (isBaseClassState) {
newSG = SupportUtil.getSubGraphOfRefinedStateFor(s, SupportUtil.getActorClass(getDiagram()));
s = (State) newSG.eContainer();
@@ -565,9 +580,10 @@ public class StateSupport {
public boolean canExecute(ICustomContext context) {
PictogramElement pe = context.getPictogramElements()[0];
Object bo = getBusinessObjectForPictogramElement(pe);
- if (bo instanceof SimpleState) {
- if (((State) bo).getSubgraph()==null)
- return SupportUtil.isInherited(getDiagram(), (State) bo);
+ if (bo instanceof State) {
+ ActorClass ac = SupportUtil.getActorClass(getDiagram());
+ boolean isBaseClassState = RoomHelpers.getActorClass((State) bo)!=ac;
+ return isBaseClassState;
}
return false;
}
@@ -908,13 +924,13 @@ public class StateSupport {
if (bo instanceof State) {
State s = (State) bo;
- boolean inherited = SupportUtil.isInherited(getDiagramTypeProvider().getDiagram(), s);
- boolean editable = !inherited || s instanceof RefinedState;
+ ActorClass ac = SupportUtil.getActorClass(getDiagramTypeProvider().getDiagram());
+ //boolean inherited = SupportUtil.isInherited(getDiagramTypeProvider().getDiagram(), s);
+ boolean editable = RoomHelpers.getActorClass(s)==ac;
result.add(new PropertyFeature(fp, editable));
if (!editable)
result.add(new CreateRefinedStateFeature(fp));
- ActorClass ac = SupportUtil.getActorClass(getDiagramTypeProvider().getDiagram());
if (RoomHelpers.hasSubStructure(s, ac))
result.add(new GoDownFeature(fp));
else
@@ -1077,15 +1093,15 @@ public class StateSupport {
doHint.setLineWidth(LINE_WIDTH);
gaService.setLocation(doHint, x, y);
- if (!RoomHelpers.hasDetailCode(s.getEntryCode())) {
+ if (!RoomHelpers.hasEntryCode(s, true)) {
entryHint.setLineVisible(false);
}
- if (!RoomHelpers.hasDetailCode(s.getExitCode())) {
+ if (!RoomHelpers.hasExitCode(s, true)) {
exitHint.setLineVisible(false);
}
- if (!RoomHelpers.hasDetailCode(s.getDoCode())) {
+ if (!RoomHelpers.hasDoCode(s, true)) {
doHint.setLineVisible(false);
}
}
@@ -1100,8 +1116,10 @@ public class StateSupport {
// entry and exit code
hint = border.getGraphicsAlgorithmChildren().get(1);
- hint.setLineVisible(RoomHelpers.hasDetailCode(s.getEntryCode()));
+ hint.setLineVisible(RoomHelpers.hasEntryCode(s, true));
hint = border.getGraphicsAlgorithmChildren().get(2);
- hint.setLineVisible(RoomHelpers.hasDetailCode(s.getExitCode()));
+ hint.setLineVisible(RoomHelpers.hasExitCode(s, true));
+ hint = border.getGraphicsAlgorithmChildren().get(3);
+ hint.setLineVisible(RoomHelpers.hasDoCode(s, true));
}
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/SupportUtil.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/SupportUtil.java
index 1b999fa2c..c35aa5d5d 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/SupportUtil.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/SupportUtil.java
@@ -100,18 +100,19 @@ public class SupportUtil {
}
public static boolean isInherited(Diagram diag, EObject obj) {
+
if (obj instanceof RefinedState)
return true;
- ActorClass parent = getActorClass(diag);
- while (obj!=null) {
- if (obj instanceof ActorClass)
- return obj!=parent;
-
- obj = obj.eContainer();
- }
- assert(false): "no parent actor class found";
- return false;
+ return RoomHelpers.getActorClass(obj)!=getActorClass(diag);
+ }
+
+ public static boolean showAsInherited(Diagram diag, State obj) {
+
+ if (obj instanceof RefinedState)
+ return true;
+
+ return RoomHelpers.getActorClass(obj)!=getActorClass(diag);
}
public static Diagram getDiagram(GraphicsAlgorithm ga) {
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
index df479361d..b458949c2 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
@@ -816,7 +816,9 @@ public class TrPointSupport {
EcoreUtil.delete(invisibleRect.getGraphicsAlgorithmChildren().get(0), true);
}
- createFigure(tp, false, container, invisibleRect, dark, bright);
+ EObject parentObj = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(container.getContainer());
+ boolean subtp = parentObj instanceof State;
+ createFigure(tp, subtp, container, invisibleRect, dark, bright);
GraphicsAlgorithm ga = container.getChildren().get(0).getGraphicsAlgorithm();
if (ga instanceof Text) {
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java
index 27e7d2d83..ca014bb46 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java
@@ -578,7 +578,6 @@ public class TransitionSupport {
pe = (PictogramElement) pe.eContainer();
Transition trans = (Transition) getBusinessObjectForPictogramElement(pe);
Connection conn = (Connection) pe;
- boolean inherited = SupportUtil.isInherited(getDiagram(), trans);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
TransitionPropertyDialog dlg = new TransitionPropertyDialog(shell, SupportUtil.getActorClass(getDiagram()), trans);
@@ -587,6 +586,7 @@ public class TransitionSupport {
doneChanges = true;
+ boolean inherited = SupportUtil.isInherited(getDiagram(), trans);
Color lineColor = inherited? manageColor(INHERITED_COLOR):manageColor(LINE_COLOR);
Color fillColor = RoomHelpers.hasDetailCode(trans.getAction())?
lineColor:manageColor(FILL_COLOR);
diff --git a/plugins/org.eclipse.etrice.ui.commands/plugin.xml b/plugins/org.eclipse.etrice.ui.commands/plugin.xml
index 5240833c2..824e6802d 100644
--- a/plugins/org.eclipse.etrice.ui.commands/plugin.xml
+++ b/plugins/org.eclipse.etrice.ui.commands/plugin.xml
@@ -188,7 +188,7 @@
locationURI="popup:org.eclipse.etrice.core.room.outline?after=additions">
<command
commandId="org.eclipse.etrice.core.room.ui.exportDiagrams"
- label="Export Diagrams..."
+ label="Export Diagrams"
style="push">
<visibleWhen
checkEnabled="true">
diff --git a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/ExportDiagramsHandler.java b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/ExportDiagramsHandler.java
index b5dc55d37..1448666de 100644
--- a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/ExportDiagramsHandler.java
+++ b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/ExportDiagramsHandler.java
@@ -12,26 +12,34 @@
package org.eclipse.etrice.ui.commands.handlers;
+import java.io.ByteArrayInputStream;
import java.util.List;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.RoomModel;
import org.eclipse.etrice.core.room.SubSystemClass;
import org.eclipse.etrice.core.ui.RoomUiModule;
import org.eclipse.etrice.ui.behavior.editor.BehaviorExporter;
+import org.eclipse.etrice.ui.common.Activator;
+import org.eclipse.etrice.ui.common.preferences.PreferenceConstants;
import org.eclipse.etrice.ui.structure.editor.StructureExporter;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
@@ -63,12 +71,15 @@ public class ExportDiagramsHandler extends AbstractHandler {
@Inject
protected IResourceValidator resourceValidator;
+ private IPreferenceStore store;
public ExportDiagramsHandler() {
super();
Injector injector = RoomUiModule.getInjector();
injector.injectMembers(this);
+
+ this.store = Activator.getDefault().getPreferenceStore();
}
// TODO: code copied from org.eclipse.etrice.ui.commands.handlers.AbstractEditHandler - refactor
@@ -108,26 +119,68 @@ public class ExportDiagramsHandler extends AbstractHandler {
}
protected void exportDiagrams(RoomModel model, IPath modelPath, Shell shell) {
-// IProject project = ResourcesPlugin.getWorkspace().getRoot().getFile(modelPath).getProject();
IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(modelPath.removeLastSegments(1));
- IProject project = container.getProject();
- IFolder file = project.getFolder("doc-gen/images");
- if (file!=null) {
- String folder = file.getLocation().toOSString();
+ String relPath = store.getString(PreferenceConstants.EXPORT_DIAGRAM_PATH);
+ boolean projectRelative = PreferenceConstants.PATH_REL_TO_PROJECT.equals(
+ store.getString(PreferenceConstants.EXPORT_DIAGRAM_PATH_RELATIVE_TO));
- for (ActorClass ac : model.getActorClasses()) {
- if (ac.getStateMachine()!=null)
- BehaviorExporter.export(ac, folder);
-
- StructureExporter.export(ac, folder);
- }
+ IFolder folder;
+ if (projectRelative) {
+ IProject project = container.getProject();
+ folder = project.getFolder(relPath);
+ }
+ else {
+ folder = container.getFolder(new Path(relPath));
+ }
+ if (folder!=null) {
+ if (!folder.exists())
+ try {
+ create(folder);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
- for (SubSystemClass ssc : model.getSubSystemClasses()) {
- StructureExporter.export(ssc, folder);
+ if (folder.exists()) {
+ String folderPath = folder.getLocation().toOSString();
+
+ for (ActorClass ac : model.getActorClasses()) {
+ if (ac.getStateMachine()!=null)
+ BehaviorExporter.export(ac, folderPath);
+
+ StructureExporter.export(ac, folderPath);
+ }
+
+ for (SubSystemClass ssc : model.getSubSystemClasses()) {
+ StructureExporter.export(ssc, folderPath);
+ }
+
+ try {
+ folder.refreshLocal(IResource.DEPTH_ONE, null);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
}
}
}
+ protected void create(final IResource resource) throws CoreException {
+ if (resource == null || resource.exists())
+ return;
+ if (!resource.getParent().exists())
+ create(resource.getParent());
+ switch (resource.getType()) {
+ case IResource.FILE:
+ ((IFile) resource).create(new ByteArrayInputStream(new byte[0]), true, null);
+ break;
+ case IResource.FOLDER:
+ ((IFolder) resource).create(IResource.NONE, true, null);
+ break;
+ case IResource.PROJECT:
+ ((IProject) resource).create(null);
+ ((IProject) resource).open(null);
+ break;
+ }
+ }
// TODO: code copied from org.eclipse.etrice.ui.commands.handlers.AbstractEditHandler - refactor
protected boolean checkPrerequisites(XtextEditor xtextEditor,
IXtextDocument document, final String fragment) {
diff --git a/plugins/org.eclipse.etrice.ui.common/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.ui.common/META-INF/MANIFEST.MF
index 92d3c874c..0f4ac7a49 100644
--- a/plugins/org.eclipse.etrice.ui.common/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.ui.common/META-INF/MANIFEST.MF
@@ -5,11 +5,11 @@ Bundle-SymbolicName: org.eclipse.etrice.ui.common;singleton:=true
Bundle-Version: 0.2.0.qualifier
Bundle-Vendor: eTrice (Incubation)
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.100",
+Require-Bundle: org.eclipse.etrice.core.room.ui;bundle-version="0.1.0",
+ org.eclipse.core.databinding;bundle-version="1.3.100",
org.eclipse.core.databinding.beans;bundle-version="1.2.100",
org.eclipse.jface.databinding;bundle-version="1.4.0",
org.eclipse.emf.transaction;bundle-version="1.4.0",
- org.eclipse.etrice.core.room.ui;bundle-version="0.1.0",
org.eclipse.graphiti;bundle-version="0.8.0",
org.eclipse.ui.ide;bundle-version="3.6.0",
org.eclipse.graphiti.ui;bundle-version="0.7.0",
diff --git a/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/editor/DiagramExporter.java b/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/editor/DiagramExporter.java
index 2e396f463..74dc08fef 100644
--- a/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/editor/DiagramExporter.java
+++ b/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/editor/DiagramExporter.java
@@ -20,7 +20,9 @@ import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.SWTGraphics;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.etrice.core.room.StructureClass;
+import org.eclipse.etrice.ui.common.Activator;
import org.eclipse.etrice.ui.common.DiagramAccessBase;
+import org.eclipse.etrice.ui.common.preferences.PreferenceConstants;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.GraphicalViewer;
@@ -29,6 +31,7 @@ import org.eclipse.gef.editparts.LayerManager;
import org.eclipse.graphiti.ui.internal.fixed.FixedScaledGraphics;
import org.eclipse.graphiti.ui.internal.services.GraphitiUiInternal;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
@@ -58,18 +61,29 @@ public class DiagramExporter {
// code copied from org.eclipse.graphiti.ui.internal.action.SaveImageAction
// and org.eclipse.graphiti.ui.internal.util.ui.print.ExportDiagramDialog
public static void export(RoomDiagramEditor editor, final String filename) {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ String format = store.getString(PreferenceConstants.EXPORT_DIAGRAM_FORMAT);
+ int fmt = SWT.IMAGE_JPEG;
+ if (format.equals(PreferenceConstants.FORMAT_BMP))
+ fmt = SWT.IMAGE_BMP;
+ else if (format.equals(PreferenceConstants.FORMAT_PNG))
+ fmt = SWT.IMAGE_PNG;
+ else if (format.equals(PreferenceConstants.FORMAT_GIF))
+ fmt = SWT.IMAGE_GIF;
+
+ final String fname = filename+"."+format;
GraphicalViewer viewer = (GraphicalViewer) editor.getAdapter(GraphicalViewer.class);
Image image = createImage(viewer, 1.0d, 3000.0d);
if (image!=null) {
try {
- final byte[] imgData = GraphitiUiInternal.getUiService().createImage(image, SWT.IMAGE_JPEG);
+ final byte[] imgData = GraphitiUiInternal.getUiService().createImage(image, fmt);
WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor) throws CoreException {
FileOutputStream outputStream = null;
try {
- outputStream = new FileOutputStream(filename);
+ outputStream = new FileOutputStream(fname);
outputStream.write(imgData);
} catch (Exception e) {
e.printStackTrace();
diff --git a/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/ETricePreferencePage.java b/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/ETricePreferencePage.java
index a1f478e2e..eb7ad8fa0 100644
--- a/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/ETricePreferencePage.java
+++ b/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/ETricePreferencePage.java
@@ -15,6 +15,7 @@ package org.eclipse.etrice.ui.common.preferences;
import org.eclipse.etrice.ui.common.Activator;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
@@ -63,6 +64,35 @@ public class ETricePreferencePage
getFieldEditorParent());
addField(autoSave);
+ StringFieldEditor exportPath = new StringFieldEditor(PreferenceConstants.EXPORT_DIAGRAM_PATH, "&Export Diagram Path:", getFieldEditorParent());
+ addField(exportPath);
+
+ RadioGroupFieldEditor exportRelTo = new RadioGroupFieldEditor(
+ PreferenceConstants.EXPORT_DIAGRAM_PATH_RELATIVE_TO,
+ "Export Path Relative to",
+ 2,
+ new String[][] {
+ {"Project", PreferenceConstants.PATH_REL_TO_PROJECT},
+ {"Model", PreferenceConstants.PATH_REL_TO_MODEL}
+ },
+ getFieldEditorParent(),
+ true);
+ addField(exportRelTo);
+
+ RadioGroupFieldEditor imgFormat = new RadioGroupFieldEditor(
+ PreferenceConstants.EXPORT_DIAGRAM_FORMAT,
+ "Image Format for Export:",
+ 4,
+ new String[][] {
+ {"BMP", PreferenceConstants.FORMAT_BMP},
+ {"GIF", PreferenceConstants.FORMAT_GIF},
+ {"JPG", PreferenceConstants.FORMAT_JPG},
+ {"PNG", PreferenceConstants.FORMAT_PNG}
+ },
+ getFieldEditorParent(),
+ true);
+ addField(imgFormat);
+
BooleanFieldEditor useGrid = new BooleanFieldEditor(
PreferenceConstants.USE_GRID,
"Use &Grid (grid settings apply to new diagrams only)",
diff --git a/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/PreferenceConstants.java b/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/PreferenceConstants.java
index ccd17a0dc..a36a50563 100644
--- a/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/PreferenceConstants.java
+++ b/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/PreferenceConstants.java
@@ -23,4 +23,17 @@ public class PreferenceConstants extends org.eclipse.etrice.core.ui.editor.Prefe
public static final String VER_GRID_UNIT = "VerGridUnit";
public static final String CONFIRM_DELETE = "ConfirmDelete";
public static final String SAVE_DIAG_ON_FOCUS_LOST = "SaveDiagOnFocusLost";
+ public static final String EXPORT_DIAGRAM_PATH = "ExportDiagramPath";
+ public static final String EXPORT_DIAGRAM_FORMAT = "ExportDiagramFormat";
+ public static final String EXPORT_DIAGRAM_PATH_RELATIVE_TO = "ExportDiagramPathRelativeTo";
+
+ // possible values for EXPORT_DIAGRAM_PATH_RELATIVE_TO
+ public static final String PATH_REL_TO_PROJECT = "project";
+ public static final String PATH_REL_TO_MODEL = "model";
+
+ // possible values for EXPORT_DIAGRAM_FORMAT
+ public static final String FORMAT_BMP = "bmp";
+ public static final String FORMAT_JPG = "jpg";
+ public static final String FORMAT_PNG = "png";
+ public static final String FORMAT_GIF = "gif";
}
diff --git a/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/PreferenceInitializer.java b/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/PreferenceInitializer.java
index c63f8f581..b019f71cf 100644
--- a/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/PreferenceInitializer.java
+++ b/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/preferences/PreferenceInitializer.java
@@ -35,6 +35,9 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
store.setDefault(PreferenceConstants.VER_GRID_UNIT, 10);
store.setDefault(PreferenceConstants.CONFIRM_DELETE, true);
store.setDefault(PreferenceConstants.SAVE_DIAG_ON_FOCUS_LOST, false);
+ store.setDefault(PreferenceConstants.EXPORT_DIAGRAM_PATH, "doc-gen/images");
+ store.setDefault(PreferenceConstants.EXPORT_DIAGRAM_PATH_RELATIVE_TO, PreferenceConstants.PATH_REL_TO_PROJECT);
+ store.setDefault(PreferenceConstants.EXPORT_DIAGRAM_FORMAT, PreferenceConstants.FORMAT_JPG);
}
}
diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.zip
index 412b8ebc7..c32baee01 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.zip
+++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.zip
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip
index 70dc70f82..5505cfeff 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip
+++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip
index 0ad704ae5..693c9d5fd 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip
+++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/editor/StructureExporter.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/editor/StructureExporter.java
index 067a85a2e..b2f9f779e 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/editor/StructureExporter.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/editor/StructureExporter.java
@@ -20,7 +20,7 @@ import org.eclipse.etrice.ui.structure.DiagramAccess;
public class StructureExporter {
- private static final String SUFFIX = "_structure.jpg";
+ private static final String SUFFIX = "_structure";
public static void export(StructureClass ac, String folder) {
DiagramAccess da = new DiagramAccess();
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/PSocket.java b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/PSocket.java
index 40274eb33..ddc67785f 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/PSocket.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/PSocket.java
@@ -40,7 +40,7 @@ public class PSocket {
static public class PSocketPort extends PortBase {
// constructors
public PSocketPort(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
- super(actor, name, localId, 0, addr, peerAddress);
+ this(actor, name, localId, 0, addr, peerAddress);
DebuggingService.getInstance().addPortInstance(this);
}
public PSocketPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
@@ -165,7 +165,7 @@ public class PSocket {
static public class PSocketConjPort extends PortBase {
// constructors
public PSocketConjPort(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
- super(actor, name, localId, 0, addr, peerAddress);
+ this(actor, name, localId, 0, addr, peerAddress);
DebuggingService.getInstance().addPortInstance(this);
}
public PSocketConjPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/SocketClient.java b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/SocketClient.java
index ec585951b..12fd5f869 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/SocketClient.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/SocketClient.java
@@ -43,7 +43,12 @@ public class SocketClient extends ActorClassBase {
// own service implementations
}
-
+ //--------------------- attributes getter and setter
+ //--------------------- attribute setters and getters
+ //--------------------- port getters
+ public PSocketPort getFct (){
+ return this.fct;
+ }
//--------------------- lifecycle functions
public void init(){
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java
index f41af56a9..a81c972b1 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java
@@ -59,7 +59,12 @@ public class ALogService extends ActorClassBase {
// own service implementations
log = new LogReplPort(this, "log", IFITEM_log, port_addr[IFITEM_log], peer_addr[IFITEM_log]);
}
-
+ //--------------------- attributes getter and setter
+ //--------------------- attribute setters and getters
+ //--------------------- port getters
+ public LogReplPort getLog (){
+ return this.log;
+ }
//--------------------- lifecycle functions
public void init(){
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java
index 1dd7de400..8792b9036 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java
@@ -40,7 +40,7 @@ public class Log {
static public class LogPort extends PortBase {
// constructors
public LogPort(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
- super(actor, name, localId, 0, addr, peerAddress);
+ this(actor, name, localId, 0, addr, peerAddress);
DebuggingService.getInstance().addPortInstance(this);
}
public LogPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
@@ -109,11 +109,12 @@ public class Log {
/*--------------------- end user code ---------------------*/
// constructors
public LogConjPort(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
- super(actor, name, localId, 0, addr, peerAddress);
+ this(actor, name, localId, 0, addr, peerAddress);
DebuggingService.getInstance().addPortInstance(this);
}
public LogConjPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
super(actor, name, localId, idx, addr, peerAddress);
+ // initialize attributes
DebuggingService.getInstance().addPortInstance(this);
}
@@ -136,6 +137,8 @@ public class Log {
}
/*--------------------- attributes ---------------------*/
+ // TODO JH: Avoid collision attr getters/setter <-> user operations
+ //--------------------- attribute setters and getters
/*--------------------- operations ---------------------*/
public void setLogLevel(int l) {
logLevel=l;
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/ATcpClient.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/ATcpClient.java
index 0235dd02c..d72a21bcb 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/ATcpClient.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/ATcpClient.java
@@ -90,7 +90,21 @@ public class ATcpClient extends ActorClassBase {
// own service implementations
}
-
+ //--------------------- attributes getter and setter
+ //--------------------- attribute setters and getters
+ public void setLastError (int lastError) {
+ this.lastError = lastError;
+ }
+ public int getLastError () {
+ return this.lastError;
+ }
+ //--------------------- port getters
+ public PTcpControlPort getControlPort (){
+ return this.ControlPort;
+ }
+ public PTcpPayloadPort getPayloadPort (){
+ return this.PayloadPort;
+ }
//--------------------- lifecycle functions
public void init(){
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/ATcpServer.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/ATcpServer.java
index ae00eceea..84991821e 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/ATcpServer.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/ATcpServer.java
@@ -126,7 +126,27 @@ public class ATcpServer extends ActorClassBase {
// own service implementations
}
-
+ //--------------------- attributes getter and setter
+ //--------------------- attribute setters and getters
+ public void setLastError (int lastError) {
+ this.lastError = lastError;
+ }
+ public int getLastError () {
+ return this.lastError;
+ }
+ public void setPayloadPortReplocation (int payloadPortReplocation) {
+ this.payloadPortReplocation = payloadPortReplocation;
+ }
+ public int getPayloadPortReplocation () {
+ return this.payloadPortReplocation;
+ }
+ //--------------------- port getters
+ public PTcpControlPort getControlPort (){
+ return this.ControlPort;
+ }
+ public PTcpPayloadPort getPayloadPort (){
+ return this.PayloadPort;
+ }
//--------------------- lifecycle functions
public void init(){
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/PTcpControl.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/PTcpControl.java
index 1ac008a8b..1bddfd5bc 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/PTcpControl.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/PTcpControl.java
@@ -36,7 +36,7 @@ public class PTcpControl {
static public class PTcpControlPort extends PortBase {
// constructors
public PTcpControlPort(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
- super(actor, name, localId, 0, addr, peerAddress);
+ this(actor, name, localId, 0, addr, peerAddress);
DebuggingService.getInstance().addPortInstance(this);
}
public PTcpControlPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
@@ -125,7 +125,7 @@ public class PTcpControl {
static public class PTcpControlConjPort extends PortBase {
// constructors
public PTcpControlConjPort(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
- super(actor, name, localId, 0, addr, peerAddress);
+ this(actor, name, localId, 0, addr, peerAddress);
DebuggingService.getInstance().addPortInstance(this);
}
public PTcpControlConjPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/PTcpPayload.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/PTcpPayload.java
index 20069530b..dbec6de16 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/PTcpPayload.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/tcp/PTcpPayload.java
@@ -34,7 +34,7 @@ public class PTcpPayload {
static public class PTcpPayloadPort extends PortBase {
// constructors
public PTcpPayloadPort(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
- super(actor, name, localId, 0, addr, peerAddress);
+ this(actor, name, localId, 0, addr, peerAddress);
DebuggingService.getInstance().addPortInstance(this);
}
public PTcpPayloadPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
@@ -114,7 +114,7 @@ public class PTcpPayload {
static public class PTcpPayloadConjPort extends PortBase {
// constructors
public PTcpPayloadConjPort(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
- super(actor, name, localId, 0, addr, peerAddress);
+ this(actor, name, localId, 0, addr, peerAddress);
DebuggingService.getInstance().addPortInstance(this);
}
public PTcpPayloadConjPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/ATimingService.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/ATimingService.java
index 0b7b1218b..ac20bc769 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/ATimingService.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/ATimingService.java
@@ -60,7 +60,15 @@ public class ATimingService extends ActorClassBase {
timeout = new PTimeoutReplPort(this, "timeout", IFITEM_timeout, port_addr[IFITEM_timeout], peer_addr[IFITEM_timeout]);
timer = new PTimerReplPort(this, "timer", IFITEM_timer, port_addr[IFITEM_timer], peer_addr[IFITEM_timer]);
}
-
+ //--------------------- attributes getter and setter
+ //--------------------- attribute setters and getters
+ //--------------------- port getters
+ public PTimeoutReplPort getTimeout (){
+ return this.timeout;
+ }
+ public PTimerReplPort getTimer (){
+ return this.timer;
+ }
//--------------------- lifecycle functions
public void init(){
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java
index 5134cb26a..c5314c07c 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java
@@ -72,11 +72,12 @@ public class PTimeout {
/*--------------------- end user code ---------------------*/
// constructors
public PTimeoutPort(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
- super(actor, name, localId, 0, addr, peerAddress);
+ this(actor, name, localId, 0, addr, peerAddress);
DebuggingService.getInstance().addPortInstance(this);
}
public PTimeoutPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
super(actor, name, localId, idx, addr, peerAddress);
+ // initialize attributes
DebuggingService.getInstance().addPortInstance(this);
}
@@ -121,6 +122,8 @@ public class PTimeout {
}
/*--------------------- attributes ---------------------*/
+ // TODO JH: Avoid collision attr getters/setter <-> user operations
+ //--------------------- attribute setters and getters
/*--------------------- operations ---------------------*/
// sent messages
@@ -192,11 +195,12 @@ public class PTimeout {
/*--------------------- end user code ---------------------*/
// constructors
public PTimeoutConjPort(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
- super(actor, name, localId, 0, addr, peerAddress);
+ this(actor, name, localId, 0, addr, peerAddress);
DebuggingService.getInstance().addPortInstance(this);
}
public PTimeoutConjPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
super(actor, name, localId, idx, addr, peerAddress);
+ // initialize attributes
DebuggingService.getInstance().addPortInstance(this);
}
@@ -233,6 +237,8 @@ public class PTimeout {
}
/*--------------------- attributes ---------------------*/
+ // TODO JH: Avoid collision attr getters/setter <-> user operations
+ //--------------------- attribute setters and getters
/*--------------------- operations ---------------------*/
public void Start(int time_ms) {
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java
index 06b6d0ea5..375b19ae1 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java
@@ -72,11 +72,12 @@ public class PTimer {
/*--------------------- end user code ---------------------*/
// constructors
public PTimerPort(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
- super(actor, name, localId, 0, addr, peerAddress);
+ this(actor, name, localId, 0, addr, peerAddress);
DebuggingService.getInstance().addPortInstance(this);
}
public PTimerPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
super(actor, name, localId, idx, addr, peerAddress);
+ // initialize attributes
DebuggingService.getInstance().addPortInstance(this);
}
@@ -121,6 +122,8 @@ public class PTimer {
}
/*--------------------- attributes ---------------------*/
+ // TODO JH: Avoid collision attr getters/setter <-> user operations
+ //--------------------- attribute setters and getters
/*--------------------- operations ---------------------*/
// sent messages
@@ -192,11 +195,12 @@ public class PTimer {
/*--------------------- end user code ---------------------*/
// constructors
public PTimerConjPort(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
- super(actor, name, localId, 0, addr, peerAddress);
+ this(actor, name, localId, 0, addr, peerAddress);
DebuggingService.getInstance().addPortInstance(this);
}
public PTimerConjPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
super(actor, name, localId, idx, addr, peerAddress);
+ // initialize attributes
DebuggingService.getInstance().addPortInstance(this);
}
@@ -232,6 +236,8 @@ public class PTimer {
}
/*--------------------- attributes ---------------------*/
+ // TODO JH: Avoid collision attr getters/setter <-> user operations
+ //--------------------- attribute setters and getters
/*--------------------- operations ---------------------*/
public void Start(int time_ms) {
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java
index ef8f6bfa0..def604fe6 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java
@@ -70,7 +70,7 @@ public class TestStatesInheritance extends TestInstanceModelBuilderBase {
@Test
public void testNumbers() {
- assertEquals("number of states", 11, instances.get(RoomPackage.eINSTANCE.getSimpleState()).size());
+ assertEquals("number of states", 9, instances.get(RoomPackage.eINSTANCE.getSimpleState()).size());
assertEquals("number of choice points", 1, instances.get(RoomPackage.eINSTANCE.getChoicePoint()).size());
assertEquals("number of transition points", 5, instances.get(RoomPackage.eINSTANCE.getTransitionPoint()).size());
assertEquals("number of entry points", 2, instances.get(RoomPackage.eINSTANCE.getEntryPoint()).size());
diff --git a/tests/org.eclipse.etrice.generator.tests/src/org/eclipse/etrice/generator/base/TestDetailCodeTranslator.java b/tests/org.eclipse.etrice.generator.tests/src/org/eclipse/etrice/generator/base/TestDetailCodeTranslator.java
index 6d782feaa..e82fe49d7 100644
--- a/tests/org.eclipse.etrice.generator.tests/src/org/eclipse/etrice/generator/base/TestDetailCodeTranslator.java
+++ b/tests/org.eclipse.etrice.generator.tests/src/org/eclipse/etrice/generator/base/TestDetailCodeTranslator.java
@@ -424,8 +424,13 @@ public class TestDetailCodeTranslator {
@Test (timeout=1000)
public void testLargeFile() {
DetailCode dc = getLargeFile();
+
+ // this adds a trailing \n
String orig = RoomHelpers.getDetailCode(dc);
+ // remove trailing \n
+ orig = orig.substring(0, orig.length()-1);
+
String result = translator.translateDetailCode(dc);
assertEquals("large file", orig, result);

Back to the top