/** | |
* Copyright (c) 2010 Mia-Software and others. | |
* All rights reserved. This program and the accompanying materials | |
* are made available under the terms of the Eclipse Public License v2.0 | |
* which accompanies this distribution, and is available at | |
* http://www.eclipse.org/legal/epl-v20.html | |
* | |
* Contributors: | |
* Nicolas Payneau (Mia-Software) - initial API and implementation | |
*/ | |
package org.eclipse.modisco.smm.quality.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.util.EObjectWithInverseResolvingEList; | |
import org.eclipse.emf.ecore.util.InternalEList; | |
import org.eclipse.modisco.omg.smm.impl.ScopeImpl; | |
import org.eclipse.modisco.smm.quality.QualityScope; | |
import org.eclipse.modisco.smm.quality.SmmqualityPackage; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Quality Scope</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.modisco.smm.quality.impl.QualityScopeImpl#getChildren <em>Children</em>}</li> | |
* <li>{@link org.eclipse.modisco.smm.quality.impl.QualityScopeImpl#getParent <em>Parent</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class QualityScopeImpl extends ScopeImpl implements QualityScope { | |
/** | |
* The cached value of the '{@link #getChildren() <em>Children</em>}' reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getChildren() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<QualityScope> children; | |
/** | |
* The cached value of the '{@link #getParent() <em>Parent</em>}' reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getParent() | |
* @generated | |
* @ordered | |
*/ | |
protected QualityScope parent; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected QualityScopeImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return SmmqualityPackage.Literals.QUALITY_SCOPE; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<QualityScope> getChildren() { | |
if (children == null) { | |
children = new EObjectWithInverseResolvingEList<QualityScope>(QualityScope.class, this, SmmqualityPackage.QUALITY_SCOPE__CHILDREN, SmmqualityPackage.QUALITY_SCOPE__PARENT); | |
} | |
return children; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public QualityScope getParent() { | |
if (parent != null && parent.eIsProxy()) { | |
InternalEObject oldParent = (InternalEObject)parent; | |
parent = (QualityScope)eResolveProxy(oldParent); | |
if (parent != oldParent) { | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.RESOLVE, SmmqualityPackage.QUALITY_SCOPE__PARENT, oldParent, parent)); | |
} | |
} | |
return parent; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public QualityScope basicGetParent() { | |
return parent; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NotificationChain basicSetParent(QualityScope newParent, NotificationChain msgs) { | |
QualityScope oldParent = parent; | |
parent = newParent; | |
if (eNotificationRequired()) { | |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SmmqualityPackage.QUALITY_SCOPE__PARENT, oldParent, newParent); | |
if (msgs == null) msgs = notification; else msgs.add(notification); | |
} | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setParent(QualityScope newParent) { | |
if (newParent != parent) { | |
NotificationChain msgs = null; | |
if (parent != null) | |
msgs = ((InternalEObject)parent).eInverseRemove(this, SmmqualityPackage.QUALITY_SCOPE__CHILDREN, QualityScope.class, msgs); | |
if (newParent != null) | |
msgs = ((InternalEObject)newParent).eInverseAdd(this, SmmqualityPackage.QUALITY_SCOPE__CHILDREN, QualityScope.class, msgs); | |
msgs = basicSetParent(newParent, msgs); | |
if (msgs != null) msgs.dispatch(); | |
} | |
else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, SmmqualityPackage.QUALITY_SCOPE__PARENT, newParent, newParent)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@SuppressWarnings("unchecked") | |
@Override | |
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case SmmqualityPackage.QUALITY_SCOPE__CHILDREN: | |
return ((InternalEList<InternalEObject>)(InternalEList<?>)getChildren()).basicAdd(otherEnd, msgs); | |
case SmmqualityPackage.QUALITY_SCOPE__PARENT: | |
if (parent != null) | |
msgs = ((InternalEObject)parent).eInverseRemove(this, SmmqualityPackage.QUALITY_SCOPE__CHILDREN, QualityScope.class, msgs); | |
return basicSetParent((QualityScope)otherEnd, msgs); | |
} | |
return super.eInverseAdd(otherEnd, featureID, msgs); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case SmmqualityPackage.QUALITY_SCOPE__CHILDREN: | |
return ((InternalEList<?>)getChildren()).basicRemove(otherEnd, msgs); | |
case SmmqualityPackage.QUALITY_SCOPE__PARENT: | |
return basicSetParent(null, msgs); | |
} | |
return super.eInverseRemove(otherEnd, featureID, msgs); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
switch (featureID) { | |
case SmmqualityPackage.QUALITY_SCOPE__CHILDREN: | |
return getChildren(); | |
case SmmqualityPackage.QUALITY_SCOPE__PARENT: | |
if (resolve) return getParent(); | |
return basicGetParent(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@SuppressWarnings("unchecked") | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case SmmqualityPackage.QUALITY_SCOPE__CHILDREN: | |
getChildren().clear(); | |
getChildren().addAll((Collection<? extends QualityScope>)newValue); | |
return; | |
case SmmqualityPackage.QUALITY_SCOPE__PARENT: | |
setParent((QualityScope)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case SmmqualityPackage.QUALITY_SCOPE__CHILDREN: | |
getChildren().clear(); | |
return; | |
case SmmqualityPackage.QUALITY_SCOPE__PARENT: | |
setParent((QualityScope)null); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case SmmqualityPackage.QUALITY_SCOPE__CHILDREN: | |
return children != null && !children.isEmpty(); | |
case SmmqualityPackage.QUALITY_SCOPE__PARENT: | |
return parent != null; | |
} | |
return super.eIsSet(featureID); | |
} | |
} //QualityScopeImpl |