blob: 2738085fe81f55d3cc3234b451974b4b5af0ccfc [file] [log] [blame]
/*
* Copyright (c) 2014, 2015, 2018 Eike Stepper (Loehne, Germany) 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:
* 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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Project To Stream Map Entry</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.oomph.setup.impl.ProjectToStreamMapEntryImpl#getTypedKey <em>Key</em>}</li>
* <li>{@link org.eclipse.oomph.setup.impl.ProjectToStreamMapEntryImpl#getTypedValue <em>Value</em>}</li>
* <li>{@link org.eclipse.oomph.setup.impl.ProjectToStreamMapEntryImpl#isSelection <em>Selection</em>}</li>
* </ul>
*
* @generated
*/
public class ProjectToStreamMapEntryImpl extends MinimalEObjectImpl.Container implements BasicEMap.Entry<Project, Stream>
{
/**
* The cached value of the '{@link #getTypedKey() <em>Key</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTypedKey()
* @generated
* @ordered
*/
protected Project key;
/**
* The cached value of the '{@link #getTypedValue() <em>Value</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTypedValue()
* @generated
* @ordered
*/
protected Stream value;
/**
* The default value of the '{@link #isSelection() <em>Selection</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSelection()
* @generated
* @ordered
*/
protected static final boolean SELECTION_EDEFAULT = false;
/**
* The cached value of the '{@link #isSelection() <em>Selection</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSelection()
* @generated
* @ordered
*/
protected boolean selection = SELECTION_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ProjectToStreamMapEntryImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return SetupPackage.Literals.PROJECT_TO_STREAM_MAP_ENTRY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Project basicGetTypedKey()
{
return key;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Stream basicGetTypedValue()
{
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSelection()
{
return selection;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy())
{
return super.toString();
}
StringBuilder result = new StringBuilder(super.toString());
result.append(" (selection: "); //$NON-NLS-1$
result.append(selection);
result.append(')');
return result.toString();
}
/**
* <!-- 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 Project getKey()
{
return getTypedKey();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setKey(Project key)
{
setTypedKey(key);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Stream getValue()
{
return getTypedValue();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Stream setValue(Stream value)
{
Stream oldValue = getValue();
setTypedValue(value);
return oldValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
public EMap<Project, Stream> getEMap()
{
EObject container = eContainer();
return container == null ? null : (EMap<Project, Stream>)container.eGet(eContainmentFeature());
}
} // ProjectToStreamMapEntryImpl