From ac72ac79d490011ded45bd8b0280b2b4668c19d3 Mon Sep 17 00:00:00 2001
From: Anish Bhobe
+ * The following features are supported: + *
+ *+ * The following features are supported: + *
+ *+ * The following features are implemented: + *
+ *Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see fr.tpt.mem4csd.lossTransform.LossTransformPackage#eNS_URI + * @see #init() + * @generated + */ + private LossTransformPackageImpl() { + super(eNS_URI, LossTransformFactory.eINSTANCE); + } + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *
This method is used to initialize {@link LossTransformPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static LossTransformPackage init() { + if (isInited) return (LossTransformPackage)EPackage.Registry.INSTANCE.getEPackage(LossTransformPackage.eNS_URI); + + // Obtain or create and register package + Object registeredLossTransformPackage = EPackage.Registry.INSTANCE.get(eNS_URI); + LossTransformPackageImpl theLossTransformPackage = registeredLossTransformPackage instanceof LossTransformPackageImpl ? (LossTransformPackageImpl)registeredLossTransformPackage : new LossTransformPackageImpl(); + + isInited = true; + + // Initialize simple dependencies + EcorePackage.eINSTANCE.eClass(); + LossPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theLossTransformPackage.createPackageContents(); + + // Initialize created meta-data + theLossTransformPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theLossTransformPackage.freeze(); + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(LossTransformPackage.eNS_URI, theLossTransformPackage); + return theLossTransformPackage; + } + + /** + * + * + * @generated + */ + @Override + public EClass getCorrelation() { + return correlationEClass; + } + + /** + * + * + * @generated + */ + @Override + public EClass getCorrNode() { + return corrNodeEClass; + } + + /** + * + * + * @generated + */ + @Override + public EReference getCorrNode_LeftLinks() { + return (EReference)corrNodeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public EReference getCorrNode_RightLinks() { + return (EReference)corrNodeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + @Override + public EClass getRule() { + return ruleEClass; + } + + /** + * + * + * @generated + */ + @Override + public EReference getRule_LeftModel() { + return (EReference)ruleEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public EReference getRule_RightModel() { + return (EReference)ruleEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + @Override + public EReference getRule_Transformations() { + return (EReference)ruleEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + @Override + public LossTransformFactory getLossTransformFactory() { + return (LossTransformFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + correlationEClass = createEClass(CORRELATION); + + corrNodeEClass = createEClass(CORR_NODE); + createEReference(corrNodeEClass, CORR_NODE__LEFT_LINKS); + createEReference(corrNodeEClass, CORR_NODE__RIGHT_LINKS); + + ruleEClass = createEClass(RULE); + createEReference(ruleEClass, RULE__LEFT_MODEL); + createEReference(ruleEClass, RULE__RIGHT_MODEL); + createEReference(ruleEClass, RULE__TRANSFORMATIONS); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + LossPackage theLossPackage = (LossPackage)EPackage.Registry.INSTANCE.getEPackage(LossPackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + correlationEClass.getESuperTypes().add(theLossPackage.getNamedObject()); + corrNodeEClass.getESuperTypes().add(this.getCorrelation()); + ruleEClass.getESuperTypes().add(this.getCorrelation()); + + // Initialize classes, features, and operations; add parameters + initEClass(correlationEClass, Correlation.class, "Correlation", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + initEClass(corrNodeEClass, CorrNode.class, "CorrNode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getCorrNode_LeftLinks(), theLossPackage.getModelElement(), null, "leftLinks", null, 0, -1, CorrNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getCorrNode_RightLinks(), theLossPackage.getModelElement(), null, "rightLinks", null, 0, -1, CorrNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(ruleEClass, Rule.class, "Rule", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getRule_LeftModel(), theLossPackage.getModelElement(), null, "leftModel", null, 0, -1, Rule.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getRule_RightModel(), theLossPackage.getModelElement(), null, "rightModel", null, 0, -1, Rule.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getRule_Transformations(), this.getCorrNode(), null, "transformations", null, 0, -1, Rule.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} //LossTransformPackageImpl diff --git a/fr.tpt.mem4csd.loss/src/fr/tpt/mem4csd/lossTransform/impl/RuleImpl.java b/fr.tpt.mem4csd.loss/src/fr/tpt/mem4csd/lossTransform/impl/RuleImpl.java new file mode 100644 index 0000000..5a78c4a --- /dev/null +++ b/fr.tpt.mem4csd.loss/src/fr/tpt/mem4csd/lossTransform/impl/RuleImpl.java @@ -0,0 +1,226 @@ +/** + */ +package fr.tpt.mem4csd.lossTransform.impl; + +import fr.tpt.mem4csd.loss.ModelElement; + +import fr.tpt.mem4csd.lossTransform.CorrNode; +import fr.tpt.mem4csd.lossTransform.LossTransformPackage; +import fr.tpt.mem4csd.lossTransform.Rule; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Rule'. + * + *
+ * The following features are implemented: + *
+ *createXXX method for each class of the model.
+ *
+ * @see fr.tpt.mem4csd.lossTransform.LossTransformPackage
+ * @generated
+ */
+public class LossTransformAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ *
+ *
+ * @generated
+ */
+ protected static LossTransformPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ *
+ *
+ * @generated
+ */
+ public LossTransformAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = LossTransformPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ *
+ * This implementation returns true if the object is either the model's package or is an instance object of the model.
+ *
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the createXXX methods.
+ *
+ *
+ * @generated
+ */
+ protected LossTransformSwitchtarget.
+ *
+ *
+ * @param target the object to adapt.
+ * @return the adapter for the target.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link fr.tpt.mem4csd.lossTransform.Correlation Correlation}'.
+ *
+ * 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.
+ *
+ * @return the new adapter.
+ * @see fr.tpt.mem4csd.lossTransform.Correlation
+ * @generated
+ */
+ public Adapter createCorrelationAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link fr.tpt.mem4csd.lossTransform.CorrNode Corr Node}'.
+ *
+ * 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.
+ *
+ * @return the new adapter.
+ * @see fr.tpt.mem4csd.lossTransform.CorrNode
+ * @generated
+ */
+ public Adapter createCorrNodeAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link fr.tpt.mem4csd.lossTransform.Rule Rule}'.
+ *
+ * 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.
+ *
+ * @return the new adapter.
+ * @see fr.tpt.mem4csd.lossTransform.Rule
+ * @generated
+ */
+ public Adapter createRuleAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link fr.tpt.mem4csd.loss.NamedObject Named Object}'.
+ *
+ * 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.
+ *
+ * @return the new adapter.
+ * @see fr.tpt.mem4csd.loss.NamedObject
+ * @generated
+ */
+ public Adapter createNamedObjectAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ *
+ * This default implementation returns null.
+ *
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //LossTransformAdapterFactory
diff --git a/fr.tpt.mem4csd.loss/src/fr/tpt/mem4csd/lossTransform/util/LossTransformSwitch.java b/fr.tpt.mem4csd.loss/src/fr/tpt/mem4csd/lossTransform/util/LossTransformSwitch.java
new file mode 100644
index 0000000..31ce0ac
--- /dev/null
+++ b/fr.tpt.mem4csd.loss/src/fr/tpt/mem4csd/lossTransform/util/LossTransformSwitch.java
@@ -0,0 +1,174 @@
+/**
+ */
+package fr.tpt.mem4csd.lossTransform.util;
+
+import fr.tpt.mem4csd.loss.NamedObject;
+
+import fr.tpt.mem4csd.lossTransform.*;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.util.Switch;
+
+/**
+ *
+ * The Switch for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the caseXXX method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ *
+ * @see fr.tpt.mem4csd.lossTransform.LossTransformPackage
+ * @generated
+ */
+public class LossTransformSwitchcaseXXX for each class of the model until one returns a non null result; it yields that result.
+ *
+ *
+ * @return the first non-null result returned by a caseXXX call.
+ * @generated
+ */
+ @Override
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case LossTransformPackage.CORRELATION: {
+ Correlation correlation = (Correlation)theEObject;
+ T result = caseCorrelation(correlation);
+ if (result == null) result = caseNamedObject(correlation);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case LossTransformPackage.CORR_NODE: {
+ CorrNode corrNode = (CorrNode)theEObject;
+ T result = caseCorrNode(corrNode);
+ if (result == null) result = caseCorrelation(corrNode);
+ if (result == null) result = caseNamedObject(corrNode);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case LossTransformPackage.RULE: {
+ Rule rule = (Rule)theEObject;
+ T result = caseRule(rule);
+ if (result == null) result = caseCorrelation(rule);
+ if (result == null) result = caseNamedObject(rule);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of 'Correlation'.
+ *
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ *
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of 'Correlation'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseCorrelation(Correlation object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of 'Corr Node'.
+ *
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ *
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of 'Corr Node'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseCorrNode(CorrNode object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of 'Rule'.
+ *
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ *
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of 'Rule'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseRule(Rule object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of 'Named Object'.
+ *
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ *
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of 'Named Object'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNamedObject(NamedObject object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of 'EObject'.
+ *
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ *
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of 'EObject'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ @Override
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //LossTransformSwitch