/** * Copyright (c) 2012 Obeo. * 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: * Obeo - initial API and implementation */ package org.eclipse.emf.compare.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.compare.ComparePackage; import org.eclipse.emf.compare.FeatureMapChange; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Feature Map Change</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.emf.compare.impl.FeatureMapChangeImpl#getAttribute <em>Attribute</em>}</li> * <li>{@link org.eclipse.emf.compare.impl.FeatureMapChangeImpl#getValue <em>Value</em>}</li> * </ul> * </p> * * @generated * @since 3.2 */ public class FeatureMapChangeImpl extends DiffImpl implements FeatureMapChange { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("hiding") 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$ /** * The cached value of the '{@link #getAttribute() <em>Attribute</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getAttribute() * @generated * @ordered */ protected EAttribute attribute; /** * The default value of the '{@link #getValue() <em>Value</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getValue() * @generated * @ordered */ protected static final Object VALUE_EDEFAULT = null; /** * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getValue() * @generated * @ordered */ protected Object value = VALUE_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected FeatureMapChangeImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return ComparePackage.Literals.FEATURE_MAP_CHANGE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getAttribute() { if (attribute != null && attribute.eIsProxy()) { InternalEObject oldAttribute = (InternalEObject)attribute; attribute = (EAttribute)eResolveProxy(oldAttribute); if (attribute != oldAttribute) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComparePackage.FEATURE_MAP_CHANGE__ATTRIBUTE, oldAttribute, attribute)); } } return attribute; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute basicGetAttribute() { return attribute; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setAttribute(EAttribute newAttribute) { EAttribute oldAttribute = attribute; attribute = newAttribute; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ComparePackage.FEATURE_MAP_CHANGE__ATTRIBUTE, oldAttribute, attribute)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Object getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setValue(Object newValue) { Object oldValue = value; value = newValue; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ComparePackage.FEATURE_MAP_CHANGE__VALUE, oldValue, value)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ComparePackage.FEATURE_MAP_CHANGE__ATTRIBUTE: if (resolve) return getAttribute(); return basicGetAttribute(); case ComparePackage.FEATURE_MAP_CHANGE__VALUE: return getValue(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ComparePackage.FEATURE_MAP_CHANGE__ATTRIBUTE: setAttribute((EAttribute)newValue); return; case ComparePackage.FEATURE_MAP_CHANGE__VALUE: setValue(newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ComparePackage.FEATURE_MAP_CHANGE__ATTRIBUTE: setAttribute((EAttribute)null); return; case ComparePackage.FEATURE_MAP_CHANGE__VALUE: setValue(VALUE_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ComparePackage.FEATURE_MAP_CHANGE__ATTRIBUTE: return attribute != null; case ComparePackage.FEATURE_MAP_CHANGE__VALUE: return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (value: "); //$NON-NLS-1$ result.append(value); result.append(')'); return result.toString(); } } //FeatureMapChangeImpl