/** | |
* ******************************************************************************* | |
* * 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.InternalEList; | |
import org.eclipse.modisco.utils.chart.metamodel.internal.chart.Axe; | |
import org.eclipse.modisco.utils.chart.metamodel.internal.chart.Chart; | |
import org.eclipse.modisco.utils.chart.metamodel.internal.chart.ChartPackage; | |
import org.eclipse.modisco.utils.chart.metamodel.internal.chart.Serie; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Chart</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.modisco.utils.chart.metamodel.internal.chart.impl.ChartImpl#getAxes <em>Axes</em>}</li> | |
* <li>{@link org.eclipse.modisco.utils.chart.metamodel.internal.chart.impl.ChartImpl#getSeries <em>Series</em>}</li> | |
* <li>{@link org.eclipse.modisco.utils.chart.metamodel.internal.chart.impl.ChartImpl#getTitle <em>Title</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class ChartImpl extends EObjectImpl implements Chart { | |
/** | |
* <!-- 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 #getAxes() <em>Axes</em>}' containment reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getAxes() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<Axe> axes; | |
/** | |
* The cached value of the '{@link #getSeries() <em>Series</em>}' containment reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getSeries() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<Serie> series; | |
/** | |
* The default value of the '{@link #getTitle() <em>Title</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getTitle() | |
* @generated | |
* @ordered | |
*/ | |
protected static final String TITLE_EDEFAULT = null; | |
/** | |
* The cached value of the '{@link #getTitle() <em>Title</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getTitle() | |
* @generated | |
* @ordered | |
*/ | |
protected String title = TITLE_EDEFAULT; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected ChartImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return ChartPackage.Literals.CHART; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<Axe> getAxes() { | |
if (axes == null) { | |
axes = new EObjectContainmentEList<Axe>(Axe.class, this, ChartPackage.CHART__AXES); | |
} | |
return axes; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<Serie> getSeries() { | |
if (series == null) { | |
series = new EObjectContainmentEList<Serie>(Serie.class, this, ChartPackage.CHART__SERIES); | |
} | |
return series; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public String getTitle() { | |
return title; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setTitle(String newTitle) { | |
String oldTitle = title; | |
title = newTitle; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, ChartPackage.CHART__TITLE, oldTitle, title)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case ChartPackage.CHART__AXES: | |
return ((InternalEList<?>)getAxes()).basicRemove(otherEnd, msgs); | |
case ChartPackage.CHART__SERIES: | |
return ((InternalEList<?>)getSeries()).basicRemove(otherEnd, msgs); | |
} | |
return super.eInverseRemove(otherEnd, featureID, msgs); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
switch (featureID) { | |
case ChartPackage.CHART__AXES: | |
return getAxes(); | |
case ChartPackage.CHART__SERIES: | |
return getSeries(); | |
case ChartPackage.CHART__TITLE: | |
return getTitle(); | |
} | |
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.CHART__AXES: | |
getAxes().clear(); | |
getAxes().addAll((Collection<? extends Axe>)newValue); | |
return; | |
case ChartPackage.CHART__SERIES: | |
getSeries().clear(); | |
getSeries().addAll((Collection<? extends Serie>)newValue); | |
return; | |
case ChartPackage.CHART__TITLE: | |
setTitle((String)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case ChartPackage.CHART__AXES: | |
getAxes().clear(); | |
return; | |
case ChartPackage.CHART__SERIES: | |
getSeries().clear(); | |
return; | |
case ChartPackage.CHART__TITLE: | |
setTitle(TITLE_EDEFAULT); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case ChartPackage.CHART__AXES: | |
return axes != null && !axes.isEmpty(); | |
case ChartPackage.CHART__SERIES: | |
return series != null && !series.isEmpty(); | |
case ChartPackage.CHART__TITLE: | |
return TITLE_EDEFAULT == null ? title != null : !TITLE_EDEFAULT.equals(title); | |
} | |
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(" (title: "); | |
result.append(title); | |
result.append(')'); | |
return result.toString(); | |
} | |
} //ChartImpl |