blob: 3b80f91eb3ce34466ce08f4f1381c8f39c6ade5d [file] [log] [blame]
/**
* <copyright>
*
* Copyright (c) 2018 Willink Transformations 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:
* E.D.Willink - Initial API and implementation
*
* </copyright>
*/
package org.eclipse.qvtd.runtime.qvttrace.impl;
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.util.EcoreUtil;
import org.eclipse.qvtd.runtime.qvttrace.QVTtracePackage;
import org.eclipse.qvtd.runtime.qvttrace.TraceInstance;
import org.eclipse.qvtd.runtime.qvttrace.TraceModel;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Trace Instance</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.runtime.qvttrace.impl.TraceInstanceImpl#getOwningModel <em>Owning Model</em>}</li>
* </ul>
*
* @generated
*/
public abstract class TraceInstanceImpl extends TraceElementImpl implements TraceInstance {
/**
* The number of structural features of the '<em>Trace Instance</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int TRACE_INSTANCE_FEATURE_COUNT = TraceElementImpl.TRACE_ELEMENT_FEATURE_COUNT + 1;
/**
* The number of operations of the '<em>Trace Instance</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int TRACE_INSTANCE_OPERATION_COUNT = TraceElementImpl.TRACE_ELEMENT_OPERATION_COUNT + 0;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TraceInstanceImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTtracePackage.Literals.TRACE_INSTANCE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public TraceModel getOwningModel() {
if (eContainerFeatureID() != (0)) return null;
return (TraceModel)eInternalContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOwningModel(TraceModel newOwningModel, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newOwningModel, 0, msgs);
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setOwningModel(TraceModel newOwningModel) {
if (newOwningModel != eInternalContainer() || (eContainerFeatureID() != (0) && newOwningModel != null)) {
if (EcoreUtil.isAncestor(this, newOwningModel))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newOwningModel != null)
msgs = ((InternalEObject)newOwningModel).eInverseAdd(this, 0, TraceModel.class, msgs);
msgs = basicSetOwningModel(newOwningModel, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 0, newOwningModel, newOwningModel));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case 0:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetOwningModel((TraceModel)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 0:
return basicSetOwningModel(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case 0:
return eInternalContainer().eInverseRemove(this, 0, TraceModel.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case 0:
return getOwningModel();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case 0:
setOwningModel((TraceModel)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case 0:
setOwningModel((TraceModel)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case 0:
return getOwningModel() != null;
}
return super.eIsSet(featureID);
}
@Override
public String getName() {
return "FIXME-default-name";
}
} //TraceInstanceImpl