From d76c1c496b0774e28b699dd5ff4f446d580fd986 Mon Sep 17 00:00:00 2001 From: ArenBabikian Date: Mon, 20 May 2019 18:47:20 -0400 Subject: REALMET: implement incoming edges in visualisation. multips need fix --- .../src/simpleStatechart/Entry.java | 50 +++ .../simpleStatechart/SimpleStatechartFactory.java | 60 ++++ .../simpleStatechart/SimpleStatechartPackage.java | 340 +++++++++++++++++++++ .../src/simpleStatechart/State.java | 42 +++ .../src/simpleStatechart/Statechart.java | 69 +++++ .../src/simpleStatechart/impl/EntryImpl.java | 157 ++++++++++ .../impl/SimpleStatechartFactoryImpl.java | 117 +++++++ .../impl/SimpleStatechartPackageImpl.java | 252 +++++++++++++++ .../src/simpleStatechart/impl/StateImpl.java | 133 ++++++++ .../src/simpleStatechart/impl/StatechartImpl.java | 221 ++++++++++++++ .../util/SimpleStatechartAdapterFactory.java | 156 ++++++++++ .../util/SimpleStatechartSwitch.java | 152 +++++++++ 12 files changed, 1749 insertions(+) create mode 100644 Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/Entry.java create mode 100644 Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/SimpleStatechartFactory.java create mode 100644 Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/SimpleStatechartPackage.java create mode 100644 Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/State.java create mode 100644 Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/Statechart.java create mode 100644 Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/EntryImpl.java create mode 100644 Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/SimpleStatechartFactoryImpl.java create mode 100644 Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/SimpleStatechartPackageImpl.java create mode 100644 Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/StateImpl.java create mode 100644 Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/StatechartImpl.java create mode 100644 Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util/SimpleStatechartAdapterFactory.java create mode 100644 Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util/SimpleStatechartSwitch.java (limited to 'Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart') diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/Entry.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/Entry.java new file mode 100644 index 00000000..10203691 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/Entry.java @@ -0,0 +1,50 @@ +/** + */ +package simpleStatechart; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Entry'. + * + * + *

+ * The following features are supported: + *

+ * + * + * @see simpleStatechart.SimpleStatechartPackage#getEntry() + * @model + * @generated + */ +public interface Entry extends EObject { + /** + * Returns the value of the 'Entry' reference. + * + *

