aboutsummaryrefslogtreecommitdiffstats
path: root/Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/SegmentImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/SegmentImpl.java')
-rw-r--r--Domains/ca.mcgill.rtgmrt.example.modes3/ecore-gen/modes3/impl/SegmentImpl.java319
1 files changed, 319 insertions, 0 deletions
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 @@
1/**
2 */
3package modes3.impl;
4
5import java.util.Collection;
6
7import modes3.Modes3Package;
8import modes3.Segment;
9import modes3.Train;
10
11import org.eclipse.emf.common.notify.Notification;
12import org.eclipse.emf.common.notify.NotificationChain;
13
14import org.eclipse.emf.common.util.EList;
15
16import org.eclipse.emf.ecore.EClass;
17import org.eclipse.emf.ecore.InternalEObject;
18
19import org.eclipse.emf.ecore.impl.ENotificationImpl;
20import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
21
22import org.eclipse.emf.ecore.util.EObjectResolvingEList;
23
24/**
25 * <!-- begin-user-doc -->
26 * An implementation of the model object '<em><b>Segment</b></em>'.
27 * <!-- end-user-doc -->
28 * <p>
29 * The following features are implemented:
30 * </p>
31 * <ul>
32 * <li>{@link modes3.impl.SegmentImpl#getConnectedTo <em>Connected To</em>}</li>
33 * <li>{@link modes3.impl.SegmentImpl#getOccupiedBy <em>Occupied By</em>}</li>
34 * <li>{@link modes3.impl.SegmentImpl#getId <em>Id</em>}</li>
35 * </ul>
36 *
37 * @generated
38 */
39public class SegmentImpl extends MinimalEObjectImpl.Container implements Segment {
40 /**
41 * The cached value of the '{@link #getConnectedTo() <em>Connected To</em>}' reference list.
42 * <!-- begin-user-doc -->
43 * <!-- end-user-doc -->
44 * @see #getConnectedTo()
45 * @generated
46 * @ordered
47 */
48 protected EList<Segment> connectedTo;
49
50 /**
51 * The cached value of the '{@link #getOccupiedBy() <em>Occupied By</em>}' reference.
52 * <!-- begin-user-doc -->
53 * <!-- end-user-doc -->
54 * @see #getOccupiedBy()
55 * @generated
56 * @ordered
57 */
58 protected Train occupiedBy;
59
60 /**
61 * The default value of the '{@link #getId() <em>Id</em>}' attribute.
62 * <!-- begin-user-doc -->
63 * <!-- end-user-doc -->
64 * @see #getId()
65 * @generated
66 * @ordered
67 */
68 protected static final int ID_EDEFAULT = 0;
69
70 /**
71 * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
72 * <!-- begin-user-doc -->
73 * <!-- end-user-doc -->
74 * @see #getId()
75 * @generated
76 * @ordered
77 */
78 protected int id = ID_EDEFAULT;
79
80 /**
81 * <!-- begin-user-doc -->
82 * <!-- end-user-doc -->
83 * @generated
84 */
85 protected SegmentImpl() {
86 super();
87 }
88
89 /**
90 * <!-- begin-user-doc -->
91 * <!-- end-user-doc -->
92 * @generated
93 */
94 @Override
95 protected EClass eStaticClass() {
96 return Modes3Package.Literals.SEGMENT;
97 }
98
99 /**
100 * <!-- begin-user-doc -->
101 * <!-- end-user-doc -->
102 * @generated
103 */
104 public EList<Segment> getConnectedTo() {
105 if (connectedTo == null) {
106 connectedTo = new EObjectResolvingEList<Segment>(Segment.class, this, Modes3Package.SEGMENT__CONNECTED_TO);
107 }
108 return connectedTo;
109 }
110
111 /**
112 * <!-- begin-user-doc -->
113 * <!-- end-user-doc -->
114 * @generated
115 */
116 public Train getOccupiedBy() {
117 if (occupiedBy != null && occupiedBy.eIsProxy()) {
118 InternalEObject oldOccupiedBy = (InternalEObject)occupiedBy;
119 occupiedBy = (Train)eResolveProxy(oldOccupiedBy);
120 if (occupiedBy != oldOccupiedBy) {
121 if (eNotificationRequired())
122 eNotify(new ENotificationImpl(this, Notification.RESOLVE, Modes3Package.SEGMENT__OCCUPIED_BY, oldOccupiedBy, occupiedBy));
123 }
124 }
125 return occupiedBy;
126 }
127
128 /**
129 * <!-- begin-user-doc -->
130 * <!-- end-user-doc -->
131 * @generated
132 */
133 public Train basicGetOccupiedBy() {
134 return occupiedBy;
135 }
136
137 /**
138 * <!-- begin-user-doc -->
139 * <!-- end-user-doc -->
140 * @generated
141 */
142 public NotificationChain basicSetOccupiedBy(Train newOccupiedBy, NotificationChain msgs) {
143 Train oldOccupiedBy = occupiedBy;
144 occupiedBy = newOccupiedBy;
145 if (eNotificationRequired()) {
146 ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Modes3Package.SEGMENT__OCCUPIED_BY, oldOccupiedBy, newOccupiedBy);
147 if (msgs == null) msgs = notification; else msgs.add(notification);
148 }
149 return msgs;
150 }
151
152 /**
153 * <!-- begin-user-doc -->
154 * <!-- end-user-doc -->
155 * @generated
156 */
157 public void setOccupiedBy(Train newOccupiedBy) {
158 if (newOccupiedBy != occupiedBy) {
159 NotificationChain msgs = null;
160 if (occupiedBy != null)
161 msgs = ((InternalEObject)occupiedBy).eInverseRemove(this, Modes3Package.TRAIN__LOCATION, Train.class, msgs);
162 if (newOccupiedBy != null)
163 msgs = ((InternalEObject)newOccupiedBy).eInverseAdd(this, Modes3Package.TRAIN__LOCATION, Train.class, msgs);
164 msgs = basicSetOccupiedBy(newOccupiedBy, msgs);
165 if (msgs != null) msgs.dispatch();
166 }
167 else if (eNotificationRequired())
168 eNotify(new ENotificationImpl(this, Notification.SET, Modes3Package.SEGMENT__OCCUPIED_BY, newOccupiedBy, newOccupiedBy));
169 }
170
171 /**
172 * <!-- begin-user-doc -->
173 * <!-- end-user-doc -->
174 * @generated
175 */
176 public int getId() {
177 return id;
178 }
179
180 /**
181 * <!-- begin-user-doc -->
182 * <!-- end-user-doc -->
183 * @generated
184 */
185 public void setId(int newId) {
186 int oldId = id;
187 id = newId;
188 if (eNotificationRequired())
189 eNotify(new ENotificationImpl(this, Notification.SET, Modes3Package.SEGMENT__ID, oldId, id));
190 }
191
192 /**
193 * <!-- begin-user-doc -->
194 * <!-- end-user-doc -->
195 * @generated
196 */
197 @Override
198 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
199 switch (featureID) {
200 case Modes3Package.SEGMENT__OCCUPIED_BY:
201 if (occupiedBy != null)
202 msgs = ((InternalEObject)occupiedBy).eInverseRemove(this, Modes3Package.TRAIN__LOCATION, Train.class, msgs);
203 return basicSetOccupiedBy((Train)otherEnd, msgs);
204 }
205 return super.eInverseAdd(otherEnd, featureID, msgs);
206 }
207
208 /**
209 * <!-- begin-user-doc -->
210 * <!-- end-user-doc -->
211 * @generated
212 */
213 @Override
214 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
215 switch (featureID) {
216 case Modes3Package.SEGMENT__OCCUPIED_BY:
217 return basicSetOccupiedBy(null, msgs);
218 }
219 return super.eInverseRemove(otherEnd, featureID, msgs);
220 }
221
222 /**
223 * <!-- begin-user-doc -->
224 * <!-- end-user-doc -->
225 * @generated
226 */
227 @Override
228 public Object eGet(int featureID, boolean resolve, boolean coreType) {
229 switch (featureID) {
230 case Modes3Package.SEGMENT__CONNECTED_TO:
231 return getConnectedTo();
232 case Modes3Package.SEGMENT__OCCUPIED_BY:
233 if (resolve) return getOccupiedBy();
234 return basicGetOccupiedBy();
235 case Modes3Package.SEGMENT__ID:
236 return getId();
237 }
238 return super.eGet(featureID, resolve, coreType);
239 }
240
241 /**
242 * <!-- begin-user-doc -->
243 * <!-- end-user-doc -->
244 * @generated
245 */
246 @SuppressWarnings("unchecked")
247 @Override
248 public void eSet(int featureID, Object newValue) {
249 switch (featureID) {
250 case Modes3Package.SEGMENT__CONNECTED_TO:
251 getConnectedTo().clear();
252 getConnectedTo().addAll((Collection<? extends Segment>)newValue);
253 return;
254 case Modes3Package.SEGMENT__OCCUPIED_BY:
255 setOccupiedBy((Train)newValue);
256 return;
257 case Modes3Package.SEGMENT__ID:
258 setId((Integer)newValue);
259 return;
260 }
261 super.eSet(featureID, newValue);
262 }
263
264 /**
265 * <!-- begin-user-doc -->
266 * <!-- end-user-doc -->
267 * @generated
268 */
269 @Override
270 public void eUnset(int featureID) {
271 switch (featureID) {
272 case Modes3Package.SEGMENT__CONNECTED_TO:
273 getConnectedTo().clear();
274 return;
275 case Modes3Package.SEGMENT__OCCUPIED_BY:
276 setOccupiedBy((Train)null);
277 return;
278 case Modes3Package.SEGMENT__ID:
279 setId(ID_EDEFAULT);
280 return;
281 }
282 super.eUnset(featureID);
283 }
284
285 /**
286 * <!-- begin-user-doc -->
287 * <!-- end-user-doc -->
288 * @generated
289 */
290 @Override
291 public boolean eIsSet(int featureID) {
292 switch (featureID) {
293 case Modes3Package.SEGMENT__CONNECTED_TO:
294 return connectedTo != null && !connectedTo.isEmpty();
295 case Modes3Package.SEGMENT__OCCUPIED_BY:
296 return occupiedBy != null;
297 case Modes3Package.SEGMENT__ID:
298 return id != ID_EDEFAULT;
299 }
300 return super.eIsSet(featureID);
301 }
302
303 /**
304 * <!-- begin-user-doc -->
305 * <!-- end-user-doc -->
306 * @generated
307 */
308 @Override
309 public String toString() {
310 if (eIsProxy()) return super.toString();
311
312 StringBuilder result = new StringBuilder(super.toString());
313 result.append(" (id: ");
314 result.append(id);
315 result.append(')');
316 return result.toString();
317 }
318
319} //SegmentImpl