Fix some of the warnings
[EMFCompare2.git] / plugins / org.eclipse.emf.compare / src-gen / org / eclipse / emf / compare / impl / MatchImpl.java
blob2e9d4e82f73e12831bde35576dd221c63a33ca61
1 /**
2 * Copyright (c) 2012, 2015 Obeo.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Obeo - initial API and implementation
11 package org.eclipse.emf.compare.impl;
13 import java.lang.Iterable;
14 import java.util.Collection;
16 import org.eclipse.emf.common.notify.Notification;
17 import org.eclipse.emf.common.notify.NotificationChain;
19 import org.eclipse.emf.common.util.EList;
21 import org.eclipse.emf.compare.ComparePackage;
22 import org.eclipse.emf.compare.Comparison;
23 import org.eclipse.emf.compare.Diff;
24 import org.eclipse.emf.compare.Match;
26 import org.eclipse.emf.ecore.EClass;
27 import org.eclipse.emf.ecore.EObject;
28 import org.eclipse.emf.ecore.InternalEObject;
30 import org.eclipse.emf.ecore.impl.ENotificationImpl;
31 import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
33 import org.eclipse.emf.ecore.util.EObjectContainmentEList;
34 import org.eclipse.emf.ecore.util.InternalEList;
36 /**
37 * <!-- begin-user-doc -->
38 * An implementation of the model object '<em><b>Match</b></em>'.
39 * <!-- end-user-doc -->
40 * <p>
41 * The following features are implemented:
42 * <ul>
43 * <li>{@link org.eclipse.emf.compare.impl.MatchImpl#getSubmatches <em>Submatches</em>}</li>
44 * <li>{@link org.eclipse.emf.compare.impl.MatchImpl#getDifferences <em>Differences</em>}</li>
45 * <li>{@link org.eclipse.emf.compare.impl.MatchImpl#getLeft <em>Left</em>}</li>
46 * <li>{@link org.eclipse.emf.compare.impl.MatchImpl#getRight <em>Right</em>}</li>
47 * <li>{@link org.eclipse.emf.compare.impl.MatchImpl#getOrigin <em>Origin</em>}</li>
48 * </ul>
49 * </p>
51 * @generated
53 public class MatchImpl extends MinimalEObjectImpl implements Match {
54 /**
55 * <!-- begin-user-doc -->
56 * <!-- end-user-doc -->
57 * @generated
59 public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
61 /**
62 * The cached value of the '{@link #getSubmatches() <em>Submatches</em>}' containment reference list.
63 * <!-- begin-user-doc -->
64 * <!-- end-user-doc -->
65 * @see #getSubmatches()
66 * @generated
67 * @ordered
69 protected EList<Match> submatches;
71 /**
72 * The cached value of the '{@link #getDifferences() <em>Differences</em>}' containment reference list.
73 * <!-- begin-user-doc -->
74 * <!-- end-user-doc -->
75 * @see #getDifferences()
76 * @generated
77 * @ordered
79 protected EList<Diff> differences;
81 /**
82 * The cached value of the '{@link #getLeft() <em>Left</em>}' reference.
83 * <!-- begin-user-doc -->
84 * <!-- end-user-doc -->
85 * @see #getLeft()
86 * @generated
87 * @ordered
89 protected EObject left;
91 /**
92 * The cached value of the '{@link #getRight() <em>Right</em>}' reference.
93 * <!-- begin-user-doc -->
94 * <!-- end-user-doc -->
95 * @see #getRight()
96 * @generated
97 * @ordered
99 protected EObject right;
102 * The cached value of the '{@link #getOrigin() <em>Origin</em>}' reference.
103 * <!-- begin-user-doc -->
104 * <!-- end-user-doc -->
105 * @see #getOrigin()
106 * @generated
107 * @ordered
109 protected EObject origin;
112 * <!-- begin-user-doc -->
113 * <!-- end-user-doc -->
114 * @generated
116 protected MatchImpl() {
117 super();
121 * <!-- begin-user-doc -->
122 * <!-- end-user-doc -->
123 * @generated
125 @Override
126 protected EClass eStaticClass() {
127 return ComparePackage.Literals.MATCH;
131 * <!-- begin-user-doc -->
132 * <!-- end-user-doc -->
133 * @generated
135 public EList<Match> getSubmatches() {
136 if (submatches == null) {
137 submatches = new EObjectContainmentEList<Match>(Match.class, this,
138 ComparePackage.MATCH__SUBMATCHES);
140 return submatches;
144 * <!-- begin-user-doc -->
145 * <!-- end-user-doc -->
146 * @generated
148 public EList<Diff> getDifferences() {
149 if (differences == null) {
150 differences = new EObjectContainmentEList<Diff>(Diff.class, this,
151 ComparePackage.MATCH__DIFFERENCES);
153 return differences;
157 * <!-- begin-user-doc -->
158 * <!-- end-user-doc -->
159 * @generated
161 public EObject getLeft() {
162 if (left != null && left.eIsProxy()) {
163 InternalEObject oldLeft = (InternalEObject)left;
164 left = eResolveProxy(oldLeft);
165 if (left != oldLeft) {
166 if (eNotificationRequired())
167 eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComparePackage.MATCH__LEFT,
168 oldLeft, left));
171 return left;
175 * <!-- begin-user-doc -->
176 * <!-- end-user-doc -->
177 * @generated
179 public EObject basicGetLeft() {
180 return left;
184 * <!-- begin-user-doc -->
185 * <!-- end-user-doc -->
186 * @generated
188 public void setLeft(EObject newLeft) {
189 EObject oldLeft = left;
190 left = newLeft;
191 if (eNotificationRequired())
192 eNotify(new ENotificationImpl(this, Notification.SET, ComparePackage.MATCH__LEFT, oldLeft, left));
196 * <!-- begin-user-doc -->
197 * <!-- end-user-doc -->
198 * @generated
200 public EObject getRight() {
201 if (right != null && right.eIsProxy()) {
202 InternalEObject oldRight = (InternalEObject)right;
203 right = eResolveProxy(oldRight);
204 if (right != oldRight) {
205 if (eNotificationRequired())
206 eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComparePackage.MATCH__RIGHT,
207 oldRight, right));
210 return right;
214 * <!-- begin-user-doc -->
215 * <!-- end-user-doc -->
216 * @generated
218 public EObject basicGetRight() {
219 return right;
223 * <!-- begin-user-doc -->
224 * <!-- end-user-doc -->
225 * @generated
227 public void setRight(EObject newRight) {
228 EObject oldRight = right;
229 right = newRight;
230 if (eNotificationRequired())
231 eNotify(new ENotificationImpl(this, Notification.SET, ComparePackage.MATCH__RIGHT, oldRight,
232 right));
236 * <!-- begin-user-doc -->
237 * <!-- end-user-doc -->
238 * @generated
240 public EObject getOrigin() {
241 if (origin != null && origin.eIsProxy()) {
242 InternalEObject oldOrigin = (InternalEObject)origin;
243 origin = eResolveProxy(oldOrigin);
244 if (origin != oldOrigin) {
245 if (eNotificationRequired())
246 eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComparePackage.MATCH__ORIGIN,
247 oldOrigin, origin));
250 return origin;
254 * <!-- begin-user-doc -->
255 * <!-- end-user-doc -->
256 * @generated
258 public EObject basicGetOrigin() {
259 return origin;
263 * <!-- begin-user-doc -->
264 * <!-- end-user-doc -->
265 * @generated
267 public void setOrigin(EObject newOrigin) {
268 EObject oldOrigin = origin;
269 origin = newOrigin;
270 if (eNotificationRequired())
271 eNotify(new ENotificationImpl(this, Notification.SET, ComparePackage.MATCH__ORIGIN, oldOrigin,
272 origin));
276 * <!-- begin-user-doc -->
277 * <!-- end-user-doc -->
278 * @generated
280 public Comparison getComparison() {
281 // TODO: implement this method
282 // Ensure that you remove @generated or mark it @generated NOT
283 throw new UnsupportedOperationException();
287 * <!-- begin-user-doc -->
288 * <!-- end-user-doc -->
289 * @generated
291 public Iterable<Match> getAllSubmatches() {
292 // TODO: implement this method
293 // Ensure that you remove @generated or mark it @generated NOT
294 throw new UnsupportedOperationException();
298 * <!-- begin-user-doc -->
299 * <!-- end-user-doc -->
300 * @generated
302 public Iterable<Diff> getAllDifferences() {
303 // TODO: implement this method
304 // Ensure that you remove @generated or mark it @generated NOT
305 throw new UnsupportedOperationException();
309 * <!-- begin-user-doc -->
310 * <!-- end-user-doc -->
311 * @generated
313 @Override
314 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
315 switch (featureID) {
316 case ComparePackage.MATCH__SUBMATCHES:
317 return ((InternalEList<?>)getSubmatches()).basicRemove(otherEnd, msgs);
318 case ComparePackage.MATCH__DIFFERENCES:
319 return ((InternalEList<?>)getDifferences()).basicRemove(otherEnd, msgs);
321 return super.eInverseRemove(otherEnd, featureID, msgs);
325 * <!-- begin-user-doc -->
326 * <!-- end-user-doc -->
327 * @generated
329 @Override
330 public Object eGet(int featureID, boolean resolve, boolean coreType) {
331 switch (featureID) {
332 case ComparePackage.MATCH__SUBMATCHES:
333 return getSubmatches();
334 case ComparePackage.MATCH__DIFFERENCES:
335 return getDifferences();
336 case ComparePackage.MATCH__LEFT:
337 if (resolve)
338 return getLeft();
339 return basicGetLeft();
340 case ComparePackage.MATCH__RIGHT:
341 if (resolve)
342 return getRight();
343 return basicGetRight();
344 case ComparePackage.MATCH__ORIGIN:
345 if (resolve)
346 return getOrigin();
347 return basicGetOrigin();
349 return super.eGet(featureID, resolve, coreType);
353 * <!-- begin-user-doc -->
354 * <!-- end-user-doc -->
355 * @generated
357 @SuppressWarnings("unchecked")
358 @Override
359 public void eSet(int featureID, Object newValue) {
360 switch (featureID) {
361 case ComparePackage.MATCH__SUBMATCHES:
362 getSubmatches().clear();
363 getSubmatches().addAll((Collection<? extends Match>)newValue);
364 return;
365 case ComparePackage.MATCH__DIFFERENCES:
366 getDifferences().clear();
367 getDifferences().addAll((Collection<? extends Diff>)newValue);
368 return;
369 case ComparePackage.MATCH__LEFT:
370 setLeft((EObject)newValue);
371 return;
372 case ComparePackage.MATCH__RIGHT:
373 setRight((EObject)newValue);
374 return;
375 case ComparePackage.MATCH__ORIGIN:
376 setOrigin((EObject)newValue);
377 return;
379 super.eSet(featureID, newValue);
383 * <!-- begin-user-doc -->
384 * <!-- end-user-doc -->
385 * @generated
387 @Override
388 public void eUnset(int featureID) {
389 switch (featureID) {
390 case ComparePackage.MATCH__SUBMATCHES:
391 getSubmatches().clear();
392 return;
393 case ComparePackage.MATCH__DIFFERENCES:
394 getDifferences().clear();
395 return;
396 case ComparePackage.MATCH__LEFT:
397 setLeft((EObject)null);
398 return;
399 case ComparePackage.MATCH__RIGHT:
400 setRight((EObject)null);
401 return;
402 case ComparePackage.MATCH__ORIGIN:
403 setOrigin((EObject)null);
404 return;
406 super.eUnset(featureID);
410 * <!-- begin-user-doc -->
411 * <!-- end-user-doc -->
412 * @generated
414 @Override
415 public boolean eIsSet(int featureID) {
416 switch (featureID) {
417 case ComparePackage.MATCH__SUBMATCHES:
418 return submatches != null && !submatches.isEmpty();
419 case ComparePackage.MATCH__DIFFERENCES:
420 return differences != null && !differences.isEmpty();
421 case ComparePackage.MATCH__LEFT:
422 return left != null;
423 case ComparePackage.MATCH__RIGHT:
424 return right != null;
425 case ComparePackage.MATCH__ORIGIN:
426 return origin != null;
428 return super.eIsSet(featureID);
431 } //MatchImpl