From a620f07468780778bd55dcffc30245def37ece69 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Thu, 6 Aug 2020 16:07:16 +0200 Subject: MoDeS3 unit propagation WIP --- .../ecore-gen/modes3/impl/Modes3FactoryImpl.java | 128 ++++++++ .../ecore-gen/modes3/impl/Modes3ModelRootImpl.java | 296 +++++++++++++++++ .../ecore-gen/modes3/impl/Modes3PackageImpl.java | 363 +++++++++++++++++++++ .../ecore-gen/modes3/impl/SegmentImpl.java | 319 ++++++++++++++++++ .../ecore-gen/modes3/impl/TrainImpl.java | 332 +++++++++++++++++++ .../ecore-gen/modes3/impl/TurnoutImpl.java | 216 ++++++++++++ 6 files changed, 1654 insertions(+) create mode 100644 Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/Modes3FactoryImpl.java create mode 100644 Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/Modes3ModelRootImpl.java create mode 100644 Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/Modes3PackageImpl.java create mode 100644 Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/SegmentImpl.java create mode 100644 Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/TrainImpl.java create mode 100644 Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/TurnoutImpl.java (limited to 'Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl') diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/Modes3FactoryImpl.java b/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/Modes3FactoryImpl.java new file mode 100644 index 00000000..6ec86cb6 --- /dev/null +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/Modes3FactoryImpl.java @@ -0,0 +1,128 @@ +/** + */ +package modes3.impl; + +import modes3.*; + +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; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class Modes3FactoryImpl extends EFactoryImpl implements Modes3Factory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static Modes3Factory init() { + try { + Modes3Factory theModes3Factory = (Modes3Factory)EPackage.Registry.INSTANCE.getEFactory(Modes3Package.eNS_URI); + if (theModes3Factory != null) { + return theModes3Factory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new Modes3FactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public Modes3FactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case Modes3Package.SEGMENT: return createSegment(); + case Modes3Package.MODES3_MODEL_ROOT: return createModes3ModelRoot(); + case Modes3Package.TURNOUT: return createTurnout(); + case Modes3Package.TRAIN: return createTrain(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public Segment createSegment() { + SegmentImpl segment = new SegmentImpl(); + return segment; + } + + /** + * + * + * @generated + */ + public Modes3ModelRoot createModes3ModelRoot() { + Modes3ModelRootImpl modes3ModelRoot = new Modes3ModelRootImpl(); + return modes3ModelRoot; + } + + /** + * + * + * @generated + */ + public Turnout createTurnout() { + TurnoutImpl turnout = new TurnoutImpl(); + return turnout; + } + + /** + * + * + * @generated + */ + public Train createTrain() { + TrainImpl train = new TrainImpl(); + return train; + } + + /** + * + * + * @generated + */ + public Modes3Package getModes3Package() { + return (Modes3Package)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static Modes3Package getPackage() { + return Modes3Package.eINSTANCE; + } + +} //Modes3FactoryImpl diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/Modes3ModelRootImpl.java b/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/Modes3ModelRootImpl.java new file mode 100644 index 00000000..d1ee25ff --- /dev/null +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/Modes3ModelRootImpl.java @@ -0,0 +1,296 @@ +/** + */ +package modes3.impl; + +import java.util.Collection; + +import modes3.Modes3ModelRoot; +import modes3.Modes3Package; +import modes3.Segment; +import modes3.Train; +import modes3.Turnout; + +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; + +/** + * + * An implementation of the model object 'Model Root'. + * + *

+ * The following features are implemented: + *

+ * + * + * @generated + */ +public class Modes3ModelRootImpl extends MinimalEObjectImpl.Container implements Modes3ModelRoot { + /** + * The default value of the '{@link #getId() Id}' attribute. + * + * + * @see #getId() + * @generated + * @ordered + */ + protected static final int ID_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getId() Id}' attribute. + * + * + * @see #getId() + * @generated + * @ordered + */ + protected int id = ID_EDEFAULT; + + /** + * The cached value of the '{@link #getTrains() Trains}' containment reference list. + * + * + * @see #getTrains() + * @generated + * @ordered + */ + protected EList trains; + + /** + * The cached value of the '{@link #getSegments() Segments}' containment reference list. + * + * + * @see #getSegments() + * @generated + * @ordered + */ + protected EList segments; + + /** + * The cached value of the '{@link #getTurnouts() Turnouts}' containment reference list. + * + * + * @see #getTurnouts() + * @generated + * @ordered + */ + protected EList turnouts; + + /** + * + * + * @generated + */ + protected Modes3ModelRootImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return Modes3Package.Literals.MODES3_MODEL_ROOT; + } + + /** + * + * + * @generated + */ + public int getId() { + return id; + } + + /** + * + * + * @generated + */ + public void setId(int newId) { + int oldId = id; + id = newId; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, Modes3Package.MODES3_MODEL_ROOT__ID, oldId, id)); + } + + /** + * + * + * @generated + */ + public EList getTrains() { + if (trains == null) { + trains = new EObjectContainmentEList(Train.class, this, Modes3Package.MODES3_MODEL_ROOT__TRAINS); + } + return trains; + } + + /** + * + * + * @generated + */ + public EList getSegments() { + if (segments == null) { + segments = new EObjectContainmentEList(Segment.class, this, Modes3Package.MODES3_MODEL_ROOT__SEGMENTS); + } + return segments; + } + + /** + * + * + * @generated + */ + public EList getTurnouts() { + if (turnouts == null) { + turnouts = new EObjectContainmentEList(Turnout.class, this, Modes3Package.MODES3_MODEL_ROOT__TURNOUTS); + } + return turnouts; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case Modes3Package.MODES3_MODEL_ROOT__TRAINS: + return ((InternalEList)getTrains()).basicRemove(otherEnd, msgs); + case Modes3Package.MODES3_MODEL_ROOT__SEGMENTS: + return ((InternalEList)getSegments()).basicRemove(otherEnd, msgs); + case Modes3Package.MODES3_MODEL_ROOT__TURNOUTS: + return ((InternalEList)getTurnouts()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case Modes3Package.MODES3_MODEL_ROOT__ID: + return getId(); + case Modes3Package.MODES3_MODEL_ROOT__TRAINS: + return getTrains(); + case Modes3Package.MODES3_MODEL_ROOT__SEGMENTS: + return getSegments(); + case Modes3Package.MODES3_MODEL_ROOT__TURNOUTS: + return getTurnouts(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case Modes3Package.MODES3_MODEL_ROOT__ID: + setId((Integer)newValue); + return; + case Modes3Package.MODES3_MODEL_ROOT__TRAINS: + getTrains().clear(); + getTrains().addAll((Collection)newValue); + return; + case Modes3Package.MODES3_MODEL_ROOT__SEGMENTS: + getSegments().clear(); + getSegments().addAll((Collection)newValue); + return; + case Modes3Package.MODES3_MODEL_ROOT__TURNOUTS: + getTurnouts().clear(); + getTurnouts().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case Modes3Package.MODES3_MODEL_ROOT__ID: + setId(ID_EDEFAULT); + return; + case Modes3Package.MODES3_MODEL_ROOT__TRAINS: + getTrains().clear(); + return; + case Modes3Package.MODES3_MODEL_ROOT__SEGMENTS: + getSegments().clear(); + return; + case Modes3Package.MODES3_MODEL_ROOT__TURNOUTS: + getTurnouts().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case Modes3Package.MODES3_MODEL_ROOT__ID: + return id != ID_EDEFAULT; + case Modes3Package.MODES3_MODEL_ROOT__TRAINS: + return trains != null && !trains.isEmpty(); + case Modes3Package.MODES3_MODEL_ROOT__SEGMENTS: + return segments != null && !segments.isEmpty(); + case Modes3Package.MODES3_MODEL_ROOT__TURNOUTS: + return turnouts != null && !turnouts.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (id: "); + result.append(id); + result.append(')'); + return result.toString(); + } + +} //Modes3ModelRootImpl diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/Modes3PackageImpl.java b/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/Modes3PackageImpl.java new file mode 100644 index 00000000..2b9e828c --- /dev/null +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/Modes3PackageImpl.java @@ -0,0 +1,363 @@ +/** + */ +package modes3.impl; + +import modes3.Modes3Factory; +import modes3.Modes3ModelRoot; +import modes3.Modes3Package; +import modes3.Segment; +import modes3.Train; +import modes3.Turnout; + +import org.eclipse.emf.ecore.EAttribute; +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; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class Modes3PackageImpl extends EPackageImpl implements Modes3Package { + /** + * + * + * @generated + */ + private EClass segmentEClass = null; + + /** + * + * + * @generated + */ + private EClass modes3ModelRootEClass = null; + + /** + * + * + * @generated + */ + private EClass turnoutEClass = null; + + /** + * + * + * @generated + */ + private EClass trainEClass = 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 modes3.Modes3Package#eNS_URI + * @see #init() + * @generated + */ + private Modes3PackageImpl() { + super(eNS_URI, Modes3Factory.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 Modes3Package#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 Modes3Package init() { + if (isInited) return (Modes3Package)EPackage.Registry.INSTANCE.getEPackage(Modes3Package.eNS_URI); + + // Obtain or create and register package + Object registeredModes3Package = EPackage.Registry.INSTANCE.get(eNS_URI); + Modes3PackageImpl theModes3Package = registeredModes3Package instanceof Modes3PackageImpl ? (Modes3PackageImpl)registeredModes3Package : new Modes3PackageImpl(); + + isInited = true; + + // Create package meta-data objects + theModes3Package.createPackageContents(); + + // Initialize created meta-data + theModes3Package.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theModes3Package.freeze(); + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(Modes3Package.eNS_URI, theModes3Package); + return theModes3Package; + } + + /** + * + * + * @generated + */ + public EClass getSegment() { + return segmentEClass; + } + + /** + * + * + * @generated + */ + public EReference getSegment_ConnectedTo() { + return (EReference)segmentEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getSegment_OccupiedBy() { + return (EReference)segmentEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getSegment_Id() { + return (EAttribute)segmentEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EClass getModes3ModelRoot() { + return modes3ModelRootEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getModes3ModelRoot_Id() { + return (EAttribute)modes3ModelRootEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getModes3ModelRoot_Trains() { + return (EReference)modes3ModelRootEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getModes3ModelRoot_Segments() { + return (EReference)modes3ModelRootEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EReference getModes3ModelRoot_Turnouts() { + return (EReference)modes3ModelRootEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EClass getTurnout() { + return turnoutEClass; + } + + /** + * + * + * @generated + */ + public EReference getTurnout_Straight() { + return (EReference)turnoutEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getTurnout_Divergent() { + return (EReference)turnoutEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getTrain() { + return trainEClass; + } + + /** + * + * + * @generated + */ + public EReference getTrain_Location() { + return (EReference)trainEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getTrain_Id() { + return (EAttribute)trainEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getTrain_Speed() { + return (EAttribute)trainEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public Modes3Factory getModes3Factory() { + return (Modes3Factory)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 + segmentEClass = createEClass(SEGMENT); + createEReference(segmentEClass, SEGMENT__CONNECTED_TO); + createEReference(segmentEClass, SEGMENT__OCCUPIED_BY); + createEAttribute(segmentEClass, SEGMENT__ID); + + modes3ModelRootEClass = createEClass(MODES3_MODEL_ROOT); + createEAttribute(modes3ModelRootEClass, MODES3_MODEL_ROOT__ID); + createEReference(modes3ModelRootEClass, MODES3_MODEL_ROOT__TRAINS); + createEReference(modes3ModelRootEClass, MODES3_MODEL_ROOT__SEGMENTS); + createEReference(modes3ModelRootEClass, MODES3_MODEL_ROOT__TURNOUTS); + + turnoutEClass = createEClass(TURNOUT); + createEReference(turnoutEClass, TURNOUT__STRAIGHT); + createEReference(turnoutEClass, TURNOUT__DIVERGENT); + + trainEClass = createEClass(TRAIN); + createEReference(trainEClass, TRAIN__LOCATION); + createEAttribute(trainEClass, TRAIN__ID); + createEAttribute(trainEClass, TRAIN__SPEED); + } + + /** + * + * + * @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 + turnoutEClass.getESuperTypes().add(this.getSegment()); + + // Initialize classes, features, and operations; add parameters + initEClass(segmentEClass, Segment.class, "Segment", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getSegment_ConnectedTo(), this.getSegment(), null, "connectedTo", null, 0, 2, Segment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getSegment_OccupiedBy(), this.getTrain(), this.getTrain_Location(), "occupiedBy", null, 0, 1, Segment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getSegment_Id(), ecorePackage.getEInt(), "id", null, 0, 1, Segment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(modes3ModelRootEClass, Modes3ModelRoot.class, "Modes3ModelRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getModes3ModelRoot_Id(), ecorePackage.getEInt(), "id", null, 0, 1, Modes3ModelRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getModes3ModelRoot_Trains(), this.getTrain(), null, "trains", null, 0, -1, Modes3ModelRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getModes3ModelRoot_Segments(), this.getSegment(), null, "segments", null, 0, -1, Modes3ModelRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getModes3ModelRoot_Turnouts(), this.getTurnout(), null, "turnouts", null, 0, -1, Modes3ModelRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(turnoutEClass, Turnout.class, "Turnout", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getTurnout_Straight(), this.getSegment(), null, "straight", null, 1, 1, Turnout.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTurnout_Divergent(), this.getSegment(), null, "divergent", null, 1, 1, Turnout.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(trainEClass, Train.class, "Train", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getTrain_Location(), this.getSegment(), this.getSegment_OccupiedBy(), "location", null, 1, 1, Train.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrain_Id(), ecorePackage.getEInt(), "id", null, 0, 1, Train.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrain_Speed(), ecorePackage.getEDouble(), "speed", null, 0, 1, Train.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} //Modes3PackageImpl diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/SegmentImpl.java b/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/SegmentImpl.java new file mode 100644 index 00000000..905bcec1 --- /dev/null +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/SegmentImpl.java @@ -0,0 +1,319 @@ +/** + */ +package modes3.impl; + +import java.util.Collection; + +import modes3.Modes3Package; +import modes3.Segment; +import modes3.Train; + +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.EObjectResolvingEList; + +/** + * + * An implementation of the model object 'Segment'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link modes3.impl.SegmentImpl#getConnectedTo Connected To}
  • + *
  • {@link modes3.impl.SegmentImpl#getOccupiedBy Occupied By}
  • + *
  • {@link modes3.impl.SegmentImpl#getId Id}
  • + *
+ * + * @generated + */ +public class SegmentImpl extends MinimalEObjectImpl.Container implements Segment { + /** + * The cached value of the '{@link #getConnectedTo() Connected To}' reference list. + * + * + * @see #getConnectedTo() + * @generated + * @ordered + */ + protected EList connectedTo; + + /** + * The cached value of the '{@link #getOccupiedBy() Occupied By}' reference. + * + * + * @see #getOccupiedBy() + * @generated + * @ordered + */ + protected Train occupiedBy; + + /** + * The default value of the '{@link #getId() Id}' attribute. + * + * + * @see #getId() + * @generated + * @ordered + */ + protected static final int ID_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getId() Id}' attribute. + * + * + * @see #getId() + * @generated + * @ordered + */ + protected int id = ID_EDEFAULT; + + /** + * + * + * @generated + */ + protected SegmentImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return Modes3Package.Literals.SEGMENT; + } + + /** + * + * + * @generated + */ + public EList getConnectedTo() { + if (connectedTo == null) { + connectedTo = new EObjectResolvingEList(Segment.class, this, Modes3Package.SEGMENT__CONNECTED_TO); + } + return connectedTo; + } + + /** + * + * + * @generated + */ + public Train getOccupiedBy() { + if (occupiedBy != null && occupiedBy.eIsProxy()) { + InternalEObject oldOccupiedBy = (InternalEObject)occupiedBy; + occupiedBy = (Train)eResolveProxy(oldOccupiedBy); + if (occupiedBy != oldOccupiedBy) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, Modes3Package.SEGMENT__OCCUPIED_BY, oldOccupiedBy, occupiedBy)); + } + } + return occupiedBy; + } + + /** + * + * + * @generated + */ + public Train basicGetOccupiedBy() { + return occupiedBy; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetOccupiedBy(Train newOccupiedBy, NotificationChain msgs) { + Train oldOccupiedBy = occupiedBy; + occupiedBy = newOccupiedBy; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Modes3Package.SEGMENT__OCCUPIED_BY, oldOccupiedBy, newOccupiedBy); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setOccupiedBy(Train newOccupiedBy) { + if (newOccupiedBy != occupiedBy) { + NotificationChain msgs = null; + if (occupiedBy != null) + msgs = ((InternalEObject)occupiedBy).eInverseRemove(this, Modes3Package.TRAIN__LOCATION, Train.class, msgs); + if (newOccupiedBy != null) + msgs = ((InternalEObject)newOccupiedBy).eInverseAdd(this, Modes3Package.TRAIN__LOCATION, Train.class, msgs); + msgs = basicSetOccupiedBy(newOccupiedBy, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, Modes3Package.SEGMENT__OCCUPIED_BY, newOccupiedBy, newOccupiedBy)); + } + + /** + * + * + * @generated + */ + public int getId() { + return id; + } + + /** + * + * + * @generated + */ + public void setId(int newId) { + int oldId = id; + id = newId; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, Modes3Package.SEGMENT__ID, oldId, id)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case Modes3Package.SEGMENT__OCCUPIED_BY: + if (occupiedBy != null) + msgs = ((InternalEObject)occupiedBy).eInverseRemove(this, Modes3Package.TRAIN__LOCATION, Train.class, msgs); + return basicSetOccupiedBy((Train)otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case Modes3Package.SEGMENT__OCCUPIED_BY: + return basicSetOccupiedBy(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case Modes3Package.SEGMENT__CONNECTED_TO: + return getConnectedTo(); + case Modes3Package.SEGMENT__OCCUPIED_BY: + if (resolve) return getOccupiedBy(); + return basicGetOccupiedBy(); + case Modes3Package.SEGMENT__ID: + return getId(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case Modes3Package.SEGMENT__CONNECTED_TO: + getConnectedTo().clear(); + getConnectedTo().addAll((Collection)newValue); + return; + case Modes3Package.SEGMENT__OCCUPIED_BY: + setOccupiedBy((Train)newValue); + return; + case Modes3Package.SEGMENT__ID: + setId((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case Modes3Package.SEGMENT__CONNECTED_TO: + getConnectedTo().clear(); + return; + case Modes3Package.SEGMENT__OCCUPIED_BY: + setOccupiedBy((Train)null); + return; + case Modes3Package.SEGMENT__ID: + setId(ID_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case Modes3Package.SEGMENT__CONNECTED_TO: + return connectedTo != null && !connectedTo.isEmpty(); + case Modes3Package.SEGMENT__OCCUPIED_BY: + return occupiedBy != null; + case Modes3Package.SEGMENT__ID: + return id != ID_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (id: "); + result.append(id); + result.append(')'); + return result.toString(); + } + +} //SegmentImpl diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/TrainImpl.java b/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/TrainImpl.java new file mode 100644 index 00000000..f096dca8 --- /dev/null +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/TrainImpl.java @@ -0,0 +1,332 @@ +/** + */ +package modes3.impl; + +import modes3.Modes3Package; +import modes3.Segment; +import modes3.Train; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +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; + +/** + * + * An implementation of the model object 'Train'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link modes3.impl.TrainImpl#getLocation Location}
  • + *
  • {@link modes3.impl.TrainImpl#getId Id}
  • + *
  • {@link modes3.impl.TrainImpl#getSpeed Speed}
  • + *
+ * + * @generated + */ +public class TrainImpl extends MinimalEObjectImpl.Container implements Train { + /** + * The cached value of the '{@link #getLocation() Location}' reference. + * + * + * @see #getLocation() + * @generated + * @ordered + */ + protected Segment location; + + /** + * The default value of the '{@link #getId() Id}' attribute. + * + * + * @see #getId() + * @generated + * @ordered + */ + protected static final int ID_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getId() Id}' attribute. + * + * + * @see #getId() + * @generated + * @ordered + */ + protected int id = ID_EDEFAULT; + + /** + * The default value of the '{@link #getSpeed() Speed}' attribute. + * + * + * @see #getSpeed() + * @generated + * @ordered + */ + protected static final double SPEED_EDEFAULT = 0.0; + + /** + * The cached value of the '{@link #getSpeed() Speed}' attribute. + * + * + * @see #getSpeed() + * @generated + * @ordered + */ + protected double speed = SPEED_EDEFAULT; + + /** + * + * + * @generated + */ + protected TrainImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return Modes3Package.Literals.TRAIN; + } + + /** + * + * + * @generated + */ + public Segment getLocation() { + if (location != null && location.eIsProxy()) { + InternalEObject oldLocation = (InternalEObject)location; + location = (Segment)eResolveProxy(oldLocation); + if (location != oldLocation) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, Modes3Package.TRAIN__LOCATION, oldLocation, location)); + } + } + return location; + } + + /** + * + * + * @generated + */ + public Segment basicGetLocation() { + return location; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetLocation(Segment newLocation, NotificationChain msgs) { + Segment oldLocation = location; + location = newLocation; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Modes3Package.TRAIN__LOCATION, oldLocation, newLocation); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setLocation(Segment newLocation) { + if (newLocation != location) { + NotificationChain msgs = null; + if (location != null) + msgs = ((InternalEObject)location).eInverseRemove(this, Modes3Package.SEGMENT__OCCUPIED_BY, Segment.class, msgs); + if (newLocation != null) + msgs = ((InternalEObject)newLocation).eInverseAdd(this, Modes3Package.SEGMENT__OCCUPIED_BY, Segment.class, msgs); + msgs = basicSetLocation(newLocation, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, Modes3Package.TRAIN__LOCATION, newLocation, newLocation)); + } + + /** + * + * + * @generated + */ + public int getId() { + return id; + } + + /** + * + * + * @generated + */ + public void setId(int newId) { + int oldId = id; + id = newId; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, Modes3Package.TRAIN__ID, oldId, id)); + } + + /** + * + * + * @generated + */ + public double getSpeed() { + return speed; + } + + /** + * + * + * @generated + */ + public void setSpeed(double newSpeed) { + double oldSpeed = speed; + speed = newSpeed; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, Modes3Package.TRAIN__SPEED, oldSpeed, speed)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case Modes3Package.TRAIN__LOCATION: + if (location != null) + msgs = ((InternalEObject)location).eInverseRemove(this, Modes3Package.SEGMENT__OCCUPIED_BY, Segment.class, msgs); + return basicSetLocation((Segment)otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case Modes3Package.TRAIN__LOCATION: + return basicSetLocation(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case Modes3Package.TRAIN__LOCATION: + if (resolve) return getLocation(); + return basicGetLocation(); + case Modes3Package.TRAIN__ID: + return getId(); + case Modes3Package.TRAIN__SPEED: + return getSpeed(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case Modes3Package.TRAIN__LOCATION: + setLocation((Segment)newValue); + return; + case Modes3Package.TRAIN__ID: + setId((Integer)newValue); + return; + case Modes3Package.TRAIN__SPEED: + setSpeed((Double)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case Modes3Package.TRAIN__LOCATION: + setLocation((Segment)null); + return; + case Modes3Package.TRAIN__ID: + setId(ID_EDEFAULT); + return; + case Modes3Package.TRAIN__SPEED: + setSpeed(SPEED_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case Modes3Package.TRAIN__LOCATION: + return location != null; + case Modes3Package.TRAIN__ID: + return id != ID_EDEFAULT; + case Modes3Package.TRAIN__SPEED: + return speed != SPEED_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (id: "); + result.append(id); + result.append(", speed: "); + result.append(speed); + result.append(')'); + return result.toString(); + } + +} //TrainImpl diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/TurnoutImpl.java b/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/TurnoutImpl.java new file mode 100644 index 00000000..d20a104e --- /dev/null +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/TurnoutImpl.java @@ -0,0 +1,216 @@ +/** + */ +package modes3.impl; + +import modes3.Modes3Package; +import modes3.Segment; +import modes3.Turnout; + +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; + +/** + * + * An implementation of the model object 'Turnout'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link modes3.impl.TurnoutImpl#getStraight Straight}
  • + *
  • {@link modes3.impl.TurnoutImpl#getDivergent Divergent}
  • + *
+ * + * @generated + */ +public class TurnoutImpl extends SegmentImpl implements Turnout { + /** + * The cached value of the '{@link #getStraight() Straight}' reference. + * + * + * @see #getStraight() + * @generated + * @ordered + */ + protected Segment straight; + + /** + * The cached value of the '{@link #getDivergent() Divergent}' reference. + * + * + * @see #getDivergent() + * @generated + * @ordered + */ + protected Segment divergent; + + /** + * + * + * @generated + */ + protected TurnoutImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return Modes3Package.Literals.TURNOUT; + } + + /** + * + * + * @generated + */ + public Segment getStraight() { + if (straight != null && straight.eIsProxy()) { + InternalEObject oldStraight = (InternalEObject)straight; + straight = (Segment)eResolveProxy(oldStraight); + if (straight != oldStraight) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, Modes3Package.TURNOUT__STRAIGHT, oldStraight, straight)); + } + } + return straight; + } + + /** + * + * + * @generated + */ + public Segment basicGetStraight() { + return straight; + } + + /** + * + * + * @generated + */ + public void setStraight(Segment newStraight) { + Segment oldStraight = straight; + straight = newStraight; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, Modes3Package.TURNOUT__STRAIGHT, oldStraight, straight)); + } + + /** + * + * + * @generated + */ + public Segment getDivergent() { + if (divergent != null && divergent.eIsProxy()) { + InternalEObject oldDivergent = (InternalEObject)divergent; + divergent = (Segment)eResolveProxy(oldDivergent); + if (divergent != oldDivergent) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, Modes3Package.TURNOUT__DIVERGENT, oldDivergent, divergent)); + } + } + return divergent; + } + + /** + * + * + * @generated + */ + public Segment basicGetDivergent() { + return divergent; + } + + /** + * + * + * @generated + */ + public void setDivergent(Segment newDivergent) { + Segment oldDivergent = divergent; + divergent = newDivergent; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, Modes3Package.TURNOUT__DIVERGENT, oldDivergent, divergent)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case Modes3Package.TURNOUT__STRAIGHT: + if (resolve) return getStraight(); + return basicGetStraight(); + case Modes3Package.TURNOUT__DIVERGENT: + if (resolve) return getDivergent(); + return basicGetDivergent(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case Modes3Package.TURNOUT__STRAIGHT: + setStraight((Segment)newValue); + return; + case Modes3Package.TURNOUT__DIVERGENT: + setDivergent((Segment)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case Modes3Package.TURNOUT__STRAIGHT: + setStraight((Segment)null); + return; + case Modes3Package.TURNOUT__DIVERGENT: + setDivergent((Segment)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case Modes3Package.TURNOUT__STRAIGHT: + return straight != null; + case Modes3Package.TURNOUT__DIVERGENT: + return divergent != null; + } + return super.eIsSet(featureID); + } + +} //TurnoutImpl -- cgit v1.2.3-70-g09d2