diff options
author | Henrik Rentz-Reichert | 2012-06-15 08:47:11 +0000 |
---|---|---|
committer | Henrik Rentz-Reichert | 2012-06-15 08:47:11 +0000 |
commit | 9dbf01d5563e44c57ba4c30a8cc64bb80e90915c (patch) | |
tree | 5fe7edf57b88f9daf0a78fd342b7f69f38677fe9 | |
parent | d95302628c15605c8ffd0053ca81d9545043616b (diff) | |
download | org.eclipse.etrice-9dbf01d5563e44c57ba4c30a8cc64bb80e90915c.tar.gz org.eclipse.etrice-9dbf01d5563e44c57ba4c30a8cc64bb80e90915c.tar.xz org.eclipse.etrice-9dbf01d5563e44c57ba4c30a8cc64bb80e90915c.zip |
[core.room] added convenience method getGeneralProtocol to InterfaceItem
6 files changed, 43 insertions, 0 deletions
diff --git a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore index ba2f14555..6c3988b4f 100644 --- a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore +++ b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore @@ -216,6 +216,11 @@ containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="InterfaceItem">
+ <eOperations name="getGeneralProtocol" eType="#//GeneralProtocolClass">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="body" value="if (this instanceof org.eclipse.etrice.core.room.Port)
return ((org.eclipse.etrice.core.room.Port) this).getProtocol();
else if (this instanceof org.eclipse.etrice.core.room.SAPRef)
return ((org.eclipse.etrice.core.room.SAPRef) this).getProtocol();
else if (this instanceof org.eclipse.etrice.core.room.SPPRef)
return ((org.eclipse.etrice.core.room.SPPRef) this).getProtocol();return null;"/>
+ </eAnnotations>
+ </eOperations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Port" eSuperTypes="#//InterfaceItem">
diff --git a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.genmodel b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.genmodel index 539ffafe1..9c75e47df 100644 --- a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.genmodel +++ b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.genmodel @@ -164,6 +164,7 @@ </genClasses>
<genClasses ecoreClass="Room.ecore#//InterfaceItem">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Room.ecore#//InterfaceItem/name"/>
+ <genOperations ecoreOperation="Room.ecore#//InterfaceItem/getGeneralProtocol"/>
</genClasses>
<genClasses ecoreClass="Room.ecore#//Port">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Room.ecore#//Port/conjugated"/>
diff --git a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/InterfaceItem.java b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/InterfaceItem.java index 24e74b7f0..f3fa73811 100644 --- a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/InterfaceItem.java +++ b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/InterfaceItem.java @@ -52,4 +52,13 @@ public interface InterfaceItem extends EObject */
void setName(String value);
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model kind="operation"
+ * annotation="http://www.eclipse.org/emf/2002/GenModel body='if (this instanceof org.eclipse.etrice.core.room.Port)\nreturn ((org.eclipse.etrice.core.room.Port) this).getProtocol();\nelse if (this instanceof org.eclipse.etrice.core.room.SAPRef)\nreturn ((org.eclipse.etrice.core.room.SAPRef) this).getProtocol();\nelse if (this instanceof org.eclipse.etrice.core.room.SPPRef)\nreturn ((org.eclipse.etrice.core.room.SPPRef) this).getProtocol();return null;'"
+ * @generated
+ */
+ GeneralProtocolClass getGeneralProtocol();
+
} // InterfaceItem
diff --git a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/impl/InterfaceItemImpl.java b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/impl/InterfaceItemImpl.java index df7dce742..a1d133b9b 100644 --- a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/impl/InterfaceItemImpl.java +++ b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/impl/InterfaceItemImpl.java @@ -13,6 +13,7 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
+import org.eclipse.etrice.core.room.GeneralProtocolClass;
import org.eclipse.etrice.core.room.InterfaceItem;
import org.eclipse.etrice.core.room.RoomPackage;
@@ -100,6 +101,21 @@ public class InterfaceItemImpl extends MinimalEObjectImpl.Container implements I * <!-- end-user-doc -->
* @generated
*/
+ public GeneralProtocolClass getGeneralProtocol()
+ {
+ if (this instanceof org.eclipse.etrice.core.room.Port)
+ return ((org.eclipse.etrice.core.room.Port) this).getProtocol();
+ else if (this instanceof org.eclipse.etrice.core.room.SAPRef)
+ return ((org.eclipse.etrice.core.room.SAPRef) this).getProtocol();
+ else if (this instanceof org.eclipse.etrice.core.room.SPPRef)
+ return ((org.eclipse.etrice.core.room.SPPRef) this).getProtocol();return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
diff --git a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/impl/RoomPackageImpl.java b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/impl/RoomPackageImpl.java index 11bfbce56..b5c67fc1d 100644 --- a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/impl/RoomPackageImpl.java +++ b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/room/impl/RoomPackageImpl.java @@ -3738,6 +3738,8 @@ public class RoomPackageImpl extends EPackageImpl implements RoomPackage initEClass(interfaceItemEClass, InterfaceItem.class, "InterfaceItem", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getInterfaceItem_Name(), ecorePackage.getEString(), "name", null, 0, 1, InterfaceItem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ addEOperation(interfaceItemEClass, this.getGeneralProtocolClass(), "getGeneralProtocol", 0, 1, IS_UNIQUE, IS_ORDERED);
+
initEClass(portEClass, Port.class, "Port", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getPort_Conjugated(), ecorePackage.getEBoolean(), "conjugated", null, 0, 1, Port.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getPort_Multiplicity(), ecorePackage.getEInt(), "multiplicity", "1", 0, 1, Port.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomPostprocessor.ext b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomPostprocessor.ext index 6620fa631..261dfcd84 100644 --- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomPostprocessor.ext +++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomPostprocessor.ext @@ -10,6 +10,7 @@ *
*******************************************************************************/
+// possible improvement: http://christiandietrich.wordpress.com/2011/07/22/customizing-xtext-metamodel-inference-using-xtend2/
import ecore;
import xtext;
@@ -30,6 +31,7 @@ process(EClass this) : case "ActorRef": (eAllAttributes.select(e|e.name=="size").first().setDefaultValueLiteral("1"))
case "State": (addOperation("getName", getEcoreDataType("EString")))
case "StateGraphItem": (addOperation("getName", getEcoreDataType("EString")))
+ case "InterfaceItem": (addOperation("getGeneralProtocol", ePackage.getEClassifier("GeneralProtocolClass")))
default: null
}
;
@@ -71,6 +73,14 @@ create EAnnotation newDelegatingBodyAnnotation(EClass cls, EOperation op) : })
case "isReplicated":
(d.setValue("return multiplicity>1 || multiplicity==-1;"))
+ case "getGeneralProtocol":
+ (d.setValue("if (this instanceof org.eclipse.etrice.core.room.Port)\n"
+ +"return ((org.eclipse.etrice.core.room.Port) this).getProtocol();\n"
+ +"else if (this instanceof org.eclipse.etrice.core.room.SAPRef)\n"
+ +"return ((org.eclipse.etrice.core.room.SAPRef) this).getProtocol();\n"
+ +"else if (this instanceof org.eclipse.etrice.core.room.SPPRef)\n"
+ +"return ((org.eclipse.etrice.core.room.SPPRef) this).getProtocol();"
+ +"return null;"))
default: null
} ->
details.add(d) ->
|