blob: 6f84a47a2002222c69e547c7b51e12a81e5ff02a [file] [log] [blame]
package org.eclipse.stem.diseasemodels.standard.impl;
/*******************************************************************************
* Copyright (c) 2006 IBM Corporation 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.stem.core.graph.Node;
import org.eclipse.stem.core.graph.impl.DynamicNodeLabelImpl;
import org.eclipse.stem.definitions.labels.PopulationLabel;
import org.eclipse.stem.diseasemodels.standard.DiseaseModelLabel;
import org.eclipse.stem.diseasemodels.standard.DiseaseModelLabelValue;
import org.eclipse.stem.diseasemodels.standard.StandardPackage;
import org.eclipse.stem.populationmodels.standard.PopulationModelLabel;
/**
* <!-- begin-user-doc --> An implementation of the model object '<em><b>Disease Model Label</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.stem.diseasemodels.standard.impl.DiseaseModelLabelImpl#getPopulationLabel <em>Population Label</em>}</li>
* <li>{@link org.eclipse.stem.diseasemodels.standard.impl.DiseaseModelLabelImpl#getPopulationModelLabel <em>Population Model Label</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class DiseaseModelLabelImpl extends DynamicNodeLabelImpl
implements DiseaseModelLabel {
/**
* The cached value of the '{@link #getPopulationLabel() <em>Population Label</em>}' reference.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @see #getPopulationLabel()
* @generated
* @ordered
*/
protected PopulationLabel populationLabel;
/**
* The cached value of the '{@link #getPopulationModelLabel() <em>Population Model Label</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPopulationModelLabel()
* @generated
* @ordered
*/
protected PopulationModelLabel populationModelLabel;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
protected DiseaseModelLabelImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return StandardPackage.Literals.DISEASE_MODEL_LABEL;
}
/**
* <!-- begin-user-doc -->
*
* @return
*
* <!-- end-user-doc -->
* @generated
*/
public PopulationLabel getPopulationLabel() {
if (populationLabel != null && populationLabel.eIsProxy()) {
InternalEObject oldPopulationLabel = (InternalEObject)populationLabel;
populationLabel = (PopulationLabel)eResolveProxy(oldPopulationLabel);
if (populationLabel != oldPopulationLabel) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, StandardPackage.DISEASE_MODEL_LABEL__POPULATION_LABEL, oldPopulationLabel, populationLabel));
}
}
return populationLabel;
}
/**
* <!-- begin-user-doc -->
*
* @return
*
* <!-- end-user-doc -->
* @generated
*/
public PopulationLabel basicGetPopulationLabel() {
return populationLabel;
}
/**
* <!-- begin-user-doc -->
*
* @param newPopulationLabel
*
* <!-- end-user-doc -->
* @generated
*/
public void setPopulationLabel(PopulationLabel newPopulationLabel) {
PopulationLabel oldPopulationLabel = populationLabel;
populationLabel = newPopulationLabel;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StandardPackage.DISEASE_MODEL_LABEL__POPULATION_LABEL, oldPopulationLabel, populationLabel));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PopulationModelLabel getPopulationModelLabel() {
if (populationModelLabel != null && populationModelLabel.eIsProxy()) {
InternalEObject oldPopulationModelLabel = (InternalEObject)populationModelLabel;
populationModelLabel = (PopulationModelLabel)eResolveProxy(oldPopulationModelLabel);
if (populationModelLabel != oldPopulationModelLabel) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, StandardPackage.DISEASE_MODEL_LABEL__POPULATION_MODEL_LABEL, oldPopulationModelLabel, populationModelLabel));
}
}
return populationModelLabel;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PopulationModelLabel basicGetPopulationModelLabel() {
return populationModelLabel;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPopulationModelLabel(PopulationModelLabel newPopulationModelLabel) {
PopulationModelLabel oldPopulationModelLabel = populationModelLabel;
populationModelLabel = newPopulationModelLabel;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StandardPackage.DISEASE_MODEL_LABEL__POPULATION_MODEL_LABEL, oldPopulationModelLabel, populationModelLabel));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public DiseaseModelLabelValue getCurrentDiseaseModelLabelValue() {
return (DiseaseModelLabelValue)getCurrentValue();
} // getCurrentDiseaseModelLabelValue
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public DiseaseModelLabelValue getNextDiseaseModelLabelValue() {
return (DiseaseModelLabelValue)getNextValue();
} // getNextDiseaseModelLabelValue
/**
* Label the node with the disease model label
*
* @param dml
* the disease model label
*
* @param populationModelLabel
* the dynamic population label affected by the disease (e.g. women)
*
* @param node
* the node that has the population being affected by the disease
*/
public static void labelNode(final DiseaseModelLabel dml,
final PopulationModelLabel populationModelLabel, final Node node) {
dml.setPopulationLabel(populationModelLabel.getPopulationLabel());
dml.setPopulationModelLabel(populationModelLabel);
node.getLabels().add(dml);
} // labelNode
/**
* <!-- begin-user-doc -->
*
* @param featureID
* @param resolve
* @param coreType
*
* @return
*
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case StandardPackage.DISEASE_MODEL_LABEL__POPULATION_LABEL:
if (resolve) return getPopulationLabel();
return basicGetPopulationLabel();
case StandardPackage.DISEASE_MODEL_LABEL__POPULATION_MODEL_LABEL:
if (resolve) return getPopulationModelLabel();
return basicGetPopulationModelLabel();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
*
* @param featureID
* @param newValue
*
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case StandardPackage.DISEASE_MODEL_LABEL__POPULATION_LABEL:
setPopulationLabel((PopulationLabel)newValue);
return;
case StandardPackage.DISEASE_MODEL_LABEL__POPULATION_MODEL_LABEL:
setPopulationModelLabel((PopulationModelLabel)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
*
* @param featureID
*
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case StandardPackage.DISEASE_MODEL_LABEL__POPULATION_LABEL:
setPopulationLabel((PopulationLabel)null);
return;
case StandardPackage.DISEASE_MODEL_LABEL__POPULATION_MODEL_LABEL:
setPopulationModelLabel((PopulationModelLabel)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
*
* @param featureID
*
* @return
*
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case StandardPackage.DISEASE_MODEL_LABEL__POPULATION_LABEL:
return populationLabel != null;
case StandardPackage.DISEASE_MODEL_LABEL__POPULATION_MODEL_LABEL:
return populationModelLabel != null;
}
return super.eIsSet(featureID);
}
/**
* @see org.eclipse.stem.core.graph.impl.DynamicNodeLabelImpl#sane()
*/
@Override
public boolean sane() {
boolean retValue = super.sane();
assert retValue;
return retValue;
} // sane
} // DiseaseModelLabelImpl