blob: de12e096541f01993d6259201cdc84037f41f351 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007, 2010 BMW Car IT, Technische Universitaet Muenchen, and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* BMW Car IT - Initial API and implementation
* Technische Universitaet Muenchen - Major refactoring and extension
*******************************************************************************/
package org.eclipse.emf.edapt.spi.history.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.edapt.spi.history.HistoryPackage;
import org.eclipse.emf.edapt.spi.history.OperationChange;
import org.eclipse.emf.edapt.spi.history.OperationInstance;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Operation Change</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.emf.edapt.spi.history.impl.OperationChangeImpl#getOperation <em>Operation</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class OperationChangeImpl extends CompositeChangeImpl implements OperationChange {
/**
* The cached value of the '{@link #getOperation() <em>Operation</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getOperation()
* @generated
* @ordered
*/
protected OperationInstance operation;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected OperationChangeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return HistoryPackage.Literals.OPERATION_CHANGE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public OperationInstance getOperation() {
return operation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetOperation(OperationInstance newOperation, NotificationChain msgs) {
final OperationInstance oldOperation = operation;
operation = newOperation;
if (eNotificationRequired()) {
final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
HistoryPackage.OPERATION_CHANGE__OPERATION, oldOperation, newOperation);
if (msgs == null) {
msgs = notification;
} else {
msgs.add(notification);
}
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setOperation(OperationInstance newOperation) {
if (newOperation != operation) {
NotificationChain msgs = null;
if (operation != null) {
msgs = ((InternalEObject) operation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE
- HistoryPackage.OPERATION_CHANGE__OPERATION, null, msgs);
}
if (newOperation != null) {
msgs = ((InternalEObject) newOperation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE
- HistoryPackage.OPERATION_CHANGE__OPERATION, null, msgs);
}
msgs = basicSetOperation(newOperation, msgs);
if (msgs != null) {
msgs.dispatch();
}
}
else if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, HistoryPackage.OPERATION_CHANGE__OPERATION,
newOperation, newOperation));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case HistoryPackage.OPERATION_CHANGE__OPERATION:
return basicSetOperation(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 HistoryPackage.OPERATION_CHANGE__OPERATION:
return getOperation();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case HistoryPackage.OPERATION_CHANGE__OPERATION:
setOperation((OperationInstance) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case HistoryPackage.OPERATION_CHANGE__OPERATION:
setOperation((OperationInstance) null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case HistoryPackage.OPERATION_CHANGE__OPERATION:
return operation != null;
}
return super.eIsSet(featureID);
}
} // OperationChangeImpl