| 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.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.SIRLabelValue; |
| import org.eclipse.stem.diseasemodels.standard.StandardPackage; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object '<em><b>SIR Label Value</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.stem.diseasemodels.standard.impl.SIRLabelValueImpl#getR <em>R</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class SIRLabelValueImpl extends SILabelValueImpl implements |
| SIRLabelValue { |
| /** |
| * The default value of the '{@link #getR() <em>R</em>}' attribute. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getR() |
| * @generated |
| * @ordered |
| */ |
| protected static final double R_EDEFAULT = 0.0; |
| |
| /** |
| * The cached value of the '{@link #getR() <em>R</em>}' attribute. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getR() |
| * @generated |
| * @ordered |
| */ |
| protected double r = R_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| protected SIRLabelValueImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * This is used to create instances for testing purposes. |
| * |
| * @param s |
| * the number of susceptible population members |
| * |
| * @param iR |
| * the number of recovering infectious population members |
| * |
| * @param iF |
| * the number of fatally infectious population members |
| * |
| * @param incidence |
| * the new incidence from the interaction term in the compartment model |
| * |
| * @param r |
| * the number of recovered 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 SIRLabelValueImpl(final double s, final double i, |
| final double incidence, final double r, |
| final double diseaseDeaths) { |
| super(s, i, incidence, diseaseDeaths); |
| this.setR(r); |
| } // SIRLabelValueImpl |
| |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * This is used to create instances for testing purposes. |
| * |
| * @param s |
| * the number of susceptible population members |
| * |
| * @param iR |
| * the number of recovering infectious population members |
| * |
| * @param iF |
| * the number of fatally infectious population members |
| * |
| * @param r |
| * the number of recovered 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 SIRLabelValueImpl(final double s, final double i, |
| final double r, final double diseaseDeaths) { |
| super(s, i, 0.0, diseaseDeaths); |
| this.setR(r); |
| } // SIRLabelValueImpl |
| |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return StandardPackage.Literals.SIR_LABEL_VALUE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * @return the number of Infectious population members. |
| * |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public double getR() { |
| return r; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * @param newR |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setR(double newR) { |
| double oldR = r; |
| r = newR; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, StandardPackage.SIR_LABEL_VALUE__R, oldR, r)); |
| } |
| |
| /** |
| * <!-- 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.SIR_LABEL_VALUE__R: |
| return getR(); |
| } |
| 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.SIR_LABEL_VALUE__R: |
| setR((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.SIR_LABEL_VALUE__R: |
| setR(R_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.SIR_LABEL_VALUE__R: |
| return r != R_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(" (r: "); //$NON-NLS-1$ |
| result.append(r); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // SIRLabelValueImpl |