| 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 java.text.NumberFormat; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.stem.core.graph.IntegrationLabelValue; |
| import org.eclipse.stem.core.graph.LabelValue; |
| import org.eclipse.stem.diseasemodels.standard.DiseaseModelLabelValue; |
| import org.eclipse.stem.diseasemodels.standard.StandardDiseaseModelLabelValue; |
| import org.eclipse.stem.diseasemodels.standard.StandardPackage; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object '<em><b>Disease Model Label Value</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.stem.diseasemodels.standard.impl.StandardDiseaseModelLabelValueImpl#getS <em>S</em>}</li> |
| * <li>{@link org.eclipse.stem.diseasemodels.standard.impl.StandardDiseaseModelLabelValueImpl#getIncidence <em>Incidence</em>}</li> |
| * <li>{@link org.eclipse.stem.diseasemodels.standard.impl.StandardDiseaseModelLabelValueImpl#getDiseaseDeaths <em>Disease Deaths</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public abstract class StandardDiseaseModelLabelValueImpl extends |
| DiseaseModelLabelValueImpl implements StandardDiseaseModelLabelValue { |
| |
| /** |
| * The default value of the '{@link #getS() <em>S</em>}' attribute. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getS() |
| * @generated |
| * @ordered |
| */ |
| protected static final double S_EDEFAULT = 0.0; |
| |
| /** |
| * The cached value of the '{@link #getS() <em>S</em>}' attribute. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getS() |
| * @generated |
| * @ordered |
| */ |
| protected double s = S_EDEFAULT; |
| |
| |
| /** |
| * The default value of the '{@link #getIncidence() <em>Incidence</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getIncidence() |
| * @generated |
| * @ordered |
| */ |
| protected static final double INCIDENCE_EDEFAULT = 0.0; |
| |
| /** |
| * The cached value of the '{@link #getIncidence() <em>Incidence</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getIncidence() |
| * @generated |
| * @ordered |
| */ |
| protected double incidence = INCIDENCE_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getDiseaseDeaths() <em>Disease Deaths</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDiseaseDeaths() |
| * @generated |
| * @ordered |
| */ |
| protected static final double DISEASE_DEATHS_EDEFAULT = 0.0; |
| |
| /** |
| * The cached value of the '{@link #getDiseaseDeaths() <em>Disease Deaths</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDiseaseDeaths() |
| * @generated |
| * @ordered |
| */ |
| protected double diseaseDeaths = DISEASE_DEATHS_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| protected StandardDiseaseModelLabelValueImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * This is used to create instances for testing purposes. |
| * |
| * @param s |
| * the number of susceptible population members |
| * |
| * @param births |
| * the number of births that have occured in the population |
| * @param deaths |
| * the total number of deaths that have occured in the population |
| * @param diseaseDeaths |
| * the number of deaths due to the disease that have occured in |
| * the population |
| * |
| * <!-- end-user-doc --> |
| */ |
| public StandardDiseaseModelLabelValueImpl(final double s, final double incidence, final double diseaseDeaths) { |
| super(); |
| this.setS(s); |
| this.setIncidence(incidence); |
| this.setDiseaseDeaths(diseaseDeaths); |
| } // StandardDiseaseModelLabelValueImpl |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return StandardPackage.Literals.STANDARD_DISEASE_MODEL_LABEL_VALUE; |
| } |
| |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * @return |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public double getS() { |
| return s; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * @param newS |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setS(double newS) { |
| double oldS = s; |
| s = newS; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, StandardPackage.STANDARD_DISEASE_MODEL_LABEL_VALUE__S, oldS, s)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public double getIncidence() { |
| return incidence; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setIncidence(double newIncidence) { |
| double oldIncidence = incidence; |
| incidence = newIncidence; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, StandardPackage.STANDARD_DISEASE_MODEL_LABEL_VALUE__INCIDENCE, oldIncidence, incidence)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public double getDiseaseDeaths() { |
| return diseaseDeaths; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setDiseaseDeaths(double newDiseaseDeaths) { |
| double oldDiseaseDeaths = diseaseDeaths; |
| diseaseDeaths = newDiseaseDeaths; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, StandardPackage.STANDARD_DISEASE_MODEL_LABEL_VALUE__DISEASE_DEATHS, oldDiseaseDeaths, diseaseDeaths)); |
| } |
| |
| /** |
| * <!-- 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.STANDARD_DISEASE_MODEL_LABEL_VALUE__S: |
| return getS(); |
| case StandardPackage.STANDARD_DISEASE_MODEL_LABEL_VALUE__INCIDENCE: |
| return getIncidence(); |
| case StandardPackage.STANDARD_DISEASE_MODEL_LABEL_VALUE__DISEASE_DEATHS: |
| return getDiseaseDeaths(); |
| } |
| 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.STANDARD_DISEASE_MODEL_LABEL_VALUE__S: |
| setS((Double)newValue); |
| return; |
| case StandardPackage.STANDARD_DISEASE_MODEL_LABEL_VALUE__INCIDENCE: |
| setIncidence((Double)newValue); |
| return; |
| case StandardPackage.STANDARD_DISEASE_MODEL_LABEL_VALUE__DISEASE_DEATHS: |
| setDiseaseDeaths((Double)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.STANDARD_DISEASE_MODEL_LABEL_VALUE__S: |
| setS(S_EDEFAULT); |
| return; |
| case StandardPackage.STANDARD_DISEASE_MODEL_LABEL_VALUE__INCIDENCE: |
| setIncidence(INCIDENCE_EDEFAULT); |
| return; |
| case StandardPackage.STANDARD_DISEASE_MODEL_LABEL_VALUE__DISEASE_DEATHS: |
| setDiseaseDeaths(DISEASE_DEATHS_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * @param featureID |
| * @return |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case StandardPackage.STANDARD_DISEASE_MODEL_LABEL_VALUE__S: |
| return s != S_EDEFAULT; |
| case StandardPackage.STANDARD_DISEASE_MODEL_LABEL_VALUE__INCIDENCE: |
| return incidence != INCIDENCE_EDEFAULT; |
| case StandardPackage.STANDARD_DISEASE_MODEL_LABEL_VALUE__DISEASE_DEATHS: |
| return diseaseDeaths != DISEASE_DEATHS_EDEFAULT; |
| } |
| 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(" (s: "); //$NON-NLS-1$ |
| result.append(s); |
| result.append(", incidence: "); //$NON-NLS-1$ |
| result.append(incidence); |
| result.append(", diseaseDeaths: "); //$NON-NLS-1$ |
| result.append(diseaseDeaths); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // StandardDiseaseModelLabelValueImpl |