/** | |
* ******************************************************************************* | |
* * Copyright (c) 2012 INRIA. 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: Guillaume Doux - INRIA - Initial API and implementation | |
* * | |
* ****************************************************************************** | |
* | |
*/ | |
package org.eclipse.modisco.utils.chart.metamodel.internal.chart.impl; | |
import java.util.Collection; | |
import org.eclipse.emf.common.notify.Notification; | |
import org.eclipse.emf.common.notify.NotificationChain; | |
import org.eclipse.emf.common.util.EList; | |
import org.eclipse.emf.ecore.EClass; | |
import org.eclipse.emf.ecore.InternalEObject; | |
import org.eclipse.emf.ecore.impl.ENotificationImpl; | |
import org.eclipse.emf.ecore.impl.EObjectImpl; | |
import org.eclipse.emf.ecore.util.EObjectContainmentEList; | |
import org.eclipse.emf.ecore.util.EcoreUtil; | |
import org.eclipse.emf.ecore.util.InternalEList; | |
import org.eclipse.modisco.utils.chart.metamodel.internal.chart.ChartPackage; | |
import org.eclipse.modisco.utils.chart.metamodel.internal.chart.Coordinate; | |
import org.eclipse.modisco.utils.chart.metamodel.internal.chart.Point; | |
import org.eclipse.modisco.utils.chart.metamodel.internal.chart.Serie; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Point</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.modisco.utils.chart.metamodel.internal.chart.impl.PointImpl#getSerie <em>Serie</em>}</li> | |
* <li>{@link org.eclipse.modisco.utils.chart.metamodel.internal.chart.impl.PointImpl#getCoordinates <em>Coordinates</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class PointImpl extends EObjectImpl implements Point { | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public static final String copyright = "*******************************************************************************\r\n * Copyright (c) 2012 INRIA. All rights reserved. This program and the\r\n * accompanying materials are made available under the terms of the Eclipse\r\n * Public License v1.0 which accompanies this distribution, and is available at\r\n * http://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors: Guillaume Doux - INRIA - Initial API and implementation\r\n * \r\n ******************************************************************************\r\n"; | |
/** | |
* The cached value of the '{@link #getCoordinates() <em>Coordinates</em>}' containment reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getCoordinates() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<Coordinate> coordinates; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected PointImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return ChartPackage.Literals.POINT; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Serie getSerie() { | |
if (eContainerFeatureID() != ChartPackage.POINT__SERIE) return null; | |
return (Serie)eContainer(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NotificationChain basicSetSerie(Serie newSerie, NotificationChain msgs) { | |
msgs = eBasicSetContainer((InternalEObject)newSerie, ChartPackage.POINT__SERIE, msgs); | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setSerie(Serie newSerie) { | |
if (newSerie != eInternalContainer() || (eContainerFeatureID() != ChartPackage.POINT__SERIE && newSerie != null)) { | |
if (EcoreUtil.isAncestor(this, newSerie)) | |
throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); | |
NotificationChain msgs = null; | |
if (eInternalContainer() != null) | |
msgs = eBasicRemoveFromContainer(msgs); | |
if (newSerie != null) | |
msgs = ((InternalEObject)newSerie).eInverseAdd(this, ChartPackage.SERIE__POINTS, Serie.class, msgs); | |
msgs = basicSetSerie(newSerie, msgs); | |
if (msgs != null) msgs.dispatch(); | |
} | |
else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, ChartPackage.POINT__SERIE, newSerie, newSerie)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<Coordinate> getCoordinates() { | |
if (coordinates == null) { | |
coordinates = new EObjectContainmentEList<Coordinate>(Coordinate.class, this, ChartPackage.POINT__COORDINATES); | |
} | |
return coordinates; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case ChartPackage.POINT__SERIE: | |
if (eInternalContainer() != null) | |
msgs = eBasicRemoveFromContainer(msgs); | |
return basicSetSerie((Serie)otherEnd, msgs); | |
} | |
return super.eInverseAdd(otherEnd, featureID, msgs); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case ChartPackage.POINT__SERIE: | |
return basicSetSerie(null, msgs); | |
case ChartPackage.POINT__COORDINATES: | |
return ((InternalEList<?>)getCoordinates()).basicRemove(otherEnd, msgs); | |
} | |
return super.eInverseRemove(otherEnd, featureID, msgs); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { | |
switch (eContainerFeatureID()) { | |
case ChartPackage.POINT__SERIE: | |
return eInternalContainer().eInverseRemove(this, ChartPackage.SERIE__POINTS, Serie.class, msgs); | |
} | |
return super.eBasicRemoveFromContainerFeature(msgs); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
switch (featureID) { | |
case ChartPackage.POINT__SERIE: | |
return getSerie(); | |
case ChartPackage.POINT__COORDINATES: | |
return getCoordinates(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@SuppressWarnings("unchecked") | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case ChartPackage.POINT__SERIE: | |
setSerie((Serie)newValue); | |
return; | |
case ChartPackage.POINT__COORDINATES: | |
getCoordinates().clear(); | |
getCoordinates().addAll((Collection<? extends Coordinate>)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case ChartPackage.POINT__SERIE: | |
setSerie((Serie)null); | |
return; | |
case ChartPackage.POINT__COORDINATES: | |
getCoordinates().clear(); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case ChartPackage.POINT__SERIE: | |
return getSerie() != null; | |
case ChartPackage.POINT__COORDINATES: | |
return coordinates != null && !coordinates.isEmpty(); | |
} | |
return super.eIsSet(featureID); | |
} | |
} //PointImpl |