blob: dd87fb055dbceea44d2f10577de0f80c0281eeb2 [file] [log] [blame]
/**
* Copyright (c) 2010, 2012 Ericsson
*
* 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
*
* Description:
*
* Contributors:
* Alvaro Sanchez-Leon - Initial API and implementation
*
*/
package org.eclipse.mylyn.reviews.r4e.core.model.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.BasicEMap;
import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.mylyn.reviews.r4e.core.model.R4EID;
import org.eclipse.mylyn.reviews.r4e.core.model.R4EIDComponent;
import org.eclipse.mylyn.reviews.r4e.core.model.RModelPackage;
/**
* <!-- begin-user-doc --> An implementation of the model object '<em><b>Map ID To Component</b></em>'. <!--
* end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.mylyn.reviews.r4e.core.model.impl.MapIDToComponentImpl#getTypedKey <em>Key</em>}</li>
* <li>{@link org.eclipse.mylyn.reviews.r4e.core.model.impl.MapIDToComponentImpl#getTypedValue <em>Value</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class MapIDToComponentImpl extends EObjectImpl implements BasicEMap.Entry<R4EID,R4EIDComponent> {
/**
* The cached value of the '{@link #getTypedKey() <em>Key</em>}' reference.
* <!-- begin-user-doc --> <!--
* end-user-doc -->
* @see #getTypedKey()
* @generated
* @ordered
*/
protected R4EID key;
/**
* The cached value of the '{@link #getTypedValue() <em>Value</em>}' reference.
* <!-- begin-user-doc --> <!--
* end-user-doc -->
* @see #getTypedValue()
* @generated
* @ordered
*/
protected R4EIDComponent value;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
protected MapIDToComponentImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return RModelPackage.Literals.MAP_ID_TO_COMPONENT;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public R4EID getTypedKey() {
if (key != null && key.eIsProxy()) {
InternalEObject oldKey = (InternalEObject)key;
key = (R4EID)eResolveProxy(oldKey);
if (key != oldKey) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, RModelPackage.MAP_ID_TO_COMPONENT__KEY, oldKey, key));
}
}
return key;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public R4EID basicGetTypedKey() {
return key;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setTypedKey(R4EID newKey) {
R4EID oldKey = key;
key = newKey;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RModelPackage.MAP_ID_TO_COMPONENT__KEY, oldKey, key));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public R4EIDComponent getTypedValue() {
if (value != null && value.eIsProxy()) {
InternalEObject oldValue = (InternalEObject)value;
value = (R4EIDComponent)eResolveProxy(oldValue);
if (value != oldValue) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, RModelPackage.MAP_ID_TO_COMPONENT__VALUE, oldValue, value));
}
}
return value;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public R4EIDComponent basicGetTypedValue() {
return value;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setTypedValue(R4EIDComponent newValue) {
R4EIDComponent oldValue = value;
value = newValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RModelPackage.MAP_ID_TO_COMPONENT__VALUE, oldValue, value));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case RModelPackage.MAP_ID_TO_COMPONENT__KEY:
if (resolve) return getTypedKey();
return basicGetTypedKey();
case RModelPackage.MAP_ID_TO_COMPONENT__VALUE:
if (resolve) return getTypedValue();
return basicGetTypedValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case RModelPackage.MAP_ID_TO_COMPONENT__KEY:
setTypedKey((R4EID)newValue);
return;
case RModelPackage.MAP_ID_TO_COMPONENT__VALUE:
setTypedValue((R4EIDComponent)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case RModelPackage.MAP_ID_TO_COMPONENT__KEY:
setTypedKey((R4EID)null);
return;
case RModelPackage.MAP_ID_TO_COMPONENT__VALUE:
setTypedValue((R4EIDComponent)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case RModelPackage.MAP_ID_TO_COMPONENT__KEY:
return key != null;
case RModelPackage.MAP_ID_TO_COMPONENT__VALUE:
return value != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
protected int hash = -1;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public int getHash() {
if (hash == -1) {
Object theKey = getKey();
hash = (theKey == null ? 0 : theKey.hashCode());
}
return hash;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setHash(int hash) {
this.hash = hash;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public R4EID getKey() {
return getTypedKey();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setKey(R4EID key) {
setTypedKey(key);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public R4EIDComponent getValue() {
return getTypedValue();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public R4EIDComponent setValue(R4EIDComponent value) {
R4EIDComponent oldValue = getValue();
setTypedValue(value);
return oldValue;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
public EMap<R4EID, R4EIDComponent> getEMap() {
EObject container = eContainer();
return container == null ? null : (EMap<R4EID, R4EIDComponent>)container.eGet(eContainmentFeature());
}
} //MapIDToComponentImpl