+ * If the meaning of the 'Entry' reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Entry' reference. + * @see #setEntry(State) + * @see simpleStatechart.SimpleStatechartPackage#getEntry_Entry() + * @model + * @generated + */ + State getEntry(); + + /** + * Sets the value of the '{@link simpleStatechart.Entry#getEntry Entry}' reference. + * + * + * @param value the new value of the 'Entry' reference. + * @see #getEntry() + * @generated + */ + void setEntry(State value); + +} // Entry diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/SimpleStatechartFactory.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/SimpleStatechartFactory.java new file mode 100644 index 00000000..a185daa0 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/SimpleStatechartFactory.java @@ -0,0 +1,60 @@ +/** + */ +package simpleStatechart; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see simpleStatechart.SimpleStatechartPackage + * @generated + */ +public interface SimpleStatechartFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + SimpleStatechartFactory eINSTANCE = simpleStatechart.impl.SimpleStatechartFactoryImpl.init(); + + /** + * Returns a new object of class 'State'. + * + * + * @return a new object of class 'State'. + * @generated + */ + State createState(); + + /** + * Returns a new object of class 'Entry'. + * + * + * @return a new object of class 'Entry'. + * @generated + */ + Entry createEntry(); + + /** + * Returns a new object of class 'Statechart'. + * + * + * @return a new object of class 'Statechart'. + * @generated + */ + Statechart createStatechart(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + SimpleStatechartPackage getSimpleStatechartPackage(); + +} //SimpleStatechartFactory diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/SimpleStatechartPackage.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/SimpleStatechartPackage.java new file mode 100644 index 00000000..0d5a1042 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/SimpleStatechartPackage.java @@ -0,0 +1,340 @@ +/** + */ +package simpleStatechart; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + * + * + * @see simpleStatechart.SimpleStatechartFactory + * @model kind="package" + * @generated + */ +public interface SimpleStatechartPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "simpleStatechart"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "simpleSC"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "simpleSC"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + SimpleStatechartPackage eINSTANCE = simpleStatechart.impl.SimpleStatechartPackageImpl.init(); + + /** + * The meta object id for the '{@link simpleStatechart.impl.StateImpl State}' class. + * + * + * @see simpleStatechart.impl.StateImpl + * @see simpleStatechart.impl.SimpleStatechartPackageImpl#getState() + * @generated + */ + int STATE = 0; + + /** + * The feature id for the 'Next' reference list. + * + * + * @generated + * @ordered + */ + int STATE__NEXT = 0; + + /** + * The number of structural features of the 'State' class. + * + * + * @generated + * @ordered + */ + int STATE_FEATURE_COUNT = 1; + + /** + * The number of operations of the 'State' class. + * + * + * @generated + * @ordered + */ + int STATE_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link simpleStatechart.impl.EntryImpl Entry}' class. + * + * + * @see simpleStatechart.impl.EntryImpl + * @see simpleStatechart.impl.SimpleStatechartPackageImpl#getEntry() + * @generated + */ + int ENTRY = 1; + + /** + * The feature id for the 'Entry' reference. + * + * + * @generated + * @ordered + */ + int ENTRY__ENTRY = 0; + + /** + * The number of structural features of the 'Entry' class. + * + * + * @generated + * @ordered + */ + int ENTRY_FEATURE_COUNT = 1; + + /** + * The number of operations of the 'Entry' class. + * + * + * @generated + * @ordered + */ + int ENTRY_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link simpleStatechart.impl.StatechartImpl Statechart}' class. + * + * + * @see simpleStatechart.impl.StatechartImpl + * @see simpleStatechart.impl.SimpleStatechartPackageImpl#getStatechart() + * @generated + */ + int STATECHART = 2; + + /** + * The feature id for the 'State' containment reference list. + * + * + * @generated + * @ordered + */ + int STATECHART__STATE = 0; + + /** + * The feature id for the 'Entry' containment reference. + * + * + * @generated + * @ordered + */ + int STATECHART__ENTRY = 1; + + /** + * The number of structural features of the 'Statechart' class. + * + * + * @generated + * @ordered + */ + int STATECHART_FEATURE_COUNT = 2; + + /** + * The number of operations of the 'Statechart' class. + * + * + * @generated + * @ordered + */ + int STATECHART_OPERATION_COUNT = 0; + + + /** + * Returns the meta object for class '{@link simpleStatechart.State State}'. + * + * + * @return the meta object for class 'State'. + * @see simpleStatechart.State + * @generated + */ + EClass getState(); + + /** + * Returns the meta object for the reference list '{@link simpleStatechart.State#getNext Next}'. + * + * + * @return the meta object for the reference list 'Next'. + * @see simpleStatechart.State#getNext() + * @see #getState() + * @generated + */ + EReference getState_Next(); + + /** + * Returns the meta object for class '{@link simpleStatechart.Entry Entry}'. + * + * + * @return the meta object for class 'Entry'. + * @see simpleStatechart.Entry + * @generated + */ + EClass getEntry(); + + /** + * Returns the meta object for the reference '{@link simpleStatechart.Entry#getEntry Entry}'. + * + * + * @return the meta object for the reference 'Entry'. + * @see simpleStatechart.Entry#getEntry() + * @see #getEntry() + * @generated + */ + EReference getEntry_Entry(); + + /** + * Returns the meta object for class '{@link simpleStatechart.Statechart Statechart}'. + * + * + * @return the meta object for class 'Statechart'. + * @see simpleStatechart.Statechart + * @generated + */ + EClass getStatechart(); + + /** + * Returns the meta object for the containment reference list '{@link simpleStatechart.Statechart#getState State}'. + * + * + * @return the meta object for the containment reference list 'State'. + * @see simpleStatechart.Statechart#getState() + * @see #getStatechart() + * @generated + */ + EReference getStatechart_State(); + + /** + * Returns the meta object for the containment reference '{@link simpleStatechart.Statechart#getEntry Entry}'. + * + * + * @return the meta object for the containment reference 'Entry'. + * @see simpleStatechart.Statechart#getEntry() + * @see #getStatechart() + * @generated + */ + EReference getStatechart_Entry(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + SimpleStatechartFactory getSimpleStatechartFactory(); + + /** + * + * Defines literals for the meta objects that represent + * + * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link simpleStatechart.impl.StateImpl State}' class. + * + * + * @see simpleStatechart.impl.StateImpl + * @see simpleStatechart.impl.SimpleStatechartPackageImpl#getState() + * @generated + */ + EClass STATE = eINSTANCE.getState(); + + /** + * The meta object literal for the 'Next' reference list feature. + * + * + * @generated + */ + EReference STATE__NEXT = eINSTANCE.getState_Next(); + + /** + * The meta object literal for the '{@link simpleStatechart.impl.EntryImpl Entry}' class. + * + * + * @see simpleStatechart.impl.EntryImpl + * @see simpleStatechart.impl.SimpleStatechartPackageImpl#getEntry() + * @generated + */ + EClass ENTRY = eINSTANCE.getEntry(); + + /** + * The meta object literal for the 'Entry' reference feature. + * + * + * @generated + */ + EReference ENTRY__ENTRY = eINSTANCE.getEntry_Entry(); + + /** + * The meta object literal for the '{@link simpleStatechart.impl.StatechartImpl Statechart}' class. + * + * + * @see simpleStatechart.impl.StatechartImpl + * @see simpleStatechart.impl.SimpleStatechartPackageImpl#getStatechart() + * @generated + */ + EClass STATECHART = eINSTANCE.getStatechart(); + + /** + * The meta object literal for the 'State' containment reference list feature. + * + * + * @generated + */ + EReference STATECHART__STATE = eINSTANCE.getStatechart_State(); + + /** + * The meta object literal for the 'Entry' containment reference feature. + * + * + * @generated + */ + EReference STATECHART__ENTRY = eINSTANCE.getStatechart_Entry(); + + } + +} //SimpleStatechartPackage diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/State.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/State.java new file mode 100644 index 00000000..9f65b62b --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/State.java @@ -0,0 +1,42 @@ +/** + */ +package simpleStatechart; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'State'. + * + * + *

+ * The following features are supported: + *

+ * + * + * @see simpleStatechart.SimpleStatechartPackage#getState() + * @model + * @generated + */ +public interface State extends EObject { + /** + * Returns the value of the 'Next' reference list. + * The list contents are of type {@link simpleStatechart.State}. + * + *

+ * If the meaning of the 'Next' reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Next' reference list. + * @see simpleStatechart.SimpleStatechartPackage#getState_Next() + * @model + * @generated + */ + EList getNext(); + +} // State diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/Statechart.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/Statechart.java new file mode 100644 index 00000000..10c6dfc1 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/Statechart.java @@ -0,0 +1,69 @@ +/** + */ +package simpleStatechart; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Statechart'. + * + * + *

+ * The following features are supported: + *

+ * + * + * @see simpleStatechart.SimpleStatechartPackage#getStatechart() + * @model + * @generated + */ +public interface Statechart extends EObject { + /** + * Returns the value of the 'State' containment reference list. + * The list contents are of type {@link simpleStatechart.State}. + * + *

+ * If the meaning of the 'State' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'State' containment reference list. + * @see simpleStatechart.SimpleStatechartPackage#getStatechart_State() + * @model containment="true" + * @generated + */ + EList getState(); + + /** + * Returns the value of the 'Entry' containment reference. + * + *

+ * If the meaning of the 'Entry' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Entry' containment reference. + * @see #setEntry(Entry) + * @see simpleStatechart.SimpleStatechartPackage#getStatechart_Entry() + * @model containment="true" required="true" + * @generated + */ + Entry getEntry(); + + /** + * Sets the value of the '{@link simpleStatechart.Statechart#getEntry Entry}' containment reference. + * + * + * @param value the new value of the 'Entry' containment reference. + * @see #getEntry() + * @generated + */ + void setEntry(Entry value); + +} // Statechart diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/EntryImpl.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/EntryImpl.java new file mode 100644 index 00000000..0e25ace3 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/EntryImpl.java @@ -0,0 +1,157 @@ +/** + */ +package simpleStatechart.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import simpleStatechart.Entry; +import simpleStatechart.SimpleStatechartPackage; +import simpleStatechart.State; + +/** + * + * An implementation of the model object 'Entry'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link simpleStatechart.impl.EntryImpl#getEntry Entry}
  • + *
+ * + * @generated + */ +public class EntryImpl extends MinimalEObjectImpl.Container implements Entry { + /** + * The cached value of the '{@link #getEntry() Entry}' reference. + * + * + * @see #getEntry() + * @generated + * @ordered + */ + protected State entry; + + /** + * + * + * @generated + */ + protected EntryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return SimpleStatechartPackage.Literals.ENTRY; + } + + /** + * + * + * @generated + */ + public State getEntry() { + if (entry != null && entry.eIsProxy()) { + InternalEObject oldEntry = (InternalEObject)entry; + entry = (State)eResolveProxy(oldEntry); + if (entry != oldEntry) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, SimpleStatechartPackage.ENTRY__ENTRY, oldEntry, entry)); + } + } + return entry; + } + + /** + * + * + * @generated + */ + public State basicGetEntry() { + return entry; + } + + /** + * + * + * @generated + */ + public void setEntry(State newEntry) { + State oldEntry = entry; + entry = newEntry; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimpleStatechartPackage.ENTRY__ENTRY, oldEntry, entry)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SimpleStatechartPackage.ENTRY__ENTRY: + if (resolve) return getEntry(); + return basicGetEntry(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SimpleStatechartPackage.ENTRY__ENTRY: + setEntry((State)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SimpleStatechartPackage.ENTRY__ENTRY: + setEntry((State)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SimpleStatechartPackage.ENTRY__ENTRY: + return entry != null; + } + return super.eIsSet(featureID); + } + +} //EntryImpl diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/SimpleStatechartFactoryImpl.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/SimpleStatechartFactoryImpl.java new file mode 100644 index 00000000..421aee1c --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/SimpleStatechartFactoryImpl.java @@ -0,0 +1,117 @@ +/** + */ +package simpleStatechart.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import simpleStatechart.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class SimpleStatechartFactoryImpl extends EFactoryImpl implements SimpleStatechartFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static SimpleStatechartFactory init() { + try { + SimpleStatechartFactory theSimpleStatechartFactory = (SimpleStatechartFactory)EPackage.Registry.INSTANCE.getEFactory(SimpleStatechartPackage.eNS_URI); + if (theSimpleStatechartFactory != null) { + return theSimpleStatechartFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new SimpleStatechartFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public SimpleStatechartFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case SimpleStatechartPackage.STATE: return createState(); + case SimpleStatechartPackage.ENTRY: return createEntry(); + case SimpleStatechartPackage.STATECHART: return createStatechart(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public State createState() { + StateImpl state = new StateImpl(); + return state; + } + + /** + * + * + * @generated + */ + public Entry createEntry() { + EntryImpl entry = new EntryImpl(); + return entry; + } + + /** + * + * + * @generated + */ + public Statechart createStatechart() { + StatechartImpl statechart = new StatechartImpl(); + return statechart; + } + + /** + * + * + * @generated + */ + public SimpleStatechartPackage getSimpleStatechartPackage() { + return (SimpleStatechartPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static SimpleStatechartPackage getPackage() { + return SimpleStatechartPackage.eINSTANCE; + } + +} //SimpleStatechartFactoryImpl diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/SimpleStatechartPackageImpl.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/SimpleStatechartPackageImpl.java new file mode 100644 index 00000000..556157e4 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/SimpleStatechartPackageImpl.java @@ -0,0 +1,252 @@ +/** + */ +package simpleStatechart.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import simpleStatechart.Entry; +import simpleStatechart.SimpleStatechartFactory; +import simpleStatechart.SimpleStatechartPackage; +import simpleStatechart.State; +import simpleStatechart.Statechart; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class SimpleStatechartPackageImpl extends EPackageImpl implements SimpleStatechartPackage { + /** + * + * + * @generated + */ + private EClass stateEClass = null; + + /** + * + * + * @generated + */ + private EClass entryEClass = null; + + /** + * + * + * @generated + */ + private EClass statechartEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

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 simpleStatechart.SimpleStatechartPackage#eNS_URI + * @see #init() + * @generated + */ + private SimpleStatechartPackageImpl() { + super(eNS_URI, SimpleStatechartFactory.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 SimpleStatechartPackage#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 SimpleStatechartPackage init() { + if (isInited) return (SimpleStatechartPackage)EPackage.Registry.INSTANCE.getEPackage(SimpleStatechartPackage.eNS_URI); + + // Obtain or create and register package + Object registeredSimpleStatechartPackage = EPackage.Registry.INSTANCE.get(eNS_URI); + SimpleStatechartPackageImpl theSimpleStatechartPackage = registeredSimpleStatechartPackage instanceof SimpleStatechartPackageImpl ? (SimpleStatechartPackageImpl)registeredSimpleStatechartPackage : new SimpleStatechartPackageImpl(); + + isInited = true; + + // Create package meta-data objects + theSimpleStatechartPackage.createPackageContents(); + + // Initialize created meta-data + theSimpleStatechartPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theSimpleStatechartPackage.freeze(); + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(SimpleStatechartPackage.eNS_URI, theSimpleStatechartPackage); + return theSimpleStatechartPackage; + } + + /** + * + * + * @generated + */ + public EClass getState() { + return stateEClass; + } + + /** + * + * + * @generated + */ + public EReference getState_Next() { + return (EReference)stateEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getEntry() { + return entryEClass; + } + + /** + * + * + * @generated + */ + public EReference getEntry_Entry() { + return (EReference)entryEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getStatechart() { + return statechartEClass; + } + + /** + * + * + * @generated + */ + public EReference getStatechart_State() { + return (EReference)statechartEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getStatechart_Entry() { + return (EReference)statechartEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public SimpleStatechartFactory getSimpleStatechartFactory() { + return (SimpleStatechartFactory)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 + stateEClass = createEClass(STATE); + createEReference(stateEClass, STATE__NEXT); + + entryEClass = createEClass(ENTRY); + createEReference(entryEClass, ENTRY__ENTRY); + + statechartEClass = createEClass(STATECHART); + createEReference(statechartEClass, STATECHART__STATE); + createEReference(statechartEClass, STATECHART__ENTRY); + } + + /** + * + * + * @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); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + + // Initialize classes, features, and operations; add parameters + initEClass(stateEClass, State.class, "State", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getState_Next(), this.getState(), null, "next", null, 0, -1, State.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(entryEClass, Entry.class, "Entry", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getEntry_Entry(), this.getState(), null, "entry", null, 0, 1, Entry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(statechartEClass, Statechart.class, "Statechart", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getStatechart_State(), this.getState(), null, "state", null, 0, -1, Statechart.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getStatechart_Entry(), this.getEntry(), null, "entry", null, 1, 1, Statechart.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); + } + +} //SimpleStatechartPackageImpl diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/StateImpl.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/StateImpl.java new file mode 100644 index 00000000..52b97a9d --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/StateImpl.java @@ -0,0 +1,133 @@ +/** + */ +package simpleStatechart.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectResolvingEList; + +import simpleStatechart.SimpleStatechartPackage; +import simpleStatechart.State; + +/** + * + * An implementation of the model object 'State'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link simpleStatechart.impl.StateImpl#getNext Next}
  • + *
