/* * Copyright (c) 2014 Eike Stepper (Berlin, Germany) 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: * Eike Stepper - initial API and implementation */ package org.eclipse.oomph.setup.impl; import org.eclipse.oomph.setup.Project; import org.eclipse.oomph.setup.SetupPackage; import org.eclipse.oomph.setup.Stream; 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.MinimalEObjectImpl; /** * * An implementation of the model object 'Project To Stream Map Entry'. * *

* The following features are implemented: *

*

* * @generated */ public class ProjectToStreamMapEntryImpl extends MinimalEObjectImpl.Container implements BasicEMap.Entry { /** * The cached value of the '{@link #getTypedKey() Key}' reference. * * * @see #getTypedKey() * @generated * @ordered */ protected Project key; /** * The cached value of the '{@link #getTypedValue() Value}' reference. * * * @see #getTypedValue() * @generated * @ordered */ protected Stream value; /** * The default value of the '{@link #isSelection() Selection}' attribute. * * * @see #isSelection() * @generated * @ordered */ protected static final boolean SELECTION_EDEFAULT = false; /** * The cached value of the '{@link #isSelection() Selection}' attribute. * * * @see #isSelection() * @generated * @ordered */ protected boolean selection = SELECTION_EDEFAULT; /** * * * @generated */ protected ProjectToStreamMapEntryImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return SetupPackage.Literals.PROJECT_TO_STREAM_MAP_ENTRY; } /** * * * @generated */ public Project getTypedKey() { if (key != null && key.eIsProxy()) { InternalEObject oldKey = (InternalEObject)key; key = (Project)eResolveProxy(oldKey); if (key != oldKey) { if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.RESOLVE, SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__KEY, oldKey, key)); } } } return key; } /** * * * @generated */ public Project basicGetTypedKey() { return key; } /** * * * @generated */ public void setTypedKey(Project newKey) { Project oldKey = key; key = newKey; if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__KEY, oldKey, key)); } } /** * * * @generated */ public Stream getTypedValue() { if (value != null && value.eIsProxy()) { InternalEObject oldValue = (InternalEObject)value; value = (Stream)eResolveProxy(oldValue); if (value != oldValue) { if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.RESOLVE, SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__VALUE, oldValue, value)); } } } return value; } /** * * * @generated */ public Stream basicGetTypedValue() { return value; } /** * * * @generated */ public void setTypedValue(Stream newValue) { Stream oldValue = value; value = newValue; if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__VALUE, oldValue, value)); } } /** * * * @generated */ public boolean isSelection() { return selection; } /** * * * @generated */ public void setSelection(boolean newSelection) { boolean oldSelection = selection; selection = newSelection; if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__SELECTION, oldSelection, selection)); } } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__KEY: if (resolve) { return getTypedKey(); } return basicGetTypedKey(); case SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__VALUE: if (resolve) { return getTypedValue(); } return basicGetTypedValue(); case SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__SELECTION: return isSelection(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__KEY: setTypedKey((Project)newValue); return; case SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__VALUE: setTypedValue((Stream)newValue); return; case SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__SELECTION: setSelection((Boolean)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__KEY: setTypedKey((Project)null); return; case SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__VALUE: setTypedValue((Stream)null); return; case SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__SELECTION: setSelection(SELECTION_EDEFAULT); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__KEY: return key != null; case SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__VALUE: return value != null; case SetupPackage.PROJECT_TO_STREAM_MAP_ENTRY__SELECTION: return selection != SELECTION_EDEFAULT; } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) { return super.toString(); } StringBuffer result = new StringBuffer(super.toString()); result.append(" (selection: "); result.append(selection); result.append(')'); return result.toString(); } /** * * * @generated */ protected int hash = -1; /** * * * @generated */ public int getHash() { if (hash == -1) { Object theKey = getKey(); hash = theKey == null ? 0 : theKey.hashCode(); } return hash; } /** * * * @generated */ public void setHash(int hash) { this.hash = hash; } /** * * * @generated */ public Project getKey() { return getTypedKey(); } /** * * * @generated */ public void setKey(Project key) { setTypedKey(key); } /** * * * @generated */ public Stream getValue() { return getTypedValue(); } /** * * * @generated */ public Stream setValue(Stream value) { Stream oldValue = getValue(); setTypedValue(value); return oldValue; } /** * * * @generated */ @SuppressWarnings("unchecked") public EMap getEMap() { EObject container = eContainer(); return container == null ? null : (EMap)container.eGet(eContainmentFeature()); } } // ProjectToStreamMapEntryImpl