blob: 76e8b36e8e5903bc48dfd98b4812dc10255a2731 [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.LabelValue;
import org.eclipse.stem.diseasemodels.standard.SILabel;
import org.eclipse.stem.diseasemodels.standard.SILabelValue;
import org.eclipse.stem.diseasemodels.standard.StandardFactory;
import org.eclipse.stem.diseasemodels.standard.StandardPackage;
/**
* <!-- begin-user-doc --> An implementation of the model object '<em><b>SI Label</b></em>'.
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public class SILabelImpl extends StandardDiseaseModelLabelImpl implements
SILabel {
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
protected SILabelImpl() {
setCurrentValue(StandardFactory.eINSTANCE.createSILabelValue());
setNextValue(StandardFactory.eINSTANCE.createSILabelValue());
setTempValue(StandardFactory.eINSTANCE.createSILabelValue());
setProbeValue(StandardFactory.eINSTANCE.createSILabelValue());
setErrorScale(StandardFactory.eINSTANCE.createSILabelValue());
setDeltaValue(StandardFactory.eINSTANCE.createSILabelValue());
} // SILabelImpl
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return StandardPackage.Literals.SI_LABEL;
}
/**
* <!-- begin-user-doc -->
*
* @return
*
* <!-- end-user-doc -->
* @generated NOT
*/
public SILabelValue getCurrentSIValue() {
return (SILabelValue) getCurrentValue();
} // getCurrentSIValue
/**
* <!-- begin-user-doc -->
*
* @return
*
* <!-- end-user-doc -->
*
* @generated NOT
*/
public SILabelValue getNextSIValue() {
return (SILabelValue) getNextValue();
} // getNextSIValue
/**
* @return set the number number of infectious population members
*/
public void setNextI(double i) {
((SILabelValue)getNextValue()).setI(i);
}
/**
* @see org.eclipse.stem.diseasemodels.standard.SILabel#getI()
*/
public double getI() {
return getCurrentSIValue().getI();
} // getI
/**
* @see org.eclipse.stem.diseasemodels.standard.SILabel#setI()
*/
public void setI(double i) {
getCurrentSIValue().setI(i);
} // getI
/**
* @see org.eclipse.stem.diseasemodels.standard.SILabel#getNextI()
*/
public double getNextI() {
return getNextSIValue().getI();
} // getNextI
/**
* set disease deaths
*/
public void setDiseaseDeaths(double d) {
(((SILabelValue)getCurrentValue())).setDiseaseDeaths(d);
} // setDiseaseDeaths
/**
* get disease deaths
*/
public double getDiseaseDeaths(){
return getCurrentSIValue().getDiseaseDeaths();
} // getDiseaseDeaths
/**
* @see org.eclipse.stem.diseasemodels.standard.SILabel#getIncidence()
*/
public double getIncidence() {
return this.getCurrentSIValue().getIncidence();
}
/**
* @see org.eclipse.stem.diseasemodels.standard.SILabel#setIncidence(double)
*/
public void setIncidence(double incidence) {
this.getCurrentSIValue().setIncidence(incidence);
}
public String toTooltipString() {
StringBuffer result = new StringBuffer();
double populationCount = getCurrentSIValue().getPopulationCount();
if(populationCount == 0) populationCount = 1; // Avoid divide by 0, all zeros will be displayed for the compartments
result.append(getPopulationModelLabel() + ": ");
result.append("S:"); //$NON-NLS-1$
result.append(getPercentFormat().format( (getS()) / populationCount) );
result.append(", I:"); //$NON-NLS-1$
result.append(getPercentFormat().format( (getI()) / populationCount) );
result.append(", DD:"); //$NON-NLS-1$
result.append(getPercentFormat().format( (getDiseaseDeaths()) / populationCount) );
return result.toString();
} //toTooltipString
} // SILabelImpl