+ * + * @generated + */ +public class StateImpl extends MinimalEObjectImpl.Container implements State { + /** + * The cached value of the '{@link #getNext() Next}' reference list. + * + * + * @see #getNext() + * @generated + * @ordered + */ + protected EList next; + + /** + * + * + * @generated + */ + protected StateImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return SimpleStatechartPackage.Literals.STATE; + } + + /** + * + * + * @generated + */ + public EList getNext() { + if (next == null) { + next = new EObjectResolvingEList(State.class, this, SimpleStatechartPackage.STATE__NEXT); + } + return next; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SimpleStatechartPackage.STATE__NEXT: + return getNext(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SimpleStatechartPackage.STATE__NEXT: + getNext().clear(); + getNext().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SimpleStatechartPackage.STATE__NEXT: + getNext().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SimpleStatechartPackage.STATE__NEXT: + return next != null && !next.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //StateImpl diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/StatechartImpl.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/StatechartImpl.java new file mode 100644 index 00000000..cef2ee61 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/StatechartImpl.java @@ -0,0 +1,221 @@ +/** + */ +package simpleStatechart.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +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.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import simpleStatechart.Entry; +import simpleStatechart.SimpleStatechartPackage; +import simpleStatechart.State; +import simpleStatechart.Statechart; + +/** + * + * An implementation of the model object 'Statechart'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link simpleStatechart.impl.StatechartImpl#getState State}
  • + *
  • {@link simpleStatechart.impl.StatechartImpl#getEntry Entry}
  • + *
+ * + * @generated + */ +public class StatechartImpl extends MinimalEObjectImpl.Container implements Statechart { + /** + * The cached value of the '{@link #getState() State}' containment reference list. + * + * + * @see #getState() + * @generated + * @ordered + */ + protected EList state; + + /** + * The cached value of the '{@link #getEntry() Entry}' containment reference. + * + * + * @see #getEntry() + * @generated + * @ordered + */ + protected Entry entry; + + /** + * + * + * @generated + */ + protected StatechartImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return SimpleStatechartPackage.Literals.STATECHART; + } + + /** + * + * + * @generated + */ + public EList getState() { + if (state == null) { + state = new EObjectContainmentEList(State.class, this, SimpleStatechartPackage.STATECHART__STATE); + } + return state; + } + + /** + * + * + * @generated + */ + public Entry getEntry() { + return entry; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetEntry(Entry newEntry, NotificationChain msgs) { + Entry oldEntry = entry; + entry = newEntry; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimpleStatechartPackage.STATECHART__ENTRY, oldEntry, newEntry); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setEntry(Entry newEntry) { + if (newEntry != entry) { + NotificationChain msgs = null; + if (entry != null) + msgs = ((InternalEObject)entry).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SimpleStatechartPackage.STATECHART__ENTRY, null, msgs); + if (newEntry != null) + msgs = ((InternalEObject)newEntry).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SimpleStatechartPackage.STATECHART__ENTRY, null, msgs); + msgs = basicSetEntry(newEntry, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimpleStatechartPackage.STATECHART__ENTRY, newEntry, newEntry)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case SimpleStatechartPackage.STATECHART__STATE: + return ((InternalEList)getState()).basicRemove(otherEnd, msgs); + case SimpleStatechartPackage.STATECHART__ENTRY: + return basicSetEntry(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SimpleStatechartPackage.STATECHART__STATE: + return getState(); + case SimpleStatechartPackage.STATECHART__ENTRY: + return getEntry(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SimpleStatechartPackage.STATECHART__STATE: + getState().clear(); + getState().addAll((Collection)newValue); + return; + case SimpleStatechartPackage.STATECHART__ENTRY: + setEntry((Entry)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SimpleStatechartPackage.STATECHART__STATE: + getState().clear(); + return; + case SimpleStatechartPackage.STATECHART__ENTRY: + setEntry((Entry)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SimpleStatechartPackage.STATECHART__STATE: + return state != null && !state.isEmpty(); + case SimpleStatechartPackage.STATECHART__ENTRY: + return entry != null; + } + return super.eIsSet(featureID); + } + +} //StatechartImpl diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util/SimpleStatechartAdapterFactory.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util/SimpleStatechartAdapterFactory.java new file mode 100644 index 00000000..908a7f5f --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util/SimpleStatechartAdapterFactory.java @@ -0,0 +1,156 @@ +/** + */ +package simpleStatechart.util; + +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 simpleStatechart.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see simpleStatechart.SimpleStatechartPackage + * @generated + */ +public class SimpleStatechartAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static SimpleStatechartPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public SimpleStatechartAdapterFactory() { + if (modelPackage == null) { + modelPackage = SimpleStatechartPackage.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 SimpleStatechartSwitch modelSwitch = + new SimpleStatechartSwitch() { + @Override + public Adapter caseState(State object) { + return createStateAdapter(); + } + @Override + public Adapter caseEntry(Entry object) { + return createEntryAdapter(); + } + @Override + public Adapter caseStatechart(Statechart object) { + return createStatechartAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @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 simpleStatechart.State State}'. + * + * 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 simpleStatechart.State + * @generated + */ + public Adapter createStateAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link simpleStatechart.Entry Entry}'. + * + * 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 simpleStatechart.Entry + * @generated + */ + public Adapter createEntryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link simpleStatechart.Statechart Statechart}'. + * + * 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 simpleStatechart.Statechart + * @generated + */ + public Adapter createStatechartAdapter() { + 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; + } + +} //SimpleStatechartAdapterFactory diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util/SimpleStatechartSwitch.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util/SimpleStatechartSwitch.java new file mode 100644 index 00000000..30c60e74 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util/SimpleStatechartSwitch.java @@ -0,0 +1,152 @@ +/** + */ +package simpleStatechart.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +import simpleStatechart.*; + +/** + * + * 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 simpleStatechart.SimpleStatechartPackage + * @generated + */ +public class SimpleStatechartSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static SimpleStatechartPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public SimpleStatechartSwitch() { + if (modelPackage == null) { + modelPackage = SimpleStatechartPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @param ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX 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 SimpleStatechartPackage.STATE: { + State state = (State)theEObject; + T result = caseState(state); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SimpleStatechartPackage.ENTRY: { + Entry entry = (Entry)theEObject; + T result = caseEntry(entry); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SimpleStatechartPackage.STATECHART: { + Statechart statechart = (Statechart)theEObject; + T result = caseStatechart(statechart); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'State'. + * + * 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 'State'. + * @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 'Entry'. + * + * 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 'Entry'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEntry(Entry object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Statechart'. + * + * 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 'Statechart'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseStatechart(Statechart 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; + } + +} //SimpleStatechartSwitch -- cgit v1.2.3-54-g00ecf