Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Davis2011-06-14 21:25:25 +0000
committerMatthew Davis2011-06-14 21:25:25 +0000
commitd5c2937acb79b2ec618777a30913ef7040cc42d8 (patch)
tree636f707f11d4f20baababbeadb6327a6f822fe18
parente9cb29ccc9430af469e18e36c5c92940b84118e1 (diff)
downloadorg.eclipse.stem-d5c2937acb79b2ec618777a30913ef7040cc42d8.tar.gz
org.eclipse.stem-d5c2937acb79b2ec618777a30913ef7040cc42d8.tar.xz
org.eclipse.stem-d5c2937acb79b2ec618777a30913ef7040cc42d8.zip
Applying patch from bug 349245 for new contribution from Chris Thoens. Implements seasonal variation for multiple population disease models.
git-svn-id: http://dev.eclipse.org/svnroot/technology/org.eclipse.stem/trunk@1996 92a21009-5b66-0410-b83a-dc787c41c6e9
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/model/multipopulation.ecore11
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/model/multipopulation.genmodel3
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/plugin.properties16
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/plugin.xml16
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/InterpolationType.java212
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/MultiPopulationSeasonalDiseaseModel.java84
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/MultipopulationFactory.java10
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/MultipopulationPackage.java331
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/impl/MultiPopulationSeasonalDiseaseModelImpl.java482
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/impl/MultipopulationFactoryImpl.java64
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/impl/MultipopulationPackageImpl.java70
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/provider/MultiPopulationSeasonalDiseaseModelItemProvider.java239
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/provider/MultipopulationItemProviderAdapterFactory.java24
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/util/MultipopulationAdapterFactory.java28
-rw-r--r--org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/util/MultipopulationSwitch.java41
-rw-r--r--org.eclipse.stem.tests.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/tests/MultiPopulationSeasonalDiseaseModelTest.java74
-rw-r--r--org.eclipse.stem.tests.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/tests/MultipopulationTests.java1
-rw-r--r--org.eclipse.stem.ui.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/presentation/MultiPopulationDiseaseModelPropertyEditor.java120
-rw-r--r--org.eclipse.stem.ui.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/presentation/multipopulationdiseasemessages.properties16
-rw-r--r--org.eclipse.stem.ui/src/org/eclipse/stem/ui/editors/GenericPropertyEditor.java5
21 files changed, 1841 insertions, 9 deletions
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/META-INF/MANIFEST.MF b/org.eclipse.stem.diseasemodels.multipopulation/META-INF/MANIFEST.MF
index 7616ccdf8..ab240551c 100644
--- a/org.eclipse.stem.diseasemodels.multipopulation/META-INF/MANIFEST.MF
+++ b/org.eclipse.stem.diseasemodels.multipopulation/META-INF/MANIFEST.MF
@@ -36,6 +36,7 @@ Require-Bundle: org.eclipse.core.runtime;visibility:=reexport,
org.eclipse.stem.diseasemodels;visibility:=reexport,
org.eclipse.stem.core;visibility:=reexport,
org.eclipse.stem.definitions,
- org.eclipse.stem.populationmodels;visibility:=reexport
+ org.eclipse.stem.populationmodels;visibility:=reexport,
+ org.apache.commons.math;bundle-version="2.1.0"
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.stem.diseasemodels.multipopulation.Activator
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/model/multipopulation.ecore b/org.eclipse.stem.diseasemodels.multipopulation/model/multipopulation.ecore
index 984d189e9..a434fd437 100644
--- a/org.eclipse.stem.diseasemodels.multipopulation/model/multipopulation.ecore
+++ b/org.eclipse.stem.diseasemodels.multipopulation/model/multipopulation.ecore
@@ -30,4 +30,15 @@
eType="ecore:EClass ../../org.eclipse.stem.core/model/common.ecore#//DoubleValueList"
containment="true"/>
</eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="MultiPopulationSeasonalDiseaseModel"
+ eSuperTypes="#//MultiPopulationSEIRDiseaseModel">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="modulationPoints" lowerBound="1"
+ eType="ecore:EClass ../../org.eclipse.stem.core/model/common.ecore#//DoubleValueMatrix"
+ containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="interpolationType" eType="#//InterpolationType"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="InterpolationType">
+ <eLiterals name="LINEAR_INTERPOLATION" value="1"/>
+ <eLiterals name="SPLINE_INTERPOLATION" value="2"/>
+ </eClassifiers>
</ecore:EPackage>
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/model/multipopulation.genmodel b/org.eclipse.stem.diseasemodels.multipopulation/model/multipopulation.genmodel
index d1fcd80f3..c0fb5aa00 100644
--- a/org.eclipse.stem.diseasemodels.multipopulation/model/multipopulation.genmodel
+++ b/org.eclipse.stem.diseasemodels.multipopulation/model/multipopulation.genmodel
@@ -22,5 +22,8 @@
<genClasses ecoreClass="multipopulation.ecore#//MultiPopulationSEIRDiseaseModel">
<genFeatures children="true" createChild="true" ecoreFeature="ecore:EReference multipopulation.ecore#//MultiPopulationSEIRDiseaseModel/incubationRate"/>
</genClasses>
+ <genClasses ecoreClass="multipopulation.ecore#//MultiPopulationSeasonalDiseaseModel">
+ <genFeatures children="true" createChild="true" ecoreFeature="ecore:EReference multipopulation.ecore#//MultiPopulationSeasonalDiseaseModel/modulationPoints"/>
+ </genClasses>
</genPackages>
</genmodel:GenModel>
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/plugin.properties b/org.eclipse.stem.diseasemodels.multipopulation/plugin.properties
index b6ec30bd9..2c2c9fef8 100644
--- a/org.eclipse.stem.diseasemodels.multipopulation/plugin.properties
+++ b/org.eclipse.stem.diseasemodels.multipopulation/plugin.properties
@@ -8,6 +8,7 @@ pluginName = Multipopulation Model
providerName = Eclipse.org
dc_creator_edlund = Stefan Edlund
dc_creator_kaufman = James Kaufman
+dc_creator_cthoens = Christian Thoens
dc_identier=STEM playback disease model
dc_publisher = The Eclipse Foundation
dc_license = Eclipse Public License (EPL)
@@ -18,6 +19,8 @@ dc_title_MP_SIR = MultiPopulation SIR Disease Model
dc_descr_MP_SIR = A multi-population SIR disease model
dc_title_MP_SEIR = MultiPopulation SEIR Disease Model
dc_descr_MP_SEIR = A multi-population SEIR disease model
+dc_title_MP_SEASONAL = MultiPopulation Seasonal Disease Model
+dc_descr_MP_SEASONAL = A multi-population seasonal disease model
_UI_CreateChild_text = {0}
_UI_CreateChild_text2 = {1} {0}
@@ -74,3 +77,16 @@ _UI_MultiPopulationSEIRDiseaseModel_type = Multi Population SEIR Disease Model
_UI_MultiPopulationSIRDiseaseModel_immunityLossRate_feature = Immunity Loss Rate
_UI_MultiPopulationSEIRDiseaseModel_incubationRate_feature = Incubation Rate
_UI_MultiPopulationSIDiseaseModel_characteristicMixingDistance_feature = Characteristic Mixing Distance
+_UI_MultiPopulationSeasonalDiseaseModel_type = Multi Population Seasonal Disease Model
+_UI_PolynomialSplineFunction_type = Polynomial Spline Function
+_UI_Spline_type = Spline
+_UI_MultiPopulationSeasonalDiseaseModel_spline_feature = Spline
+_UI_Point_type = Point
+_UI_MultiPopulationSeasonalDiseaseModel_points_feature = Points
+_UI_Point_x_feature = X
+_UI_Point_y_feature = Y
+_UI_MultiPopulationSeasonalDiseaseModel_modulationPoints_feature = Modulation Points
+_UI_MultiPopulationSeasonalDiseaseModel_numberOfModulationPoints_feature = Number Of Modulation Points
+_UI_MultiPopulationSeasonalDiseaseModel_interpolationType_feature = Interpolation Type
+_UI_InterpolationType_LINEAR_INTERPOLATION_literal = LINEAR_INTERPOLATION
+_UI_InterpolationType_SPLINE_INTERPOLATION_literal = SPLINE_INTERPOLATION
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/plugin.xml b/org.eclipse.stem.diseasemodels.multipopulation/plugin.xml
index 2b22cfedf..adafdca15 100644
--- a/org.eclipse.stem.diseasemodels.multipopulation/plugin.xml
+++ b/org.eclipse.stem.diseasemodels.multipopulation/plugin.xml
@@ -71,5 +71,21 @@
title="%dc_title_MP_SEIR">
</dublin_core>
</extension>
+ <extension
+ point="org.eclipse.stem.diseasemodels.diseasemodel">
+ <classdef
+ class="org.eclipse.stem.diseasemodels.multipopulation.impl.MultiPopulationSeasonalDiseaseModelImpl">
+ </classdef>
+ <dublin_core
+ category_id="/"
+ creator="%dc_creator_cthoens"
+ description="%dc_descr_MP_SEASONAL"
+ identifier="%dc_identier"
+ license="%dc_license"
+ publisher="%dc_publisher"
+ source="%dc_SOURCE"
+ title="%dc_title_MP_SEASONAL">
+ </dublin_core>
+ </extension>
</plugin>
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/InterpolationType.java b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/InterpolationType.java
new file mode 100644
index 000000000..a84934279
--- /dev/null
+++ b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/InterpolationType.java
@@ -0,0 +1,212 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.stem.diseasemodels.multipopulation;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Enumerator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the literals of the enumeration '<em><b>Interpolation Type</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.diseasemodels.multipopulation.MultipopulationPackage#getInterpolationType()
+ * @model
+ * @generated
+ */
+public enum InterpolationType implements Enumerator {
+ /**
+ * The '<em><b>LINEAR INTERPOLATION</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #LINEAR_INTERPOLATION_VALUE
+ * @generated
+ * @ordered
+ */
+ LINEAR_INTERPOLATION(1, "LINEAR_INTERPOLATION", "LINEAR_INTERPOLATION"),
+
+ /**
+ * The '<em><b>SPLINE INTERPOLATION</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #SPLINE_INTERPOLATION_VALUE
+ * @generated
+ * @ordered
+ */
+ SPLINE_INTERPOLATION(2, "SPLINE_INTERPOLATION", "SPLINE_INTERPOLATION");
+
+ /**
+ * The '<em><b>LINEAR INTERPOLATION</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>LINEAR INTERPOLATION</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #LINEAR_INTERPOLATION
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int LINEAR_INTERPOLATION_VALUE = 1;
+
+ /**
+ * The '<em><b>SPLINE INTERPOLATION</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>SPLINE INTERPOLATION</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #SPLINE_INTERPOLATION
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int SPLINE_INTERPOLATION_VALUE = 2;
+
+ /**
+ * An array of all the '<em><b>Interpolation Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final InterpolationType[] VALUES_ARRAY =
+ new InterpolationType[] {
+ LINEAR_INTERPOLATION,
+ SPLINE_INTERPOLATION,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>Interpolation Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<InterpolationType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Interpolation Type</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static InterpolationType get(String literal) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ InterpolationType result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Interpolation Type</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static InterpolationType getByName(String name) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ InterpolationType result = VALUES_ARRAY[i];
+ if (result.getName().equals(name)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Interpolation Type</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static InterpolationType get(int value) {
+ switch (value) {
+ case LINEAR_INTERPOLATION_VALUE: return LINEAR_INTERPOLATION;
+ case SPLINE_INTERPOLATION_VALUE: return SPLINE_INTERPOLATION;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private InterpolationType(int value, String name, String literal) {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return literal;
+ }
+
+} //InterpolationType
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/MultiPopulationSeasonalDiseaseModel.java b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/MultiPopulationSeasonalDiseaseModel.java
new file mode 100644
index 000000000..e439c9405
--- /dev/null
+++ b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/MultiPopulationSeasonalDiseaseModel.java
@@ -0,0 +1,84 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.stem.diseasemodels.multipopulation;
+
+import org.eclipse.stem.core.common.DoubleValueMatrix;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Multi Population Seasonal Disease Model</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel#getModulationPoints <em>Modulation Points</em>}</li>
+ * <li>{@link org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel#getInterpolationType <em>Interpolation Type</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.stem.diseasemodels.multipopulation.MultipopulationPackage#getMultiPopulationSeasonalDiseaseModel()
+ * @model
+ * @generated
+ */
+public interface MultiPopulationSeasonalDiseaseModel extends MultiPopulationSEIRDiseaseModel {
+ /**
+ * Returns the value of the '<em><b>Modulation Points</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Modulation Points</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Modulation Points</em>' containment reference.
+ * @see #setModulationPoints(DoubleValueMatrix)
+ * @see org.eclipse.stem.diseasemodels.multipopulation.MultipopulationPackage#getMultiPopulationSeasonalDiseaseModel_ModulationPoints()
+ * @model containment="true" required="true"
+ * @generated
+ */
+ DoubleValueMatrix getModulationPoints();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel#getModulationPoints <em>Modulation Points</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Modulation Points</em>' containment reference.
+ * @see #getModulationPoints()
+ * @generated
+ */
+ void setModulationPoints(DoubleValueMatrix value);
+
+ /**
+ * Returns the value of the '<em><b>Interpolation Type</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.stem.diseasemodels.multipopulation.InterpolationType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Interpolation Type</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Interpolation Type</em>' attribute.
+ * @see org.eclipse.stem.diseasemodels.multipopulation.InterpolationType
+ * @see #setInterpolationType(InterpolationType)
+ * @see org.eclipse.stem.diseasemodels.multipopulation.MultipopulationPackage#getMultiPopulationSeasonalDiseaseModel_InterpolationType()
+ * @model
+ * @generated
+ */
+ InterpolationType getInterpolationType();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel#getInterpolationType <em>Interpolation Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Interpolation Type</em>' attribute.
+ * @see org.eclipse.stem.diseasemodels.multipopulation.InterpolationType
+ * @see #getInterpolationType()
+ * @generated
+ */
+ void setInterpolationType(InterpolationType value);
+
+} // MultiPopulationSeasonalDiseaseModel
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/MultipopulationFactory.java b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/MultipopulationFactory.java
index 35a8a18d1..41ae2222b 100644
--- a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/MultipopulationFactory.java
+++ b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/MultipopulationFactory.java
@@ -11,6 +11,7 @@ package org.eclipse.stem.diseasemodels.multipopulation;
* IBM Corporation - initial API and implementation
*******************************************************************************/
+import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;
import org.eclipse.emf.ecore.EFactory;
/**
@@ -58,6 +59,15 @@ public interface MultipopulationFactory extends EFactory {
MultiPopulationSEIRDiseaseModel createMultiPopulationSEIRDiseaseModel();
/**
+ * Returns a new object of class '<em>Multi Population Seasonal Disease Model</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Multi Population Seasonal Disease Model</em>'.
+ * @generated
+ */
+ MultiPopulationSeasonalDiseaseModel createMultiPopulationSeasonalDiseaseModel();
+
+ /**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/MultipopulationPackage.java b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/MultipopulationPackage.java
index 6c0dc5512..b31ce8bec 100644
--- a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/MultipopulationPackage.java
+++ b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/MultipopulationPackage.java
@@ -13,6 +13,7 @@ package org.eclipse.stem.diseasemodels.multipopulation;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.stem.diseasemodels.standard.StandardPackage;
@@ -719,6 +720,262 @@ public interface MultipopulationPackage extends EPackage {
/**
+ * The meta object id for the '{@link org.eclipse.stem.diseasemodels.multipopulation.impl.MultiPopulationSeasonalDiseaseModelImpl <em>Multi Population Seasonal Disease Model</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.diseasemodels.multipopulation.impl.MultiPopulationSeasonalDiseaseModelImpl
+ * @see org.eclipse.stem.diseasemodels.multipopulation.impl.MultipopulationPackageImpl#getMultiPopulationSeasonalDiseaseModel()
+ * @generated
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL = 3;
+
+ /**
+ * The feature id for the '<em><b>URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__URI = MULTI_POPULATION_SEIR_DISEASE_MODEL__URI;
+
+ /**
+ * The feature id for the '<em><b>Type URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__TYPE_URI = MULTI_POPULATION_SEIR_DISEASE_MODEL__TYPE_URI;
+
+ /**
+ * The feature id for the '<em><b>Dublin Core</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__DUBLIN_CORE = MULTI_POPULATION_SEIR_DISEASE_MODEL__DUBLIN_CORE;
+
+ /**
+ * The feature id for the '<em><b>Labels To Update</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__LABELS_TO_UPDATE = MULTI_POPULATION_SEIR_DISEASE_MODEL__LABELS_TO_UPDATE;
+
+ /**
+ * The feature id for the '<em><b>Graph</b></em>' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__GRAPH = MULTI_POPULATION_SEIR_DISEASE_MODEL__GRAPH;
+
+ /**
+ * The feature id for the '<em><b>Enabled</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__ENABLED = MULTI_POPULATION_SEIR_DISEASE_MODEL__ENABLED;
+
+ /**
+ * The feature id for the '<em><b>Graph Decorated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__GRAPH_DECORATED = MULTI_POPULATION_SEIR_DISEASE_MODEL__GRAPH_DECORATED;
+
+ /**
+ * The feature id for the '<em><b>Progress</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__PROGRESS = MULTI_POPULATION_SEIR_DISEASE_MODEL__PROGRESS;
+
+ /**
+ * The feature id for the '<em><b>Population Identifier</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__POPULATION_IDENTIFIER = MULTI_POPULATION_SEIR_DISEASE_MODEL__POPULATION_IDENTIFIER;
+
+ /**
+ * The feature id for the '<em><b>Time Period</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__TIME_PERIOD = MULTI_POPULATION_SEIR_DISEASE_MODEL__TIME_PERIOD;
+
+ /**
+ * The feature id for the '<em><b>Disease Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__DISEASE_NAME = MULTI_POPULATION_SEIR_DISEASE_MODEL__DISEASE_NAME;
+
+ /**
+ * The feature id for the '<em><b>Finite Difference</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__FINITE_DIFFERENCE = MULTI_POPULATION_SEIR_DISEASE_MODEL__FINITE_DIFFERENCE;
+
+ /**
+ * The feature id for the '<em><b>Frequency Dependent</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__FREQUENCY_DEPENDENT = MULTI_POPULATION_SEIR_DISEASE_MODEL__FREQUENCY_DEPENDENT;
+
+ /**
+ * The feature id for the '<em><b>Reference Population Density</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__REFERENCE_POPULATION_DENSITY = MULTI_POPULATION_SEIR_DISEASE_MODEL__REFERENCE_POPULATION_DENSITY;
+
+ /**
+ * The feature id for the '<em><b>Road Network Infectious Proportion</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__ROAD_NETWORK_INFECTIOUS_PROPORTION = MULTI_POPULATION_SEIR_DISEASE_MODEL__ROAD_NETWORK_INFECTIOUS_PROPORTION;
+
+ /**
+ * The feature id for the '<em><b>Characteristic Mixing Distance</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__CHARACTERISTIC_MIXING_DISTANCE = MULTI_POPULATION_SEIR_DISEASE_MODEL__CHARACTERISTIC_MIXING_DISTANCE;
+
+ /**
+ * The feature id for the '<em><b>Population Groups</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__POPULATION_GROUPS = MULTI_POPULATION_SEIR_DISEASE_MODEL__POPULATION_GROUPS;
+
+ /**
+ * The feature id for the '<em><b>Transmission Rate</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__TRANSMISSION_RATE = MULTI_POPULATION_SEIR_DISEASE_MODEL__TRANSMISSION_RATE;
+
+ /**
+ * The feature id for the '<em><b>Recovery Rate</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__RECOVERY_RATE = MULTI_POPULATION_SEIR_DISEASE_MODEL__RECOVERY_RATE;
+
+ /**
+ * The feature id for the '<em><b>Infectious Mortality Rate</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__INFECTIOUS_MORTALITY_RATE = MULTI_POPULATION_SEIR_DISEASE_MODEL__INFECTIOUS_MORTALITY_RATE;
+
+ /**
+ * The feature id for the '<em><b>Physically Adjacent Infectious Proportion</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__PHYSICALLY_ADJACENT_INFECTIOUS_PROPORTION = MULTI_POPULATION_SEIR_DISEASE_MODEL__PHYSICALLY_ADJACENT_INFECTIOUS_PROPORTION;
+
+ /**
+ * The feature id for the '<em><b>Immunity Loss Rate</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__IMMUNITY_LOSS_RATE = MULTI_POPULATION_SEIR_DISEASE_MODEL__IMMUNITY_LOSS_RATE;
+
+ /**
+ * The feature id for the '<em><b>Incubation Rate</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__INCUBATION_RATE = MULTI_POPULATION_SEIR_DISEASE_MODEL__INCUBATION_RATE;
+
+ /**
+ * The feature id for the '<em><b>Modulation Points</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS = MULTI_POPULATION_SEIR_DISEASE_MODEL_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Interpolation Type</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL__INTERPOLATION_TYPE = MULTI_POPULATION_SEIR_DISEASE_MODEL_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Multi Population Seasonal Disease Model</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MULTI_POPULATION_SEASONAL_DISEASE_MODEL_FEATURE_COUNT = MULTI_POPULATION_SEIR_DISEASE_MODEL_FEATURE_COUNT + 2;
+
+
+ /**
+ * The meta object id for the '{@link org.eclipse.stem.diseasemodels.multipopulation.InterpolationType <em>Interpolation Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.diseasemodels.multipopulation.InterpolationType
+ * @see org.eclipse.stem.diseasemodels.multipopulation.impl.MultipopulationPackageImpl#getInterpolationType()
+ * @generated
+ */
+ int INTERPOLATION_TYPE = 4;
+
+
+ /**
* Returns the meta object for class '{@link org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSIDiseaseModel <em>Multi Population SI Disease Model</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -815,6 +1072,48 @@ public interface MultipopulationPackage extends EPackage {
EReference getMultiPopulationSEIRDiseaseModel_IncubationRate();
/**
+ * Returns the meta object for class '{@link org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel <em>Multi Population Seasonal Disease Model</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Multi Population Seasonal Disease Model</em>'.
+ * @see org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel
+ * @generated
+ */
+ EClass getMultiPopulationSeasonalDiseaseModel();
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel#getModulationPoints <em>Modulation Points</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Modulation Points</em>'.
+ * @see org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel#getModulationPoints()
+ * @see #getMultiPopulationSeasonalDiseaseModel()
+ * @generated
+ */
+ EReference getMultiPopulationSeasonalDiseaseModel_ModulationPoints();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel#getInterpolationType <em>Interpolation Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Interpolation Type</em>'.
+ * @see org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel#getInterpolationType()
+ * @see #getMultiPopulationSeasonalDiseaseModel()
+ * @generated
+ */
+ EAttribute getMultiPopulationSeasonalDiseaseModel_InterpolationType();
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.stem.diseasemodels.multipopulation.InterpolationType <em>Interpolation Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Interpolation Type</em>'.
+ * @see org.eclipse.stem.diseasemodels.multipopulation.InterpolationType
+ * @generated
+ */
+ EEnum getInterpolationType();
+
+ /**
* Returns the meta object for the containment reference '{@link org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSIDiseaseModel#getPopulationGroups <em>Population Groups</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -917,6 +1216,38 @@ public interface MultipopulationPackage extends EPackage {
*/
EReference MULTI_POPULATION_SEIR_DISEASE_MODEL__INCUBATION_RATE = eINSTANCE.getMultiPopulationSEIRDiseaseModel_IncubationRate();
/**
+ * The meta object literal for the '{@link org.eclipse.stem.diseasemodels.multipopulation.impl.MultiPopulationSeasonalDiseaseModelImpl <em>Multi Population Seasonal Disease Model</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.diseasemodels.multipopulation.impl.MultiPopulationSeasonalDiseaseModelImpl
+ * @see org.eclipse.stem.diseasemodels.multipopulation.impl.MultipopulationPackageImpl#getMultiPopulationSeasonalDiseaseModel()
+ * @generated
+ */
+ EClass MULTI_POPULATION_SEASONAL_DISEASE_MODEL = eINSTANCE.getMultiPopulationSeasonalDiseaseModel();
+ /**
+ * The meta object literal for the '<em><b>Modulation Points</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS = eINSTANCE.getMultiPopulationSeasonalDiseaseModel_ModulationPoints();
+ /**
+ * The meta object literal for the '<em><b>Interpolation Type</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute MULTI_POPULATION_SEASONAL_DISEASE_MODEL__INTERPOLATION_TYPE = eINSTANCE.getMultiPopulationSeasonalDiseaseModel_InterpolationType();
+ /**
+ * The meta object literal for the '{@link org.eclipse.stem.diseasemodels.multipopulation.InterpolationType <em>Interpolation Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.diseasemodels.multipopulation.InterpolationType
+ * @see org.eclipse.stem.diseasemodels.multipopulation.impl.MultipopulationPackageImpl#getInterpolationType()
+ * @generated
+ */
+ EEnum INTERPOLATION_TYPE = eINSTANCE.getInterpolationType();
+ /**
* The meta object literal for the '<em><b>Population Groups</b></em>' containment reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/impl/MultiPopulationSeasonalDiseaseModelImpl.java b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/impl/MultiPopulationSeasonalDiseaseModelImpl.java
new file mode 100644
index 000000000..f2e09f1b2
--- /dev/null
+++ b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/impl/MultiPopulationSeasonalDiseaseModelImpl.java
@@ -0,0 +1,482 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.stem.diseasemodels.multipopulation.impl;
+
+import java.util.Date;
+
+import org.apache.commons.math.ArgumentOutsideDomainException;
+import org.apache.commons.math.analysis.interpolation.SplineInterpolator;
+import org.apache.commons.math.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;
+import org.apache.commons.math.util.MathUtils;
+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.stem.core.common.DoubleValue;
+import org.eclipse.stem.core.common.DoubleValueList;
+import org.eclipse.stem.core.common.DoubleValueMatrix;
+import org.eclipse.stem.core.common.StringValue;
+import org.eclipse.stem.core.graph.Node;
+import org.eclipse.stem.core.graph.NodeLabel;
+import org.eclipse.stem.core.model.STEMTime;
+import org.eclipse.stem.diseasemodels.multipopulation.InterpolationType;
+import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel;
+import org.eclipse.stem.diseasemodels.multipopulation.MultipopulationPackage;
+import org.eclipse.stem.diseasemodels.standard.DiseaseModelLabelValue;
+import org.eclipse.stem.diseasemodels.standard.SEIRLabel;
+import org.eclipse.stem.diseasemodels.standard.SEIRLabelValue;
+import org.eclipse.stem.diseasemodels.standard.StandardDiseaseModelLabel;
+import org.eclipse.stem.diseasemodels.standard.StandardDiseaseModelLabelValue;
+import org.eclipse.stem.diseasemodels.standard.impl.SEIRLabelValueImpl;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '
+ * <em><b>Multi Population Seasonal Disease Model</b></em>'. <!-- end-user-doc
+ * -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>
+ * {@link org.eclipse.stem.diseasemodels.multipopulation.impl.MultiPopulationSeasonalDiseaseModelImpl#getModulationPoints
+ * <em>Modulation Points</em>}</li>
+ * <li>
+ * {@link org.eclipse.stem.diseasemodels.multipopulation.impl.MultiPopulationSeasonalDiseaseModelImpl#getInterpolationType
+ * <em>Interpolation Type</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class MultiPopulationSeasonalDiseaseModelImpl extends
+ MultiPopulationSEIRDiseaseModelImpl implements
+ MultiPopulationSeasonalDiseaseModel {
+ /**
+ * The cached value of the '{@link #getModulationPoints()
+ * <em>Modulation Points</em>}' containment reference. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @see #getModulationPoints()
+ * @generated
+ * @ordered
+ */
+ protected DoubleValueMatrix modulationPoints;
+
+ /**
+ * The default value of the '{@link #getInterpolationType()
+ * <em>Interpolation Type</em>}' attribute. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @see #getInterpolationType()
+ * @generated
+ * @ordered
+ */
+ protected static final InterpolationType INTERPOLATION_TYPE_EDEFAULT = InterpolationType.LINEAR_INTERPOLATION;
+
+ /**
+ * The cached value of the '{@link #getInterpolationType()
+ * <em>Interpolation Type</em>}' attribute. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @see #getInterpolationType()
+ * @generated
+ * @ordered
+ */
+ protected InterpolationType interpolationType = INTERPOLATION_TYPE_EDEFAULT;
+
+ private PolynomialSplineFunction splineFunction;
+
+ private PolynomialSplineFunction linearFunction;
+
+ private double[] x;
+
+ private double[] y;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public MultiPopulationSeasonalDiseaseModelImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return MultipopulationPackage.Literals.MULTI_POPULATION_SEASONAL_DISEASE_MODEL;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public DoubleValueMatrix getModulationPoints() {
+ return modulationPoints;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public NotificationChain basicSetModulationPoints(
+ DoubleValueMatrix newModulationPoints, NotificationChain msgs) {
+ DoubleValueMatrix oldModulationPoints = modulationPoints;
+ modulationPoints = newModulationPoints;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(
+ this,
+ Notification.SET,
+ MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS,
+ oldModulationPoints, newModulationPoints);
+ if (msgs == null)
+ msgs = notification;
+ else
+ msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setModulationPoints(DoubleValueMatrix newModulationPoints) {
+ if (newModulationPoints != modulationPoints) {
+ NotificationChain msgs = null;
+ if (modulationPoints != null)
+ msgs = ((InternalEObject) modulationPoints)
+ .eInverseRemove(
+ this,
+ EOPPOSITE_FEATURE_BASE
+ - MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS,
+ null, msgs);
+ if (newModulationPoints != null)
+ msgs = ((InternalEObject) newModulationPoints)
+ .eInverseAdd(
+ this,
+ EOPPOSITE_FEATURE_BASE
+ - MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS,
+ null, msgs);
+ msgs = basicSetModulationPoints(newModulationPoints, msgs);
+ if (msgs != null)
+ msgs.dispatch();
+ } else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(
+ this,
+ Notification.SET,
+ MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS,
+ newModulationPoints, newModulationPoints));
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public InterpolationType getInterpolationType() {
+ return interpolationType;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setInterpolationType(InterpolationType newInterpolationType) {
+ InterpolationType oldInterpolationType = interpolationType;
+ interpolationType = newInterpolationType == null ? INTERPOLATION_TYPE_EDEFAULT
+ : newInterpolationType;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(
+ this,
+ Notification.SET,
+ MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__INTERPOLATION_TYPE,
+ oldInterpolationType, interpolationType));
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd,
+ int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS:
+ return basicSetModulationPoints(null, 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 MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS:
+ return getModulationPoints();
+ case MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__INTERPOLATION_TYPE:
+ return getInterpolationType();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS:
+ setModulationPoints((DoubleValueMatrix) newValue);
+ return;
+ case MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__INTERPOLATION_TYPE:
+ setInterpolationType((InterpolationType) newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS:
+ setModulationPoints((DoubleValueMatrix) null);
+ return;
+ case MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__INTERPOLATION_TYPE:
+ setInterpolationType(INTERPOLATION_TYPE_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS:
+ return modulationPoints != null;
+ case MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__INTERPOLATION_TYPE:
+ return interpolationType != INTERPOLATION_TYPE_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(" (interpolationType: ");
+ result.append(interpolationType);
+ result.append(')');
+ return result.toString();
+ }
+
+ @Override
+ public StandardDiseaseModelLabelValue computeDiseaseDeltas(STEMTime time,
+ StandardDiseaseModelLabelValue currentState,
+ StandardDiseaseModelLabel diseaseLabel, long timeDelta,
+ DiseaseModelLabelValue returnValue) {
+ final SEIRLabelValue currentSEIR = (SEIRLabelValue) currentState;
+ String thisPopulation = diseaseLabel.getPopulationModelLabel()
+ .getPopulationIdentifier();
+ int populationIndex = this.getPopulationIndex(thisPopulation);
+
+ // Compute modulation. Maximum Day of the Year is 365, otherwise
+ // interpolation function may not be continuous at transition to next
+ // year.
+ double transmissionModulation = 0.0;
+ double dayOfTheYear = Math.min(getDayOfTheYear(time), 365.0);
+ computeInterpolationFunctions();
+
+ if (getInterpolationType() == InterpolationType.LINEAR_INTERPOLATION) {
+ try {
+ transmissionModulation = Math.max(
+ linearFunction.value(dayOfTheYear), 0.0);
+ } catch (ArgumentOutsideDomainException e) {
+ e.printStackTrace();
+ }
+ } else if (getInterpolationType() == InterpolationType.SPLINE_INTERPOLATION) {
+ try {
+ transmissionModulation = Math.max(
+ splineFunction.value(dayOfTheYear), 0.0);
+ } catch (ArgumentOutsideDomainException e) {
+ e.printStackTrace();
+ }
+ }
+
+ EList<DoubleValue> transmissionVector = getTransmissionRate()
+ .getValueLists().get(populationIndex).getValues();
+ double thisRecoveryRate = getRecoveryRate().getValues()
+ .get(populationIndex).getValue();
+ double thisImmunityLossRate = getImmunityLossRate().getValues()
+ .get(populationIndex).getValue();
+ double thisIncubationRate = getIncubationRate().getValues()
+ .get(populationIndex).getValue();
+
+ // iterate over every population (including this one) to compute new
+ // infections
+ double numberOfSusceptibleToExposed = 0.0;
+ double numberSusceptible = currentSEIR.getS();
+ Node thisNode = diseaseLabel.getNode();
+ EList<StringValue> groupList = getPopulationGroups().getValues();
+
+ for (int i = 0; i < transmissionVector.size(); i++) {
+ double specificTransmission = transmissionVector.get(i).getValue();
+ double adjustedTransmission = getAdjustedTransmissionRate(
+ specificTransmission, timeDelta) * transmissionModulation;
+ if (!this.isFrequencyDependent())
+ adjustedTransmission *= getTransmissionRateScaleFactor(diseaseLabel);
+
+ // we need to get the disease label for the other population
+ // to get the on site number of infectious individuals
+ String nextPop = groupList.get(i).getValue();
+
+ for (NodeLabel label : thisNode.getLabels()) {
+ if (label instanceof SEIRLabel
+ && ((SEIRLabel) label).getDecorator() == this) {
+ SEIRLabel otherDiseaseLabel = (SEIRLabel) label;
+ String otherPopulation = otherDiseaseLabel.getIdentifier();
+
+ if (otherPopulation.equals(nextPop)) {
+ double onsiteInfectious = ((SEIRLabelValue) otherDiseaseLabel
+ .getTempValue()).getI();
+ final double effectiveInfectious = getNormalizedEffectiveInfectious(
+ otherPopulation, thisNode, otherDiseaseLabel,
+ onsiteInfectious);
+
+ // add to the new incidence
+ numberOfSusceptibleToExposed += adjustedTransmission
+ * numberSusceptible * effectiveInfectious;
+ }
+ }
+ }
+ }
+
+ double numberOfInfectedToRecovered = getAdjustedRecoveryRate(
+ thisRecoveryRate, timeDelta) * currentSEIR.getI();
+ double numberOfRecoveredToSusceptible = getAdjustedImmunityLossRate(
+ thisImmunityLossRate, timeDelta) * currentSEIR.getR();
+ double numberOfExposedToInfected = getAdjustedIncubationRate(
+ thisIncubationRate, timeDelta) * currentSEIR.getE();
+
+ final double deltaS = -numberOfSusceptibleToExposed
+ + numberOfRecoveredToSusceptible;
+ final double deltaE = numberOfSusceptibleToExposed
+ - numberOfExposedToInfected;
+ final double deltaI = numberOfExposedToInfected
+ - numberOfInfectedToRecovered;
+ final double deltaR = numberOfInfectedToRecovered
+ - numberOfRecoveredToSusceptible;
+
+ SEIRLabelValueImpl ret = (SEIRLabelValueImpl) returnValue;
+ ret.setS(deltaS);
+ ret.setE(deltaE);
+ ret.setI(deltaI);
+ ret.setR(deltaR);
+ ret.setIncidence(numberOfSusceptibleToExposed);
+ ret.setDiseaseDeaths(0.0);
+
+ return ret;
+ }
+
+ private void computeInterpolationFunctions() {
+ boolean pointsChanged = false;
+ EList<DoubleValueList> points = modulationPoints.getValueLists();
+ int n = points.size() + 2;
+
+ if (x == null || x.length != n) {
+ x = new double[n];
+ y = new double[n];
+ pointsChanged = true;
+ }
+
+ int index = 1;
+
+ for (DoubleValueList point : points) {
+ double nx = point.getValues().get(0).getValue();
+ double ny = point.getValues().get(1).getValue();
+
+ if (x[index] != nx || y[index] != ny) {
+ x[index] = nx;
+ y[index] = ny;
+ pointsChanged = true;
+ }
+
+ index++;
+ }
+
+ // The value at 0.0 and 365.0 should be the same
+ // So the transition between years is continuous
+ x[0] = x[n - 2] - 365.0;
+ y[0] = y[n - 2];
+ x[n - 1] = 365.0 + x[1];
+ y[n - 1] = y[1];
+
+ if (pointsChanged) {
+ // Spline Interpolation
+ SplineInterpolator interpolator = new SplineInterpolator();
+
+ splineFunction = interpolator.interpolate(x, y);
+
+ // Linear Interpolation
+ PolynomialFunction polynomials[] = new PolynomialFunction[n - 1];
+
+ for (int i = 0; i < n - 1; i++) {
+ final double coefficients[] = new double[2];
+
+ coefficients[0] = y[i];
+ coefficients[1] = (y[i + 1] - y[i]) / (x[i + 1] - x[i]);
+ polynomials[i] = new PolynomialFunction(coefficients);
+ }
+
+ linearFunction = new PolynomialSplineFunction(x, polynomials);
+ }
+ }
+
+ private double getDayOfTheYear(STEMTime time) {
+ Date date = time.getTime();
+ Date firstJanuary = new Date(date.getYear(), 0, 1);
+ double millisecondOfTheYear = date.getTime() - firstJanuary.getTime();
+ double dayOfTheYear = millisecondOfTheYear / (24 * 60 * 60 * 1000);
+
+ return dayOfTheYear;
+ }
+
+} // MultiPopulationSeasonalDiseaseModelImpl
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/impl/MultipopulationFactoryImpl.java b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/impl/MultipopulationFactoryImpl.java
index 37fda0759..7b5e784da 100644
--- a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/impl/MultipopulationFactoryImpl.java
+++ b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/impl/MultipopulationFactoryImpl.java
@@ -10,11 +10,14 @@ package org.eclipse.stem.diseasemodels.multipopulation.impl;
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
+import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.stem.diseasemodels.multipopulation.*;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSEIRDiseaseModel;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSIDiseaseModel;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSIRDiseaseModel;
@@ -68,6 +71,7 @@ public class MultipopulationFactoryImpl extends EFactoryImpl implements Multipop
case MultipopulationPackage.MULTI_POPULATION_SI_DISEASE_MODEL: return createMultiPopulationSIDiseaseModel();
case MultipopulationPackage.MULTI_POPULATION_SIR_DISEASE_MODEL: return createMultiPopulationSIRDiseaseModel();
case MultipopulationPackage.MULTI_POPULATION_SEIR_DISEASE_MODEL: return createMultiPopulationSEIRDiseaseModel();
+ case MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL: return createMultiPopulationSeasonalDiseaseModel();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
@@ -78,6 +82,36 @@ public class MultipopulationFactoryImpl extends EFactoryImpl implements Multipop
* <!-- end-user-doc -->
* @generated
*/
+ @Override
+ public Object createFromString(EDataType eDataType, String initialValue) {
+ switch (eDataType.getClassifierID()) {
+ case MultipopulationPackage.INTERPOLATION_TYPE:
+ return createInterpolationTypeFromString(eDataType, initialValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String convertToString(EDataType eDataType, Object instanceValue) {
+ switch (eDataType.getClassifierID()) {
+ case MultipopulationPackage.INTERPOLATION_TYPE:
+ return convertInterpolationTypeToString(eDataType, instanceValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public MultiPopulationSIDiseaseModel createMultiPopulationSIDiseaseModel() {
MultiPopulationSIDiseaseModelImpl multiPopulationSIDiseaseModel = new MultiPopulationSIDiseaseModelImpl();
return multiPopulationSIDiseaseModel;
@@ -108,6 +142,36 @@ public class MultipopulationFactoryImpl extends EFactoryImpl implements Multipop
* <!-- end-user-doc -->
* @generated
*/
+ public MultiPopulationSeasonalDiseaseModel createMultiPopulationSeasonalDiseaseModel() {
+ MultiPopulationSeasonalDiseaseModelImpl multiPopulationSeasonalDiseaseModel = new MultiPopulationSeasonalDiseaseModelImpl();
+ return multiPopulationSeasonalDiseaseModel;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public InterpolationType createInterpolationTypeFromString(EDataType eDataType, String initialValue) {
+ InterpolationType result = InterpolationType.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertInterpolationTypeToString(EDataType eDataType, Object instanceValue) {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public MultipopulationPackage getMultipopulationPackage() {
return (MultipopulationPackage)getEPackage();
}
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/impl/MultipopulationPackageImpl.java b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/impl/MultipopulationPackageImpl.java
index 68a53a01c..1a375dce2 100644
--- a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/impl/MultipopulationPackageImpl.java
+++ b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/impl/MultipopulationPackageImpl.java
@@ -12,14 +12,17 @@ package org.eclipse.stem.diseasemodels.multipopulation.impl;
*******************************************************************************/
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.impl.EPackageImpl;
import org.eclipse.stem.core.common.CommonPackage;
+import org.eclipse.stem.diseasemodels.multipopulation.InterpolationType;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSEIRDiseaseModel;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSIDiseaseModel;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSIRDiseaseModel;
+import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel;
import org.eclipse.stem.diseasemodels.multipopulation.MultipopulationFactory;
import org.eclipse.stem.diseasemodels.multipopulation.MultipopulationPackage;
import org.eclipse.stem.diseasemodels.standard.StandardPackage;
@@ -52,6 +55,20 @@ public class MultipopulationPackageImpl extends EPackageImpl implements Multipop
private EClass multiPopulationSEIRDiseaseModelEClass = null;
/**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass multiPopulationSeasonalDiseaseModelEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum interpolationTypeEEnum = null;
+
+ /**
* Creates an instance of the model <b>Package</b>, registered with
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
* package URI value.
@@ -201,6 +218,42 @@ public class MultipopulationPackageImpl extends EPackageImpl implements Multipop
* <!-- end-user-doc -->
* @generated
*/
+ public EClass getMultiPopulationSeasonalDiseaseModel() {
+ return multiPopulationSeasonalDiseaseModelEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getMultiPopulationSeasonalDiseaseModel_ModulationPoints() {
+ return (EReference)multiPopulationSeasonalDiseaseModelEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getMultiPopulationSeasonalDiseaseModel_InterpolationType() {
+ return (EAttribute)multiPopulationSeasonalDiseaseModelEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EEnum getInterpolationType() {
+ return interpolationTypeEEnum;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EReference getMultiPopulationSIDiseaseModel_PopulationGroups() {
return (EReference)multiPopulationSIDiseaseModelEClass.getEStructuralFeatures().get(0);
}
@@ -245,6 +298,13 @@ public class MultipopulationPackageImpl extends EPackageImpl implements Multipop
multiPopulationSEIRDiseaseModelEClass = createEClass(MULTI_POPULATION_SEIR_DISEASE_MODEL);
createEReference(multiPopulationSEIRDiseaseModelEClass, MULTI_POPULATION_SEIR_DISEASE_MODEL__INCUBATION_RATE);
+
+ multiPopulationSeasonalDiseaseModelEClass = createEClass(MULTI_POPULATION_SEASONAL_DISEASE_MODEL);
+ createEReference(multiPopulationSeasonalDiseaseModelEClass, MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS);
+ createEAttribute(multiPopulationSeasonalDiseaseModelEClass, MULTI_POPULATION_SEASONAL_DISEASE_MODEL__INTERPOLATION_TYPE);
+
+ // Create enums
+ interpolationTypeEEnum = createEEnum(INTERPOLATION_TYPE);
}
/**
@@ -283,6 +343,7 @@ public class MultipopulationPackageImpl extends EPackageImpl implements Multipop
multiPopulationSIDiseaseModelEClass.getESuperTypes().add(theStandardPackage.getStandardDiseaseModel());
multiPopulationSIRDiseaseModelEClass.getESuperTypes().add(this.getMultiPopulationSIDiseaseModel());
multiPopulationSEIRDiseaseModelEClass.getESuperTypes().add(this.getMultiPopulationSIRDiseaseModel());
+ multiPopulationSeasonalDiseaseModelEClass.getESuperTypes().add(this.getMultiPopulationSEIRDiseaseModel());
// Initialize classes and features; add operations and parameters
initEClass(multiPopulationSIDiseaseModelEClass, MultiPopulationSIDiseaseModel.class, "MultiPopulationSIDiseaseModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@@ -298,6 +359,15 @@ public class MultipopulationPackageImpl extends EPackageImpl implements Multipop
initEClass(multiPopulationSEIRDiseaseModelEClass, MultiPopulationSEIRDiseaseModel.class, "MultiPopulationSEIRDiseaseModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getMultiPopulationSEIRDiseaseModel_IncubationRate(), theCommonPackage.getDoubleValueList(), null, "incubationRate", null, 1, 1, MultiPopulationSEIRDiseaseModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEClass(multiPopulationSeasonalDiseaseModelEClass, MultiPopulationSeasonalDiseaseModel.class, "MultiPopulationSeasonalDiseaseModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getMultiPopulationSeasonalDiseaseModel_ModulationPoints(), theCommonPackage.getDoubleValueMatrix(), null, "modulationPoints", null, 1, 1, MultiPopulationSeasonalDiseaseModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getMultiPopulationSeasonalDiseaseModel_InterpolationType(), this.getInterpolationType(), "interpolationType", null, 0, 1, MultiPopulationSeasonalDiseaseModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Initialize enums and add enum literals
+ initEEnum(interpolationTypeEEnum, InterpolationType.class, "InterpolationType");
+ addEEnumLiteral(interpolationTypeEEnum, InterpolationType.LINEAR_INTERPOLATION);
+ addEEnumLiteral(interpolationTypeEEnum, InterpolationType.SPLINE_INTERPOLATION);
+
// Create resource
createResource(eNS_URI);
}
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/provider/MultiPopulationSeasonalDiseaseModelItemProvider.java b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/provider/MultiPopulationSeasonalDiseaseModelItemProvider.java
new file mode 100644
index 000000000..752ffb3ce
--- /dev/null
+++ b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/provider/MultiPopulationSeasonalDiseaseModelItemProvider.java
@@ -0,0 +1,239 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.stem.diseasemodels.multipopulation.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.stem.core.common.CommonFactory;
+
+import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel;
+import org.eclipse.stem.diseasemodels.multipopulation.MultipopulationPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class MultiPopulationSeasonalDiseaseModelItemProvider
+ extends MultiPopulationSEIRDiseaseModelItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public MultiPopulationSeasonalDiseaseModelItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addModulationPointsPropertyDescriptor(object);
+ addInterpolationTypePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Modulation Points feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addModulationPointsPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_MultiPopulationSeasonalDiseaseModel_modulationPoints_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_MultiPopulationSeasonalDiseaseModel_modulationPoints_feature", "_UI_MultiPopulationSeasonalDiseaseModel_type"),
+ MultipopulationPackage.Literals.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS,
+ true,
+ false,
+ false,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Interpolation Type feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addInterpolationTypePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_MultiPopulationSeasonalDiseaseModel_interpolationType_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_MultiPopulationSeasonalDiseaseModel_interpolationType_feature", "_UI_MultiPopulationSeasonalDiseaseModel_type"),
+ MultipopulationPackage.Literals.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__INTERPOLATION_TYPE,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(MultipopulationPackage.Literals.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns MultiPopulationSeasonalDiseaseModel.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/MultiPopulationSeasonalDiseaseModel"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((MultiPopulationSeasonalDiseaseModel)object).getDiseaseName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_MultiPopulationSeasonalDiseaseModel_type") :
+ getString("_UI_MultiPopulationSeasonalDiseaseModel_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(MultiPopulationSeasonalDiseaseModel.class)) {
+ case MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__INTERPOLATION_TYPE:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ case MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (MultipopulationPackage.Literals.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS,
+ CommonFactory.eINSTANCE.createDoubleValueMatrix()));
+ }
+
+ /**
+ * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) {
+ Object childFeature = feature;
+ Object childObject = child;
+
+ boolean qualify =
+ childFeature == MultipopulationPackage.Literals.MULTI_POPULATION_SI_DISEASE_MODEL__TRANSMISSION_RATE ||
+ childFeature == MultipopulationPackage.Literals.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS ||
+ childFeature == MultipopulationPackage.Literals.MULTI_POPULATION_SI_DISEASE_MODEL__RECOVERY_RATE ||
+ childFeature == MultipopulationPackage.Literals.MULTI_POPULATION_SI_DISEASE_MODEL__INFECTIOUS_MORTALITY_RATE ||
+ childFeature == MultipopulationPackage.Literals.MULTI_POPULATION_SIR_DISEASE_MODEL__IMMUNITY_LOSS_RATE ||
+ childFeature == MultipopulationPackage.Literals.MULTI_POPULATION_SEIR_DISEASE_MODEL__INCUBATION_RATE;
+
+ if (qualify) {
+ return getString
+ ("_UI_CreateChild_text2",
+ new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) });
+ }
+ return super.getCreateChildText(owner, feature, child, selection);
+ }
+
+}
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/provider/MultipopulationItemProviderAdapterFactory.java b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/provider/MultipopulationItemProviderAdapterFactory.java
index 9a823f9a8..872a04c9b 100644
--- a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/provider/MultipopulationItemProviderAdapterFactory.java
+++ b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/provider/MultipopulationItemProviderAdapterFactory.java
@@ -148,6 +148,29 @@ public class MultipopulationItemProviderAdapterFactory extends MultipopulationAd
}
/**
+ * This keeps track of the one adapter used for all {@link org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected MultiPopulationSeasonalDiseaseModelItemProvider multiPopulationSeasonalDiseaseModelItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createMultiPopulationSeasonalDiseaseModelAdapter() {
+ if (multiPopulationSeasonalDiseaseModelItemProvider == null) {
+ multiPopulationSeasonalDiseaseModelItemProvider = new MultiPopulationSeasonalDiseaseModelItemProvider(this);
+ }
+
+ return multiPopulationSeasonalDiseaseModelItemProvider;
+ }
+
+ /**
* This returns the root adapter factory that contains this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -249,6 +272,7 @@ public class MultipopulationItemProviderAdapterFactory extends MultipopulationAd
if (multiPopulationSIDiseaseModelItemProvider != null) multiPopulationSIDiseaseModelItemProvider.dispose();
if (multiPopulationSIRDiseaseModelItemProvider != null) multiPopulationSIRDiseaseModelItemProvider.dispose();
if (multiPopulationSEIRDiseaseModelItemProvider != null) multiPopulationSEIRDiseaseModelItemProvider.dispose();
+ if (multiPopulationSeasonalDiseaseModelItemProvider != null) multiPopulationSeasonalDiseaseModelItemProvider.dispose();
}
}
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/util/MultipopulationAdapterFactory.java b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/util/MultipopulationAdapterFactory.java
index 36b293423..dca6669a5 100644
--- a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/util/MultipopulationAdapterFactory.java
+++ b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/util/MultipopulationAdapterFactory.java
@@ -10,6 +10,7 @@ package org.eclipse.stem.diseasemodels.multipopulation.util;
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
+import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
@@ -20,6 +21,7 @@ import org.eclipse.stem.core.model.Decorator;
import org.eclipse.stem.core.model.IntegrationDecorator;
import org.eclipse.stem.core.model.NodeDecorator;
import org.eclipse.stem.core.modifier.Modifiable;
+import org.eclipse.stem.diseasemodels.multipopulation.*;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSEIRDiseaseModel;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSIDiseaseModel;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSIRDiseaseModel;
@@ -96,6 +98,10 @@ public class MultipopulationAdapterFactory extends AdapterFactoryImpl {
return createMultiPopulationSEIRDiseaseModelAdapter();
}
@Override
+ public Adapter caseMultiPopulationSeasonalDiseaseModel(MultiPopulationSeasonalDiseaseModel object) {
+ return createMultiPopulationSeasonalDiseaseModelAdapter();
+ }
+ @Override
public <T> Adapter caseComparable(Comparable<T> object) {
return createComparableAdapter();
}
@@ -112,14 +118,14 @@ public class MultipopulationAdapterFactory extends AdapterFactoryImpl {
return createNodeDecoratorAdapter();
}
@Override
- public Adapter caseSanityChecker(SanityChecker object) {
- return createSanityCheckerAdapter();
- }
- @Override
public Adapter caseModifiable(Modifiable object) {
return createModifiableAdapter();
}
@Override
+ public Adapter caseSanityChecker(SanityChecker object) {
+ return createSanityCheckerAdapter();
+ }
+ @Override
public Adapter caseDiseaseModel(DiseaseModel object) {
return createDiseaseModelAdapter();
}
@@ -194,6 +200,20 @@ public class MultipopulationAdapterFactory extends AdapterFactoryImpl {
}
/**
+ * Creates a new adapter for an object of class '{@link org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel <em>Multi Population Seasonal Disease Model</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel
+ * @generated
+ */
+ public Adapter createMultiPopulationSeasonalDiseaseModelAdapter() {
+ return null;
+ }
+
+ /**
* Creates a new adapter for an object of class '{@link java.lang.Comparable <em>Comparable</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
diff --git a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/util/MultipopulationSwitch.java b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/util/MultipopulationSwitch.java
index 2358a1ac2..98bcb93ff 100644
--- a/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/util/MultipopulationSwitch.java
+++ b/org.eclipse.stem.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/util/MultipopulationSwitch.java
@@ -12,6 +12,7 @@ package org.eclipse.stem.diseasemodels.multipopulation.util;
*******************************************************************************/
import java.util.List;
+import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.stem.core.common.Identifiable;
@@ -20,6 +21,7 @@ import org.eclipse.stem.core.model.Decorator;
import org.eclipse.stem.core.model.IntegrationDecorator;
import org.eclipse.stem.core.model.NodeDecorator;
import org.eclipse.stem.core.modifier.Modifiable;
+import org.eclipse.stem.diseasemodels.multipopulation.*;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSEIRDiseaseModel;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSIDiseaseModel;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSIRDiseaseModel;
@@ -108,8 +110,8 @@ public class MultipopulationSwitch<T1> {
if (result == null) result = caseDiseaseModel(multiPopulationSIDiseaseModel);
if (result == null) result = caseIntegrationDecorator(multiPopulationSIDiseaseModel);
if (result == null) result = caseNodeDecorator(multiPopulationSIDiseaseModel);
- if (result == null) result = caseSanityChecker(multiPopulationSIDiseaseModel);
if (result == null) result = caseModifiable(multiPopulationSIDiseaseModel);
+ if (result == null) result = caseSanityChecker(multiPopulationSIDiseaseModel);
if (result == null) result = caseDecorator(multiPopulationSIDiseaseModel);
if (result == null) result = caseIdentifiable(multiPopulationSIDiseaseModel);
if (result == null) result = caseComparable(multiPopulationSIDiseaseModel);
@@ -124,8 +126,8 @@ public class MultipopulationSwitch<T1> {
if (result == null) result = caseDiseaseModel(multiPopulationSIRDiseaseModel);
if (result == null) result = caseIntegrationDecorator(multiPopulationSIRDiseaseModel);
if (result == null) result = caseNodeDecorator(multiPopulationSIRDiseaseModel);
- if (result == null) result = caseSanityChecker(multiPopulationSIRDiseaseModel);
if (result == null) result = caseModifiable(multiPopulationSIRDiseaseModel);
+ if (result == null) result = caseSanityChecker(multiPopulationSIRDiseaseModel);
if (result == null) result = caseDecorator(multiPopulationSIRDiseaseModel);
if (result == null) result = caseIdentifiable(multiPopulationSIRDiseaseModel);
if (result == null) result = caseComparable(multiPopulationSIRDiseaseModel);
@@ -141,14 +143,32 @@ public class MultipopulationSwitch<T1> {
if (result == null) result = caseDiseaseModel(multiPopulationSEIRDiseaseModel);
if (result == null) result = caseIntegrationDecorator(multiPopulationSEIRDiseaseModel);
if (result == null) result = caseNodeDecorator(multiPopulationSEIRDiseaseModel);
- if (result == null) result = caseSanityChecker(multiPopulationSEIRDiseaseModel);
if (result == null) result = caseModifiable(multiPopulationSEIRDiseaseModel);
+ if (result == null) result = caseSanityChecker(multiPopulationSEIRDiseaseModel);
if (result == null) result = caseDecorator(multiPopulationSEIRDiseaseModel);
if (result == null) result = caseIdentifiable(multiPopulationSEIRDiseaseModel);
if (result == null) result = caseComparable(multiPopulationSEIRDiseaseModel);
if (result == null) result = defaultCase(theEObject);
return result;
}
+ case MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL: {
+ MultiPopulationSeasonalDiseaseModel multiPopulationSeasonalDiseaseModel = (MultiPopulationSeasonalDiseaseModel)theEObject;
+ T1 result = caseMultiPopulationSeasonalDiseaseModel(multiPopulationSeasonalDiseaseModel);
+ if (result == null) result = caseMultiPopulationSEIRDiseaseModel(multiPopulationSeasonalDiseaseModel);
+ if (result == null) result = caseMultiPopulationSIRDiseaseModel(multiPopulationSeasonalDiseaseModel);
+ if (result == null) result = caseMultiPopulationSIDiseaseModel(multiPopulationSeasonalDiseaseModel);
+ if (result == null) result = caseStandardDiseaseModel(multiPopulationSeasonalDiseaseModel);
+ if (result == null) result = caseDiseaseModel(multiPopulationSeasonalDiseaseModel);
+ if (result == null) result = caseIntegrationDecorator(multiPopulationSeasonalDiseaseModel);
+ if (result == null) result = caseNodeDecorator(multiPopulationSeasonalDiseaseModel);
+ if (result == null) result = caseModifiable(multiPopulationSeasonalDiseaseModel);
+ if (result == null) result = caseSanityChecker(multiPopulationSeasonalDiseaseModel);
+ if (result == null) result = caseDecorator(multiPopulationSeasonalDiseaseModel);
+ if (result == null) result = caseIdentifiable(multiPopulationSeasonalDiseaseModel);
+ if (result == null) result = caseComparable(multiPopulationSeasonalDiseaseModel);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
default: return defaultCase(theEObject);
}
}
@@ -199,6 +219,21 @@ public class MultipopulationSwitch<T1> {
}
/**
+ * Returns the result of interpreting the object as an instance of '<em>Multi Population Seasonal Disease Model</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Multi Population Seasonal Disease Model</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T1 caseMultiPopulationSeasonalDiseaseModel(MultiPopulationSeasonalDiseaseModel object) {
+ return null;
+ }
+
+ /**
* Returns the result of interpreting the object as an instance of '<em>Comparable</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
diff --git a/org.eclipse.stem.tests.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/tests/MultiPopulationSeasonalDiseaseModelTest.java b/org.eclipse.stem.tests.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/tests/MultiPopulationSeasonalDiseaseModelTest.java
new file mode 100644
index 000000000..6dd3f16f1
--- /dev/null
+++ b/org.eclipse.stem.tests.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/tests/MultiPopulationSeasonalDiseaseModelTest.java
@@ -0,0 +1,74 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.stem.diseasemodels.multipopulation.tests;
+
+import junit.textui.TestRunner;
+
+import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel;
+import org.eclipse.stem.diseasemodels.multipopulation.MultipopulationFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * A test case for the model object '<em><b>Multi Population Seasonal Disease Model</b></em>'.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class MultiPopulationSeasonalDiseaseModelTest extends MultiPopulationSEIRDiseaseModelTest {
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static void main(String[] args) {
+ TestRunner.run(MultiPopulationSeasonalDiseaseModelTest.class);
+ }
+
+ /**
+ * Constructs a new Multi Population Seasonal Disease Model test case with the given name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public MultiPopulationSeasonalDiseaseModelTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Returns the fixture for this Multi Population Seasonal Disease Model test case.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected MultiPopulationSeasonalDiseaseModel getFixture() {
+ return (MultiPopulationSeasonalDiseaseModel)fixture;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see junit.framework.TestCase#setUp()
+ * @generated
+ */
+ @Override
+ protected void setUp() throws Exception {
+ setFixture(MultipopulationFactory.eINSTANCE.createMultiPopulationSeasonalDiseaseModel());
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see junit.framework.TestCase#tearDown()
+ * @generated
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ setFixture(null);
+ }
+
+} //MultiPopulationSeasonalDiseaseModelTest
diff --git a/org.eclipse.stem.tests.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/tests/MultipopulationTests.java b/org.eclipse.stem.tests.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/tests/MultipopulationTests.java
index 71a1cc884..d2055781c 100644
--- a/org.eclipse.stem.tests.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/tests/MultipopulationTests.java
+++ b/org.eclipse.stem.tests.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/tests/MultipopulationTests.java
@@ -42,6 +42,7 @@ public class MultipopulationTests extends TestSuite {
suite.addTestSuite(MultiPopulationSIDiseaseModelTest.class);
suite.addTestSuite(MultiPopulationSIRDiseaseModelTest.class);
suite.addTestSuite(MultiPopulationSEIRDiseaseModelTest.class);
+ suite.addTestSuite(MultiPopulationSeasonalDiseaseModelTest.class);
return suite;
}
diff --git a/org.eclipse.stem.ui.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/presentation/MultiPopulationDiseaseModelPropertyEditor.java b/org.eclipse.stem.ui.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/presentation/MultiPopulationDiseaseModelPropertyEditor.java
index 082009974..5fbaa1ce5 100644
--- a/org.eclipse.stem.ui.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/presentation/MultiPopulationDiseaseModelPropertyEditor.java
+++ b/org.eclipse.stem.ui.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/presentation/MultiPopulationDiseaseModelPropertyEditor.java
@@ -10,26 +10,41 @@ package org.eclipse.stem.diseasemodels.multipopulation.presentation;
* IBM Corporation - initial API and implementation
*******************************************************************************/
+import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.stem.core.common.CommonPackage;
import org.eclipse.stem.core.common.DoubleValue;
import org.eclipse.stem.core.common.DoubleValueList;
import org.eclipse.stem.core.common.DoubleValueMatrix;
import org.eclipse.stem.core.common.StringValueList;
+import org.eclipse.stem.diseasemodels.multipopulation.InterpolationType;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSEIRDiseaseModel;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSIDiseaseModel;
import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSIRDiseaseModel;
+import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSeasonalDiseaseModel;
import org.eclipse.stem.diseasemodels.multipopulation.MultipopulationPackage;
import org.eclipse.stem.diseasemodels.standard.DiseaseModel;
import org.eclipse.stem.diseasemodels.standard.StandardPackage;
+import org.eclipse.stem.ui.adapters.propertystrings.PropertyStringProvider;
+import org.eclipse.stem.ui.adapters.propertystrings.PropertyStringProviderAdapter;
+import org.eclipse.stem.ui.adapters.propertystrings.PropertyStringProviderAdapterFactory;
import org.eclipse.stem.ui.widgets.MatrixEditorWidget.MatrixEditorValidator;
import org.eclipse.stem.ui.wizards.DiseaseWizardMessages;
+import org.eclipse.stem.ui.wizards.Messages;
import org.eclipse.stem.ui.wizards.StandardDiseaseModelPropertyEditor;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
/**
@@ -38,6 +53,9 @@ import org.eclipse.swt.widgets.Text;
public class MultiPopulationDiseaseModelPropertyEditor extends
StandardDiseaseModelPropertyEditor {
+ private Button linearButton;
+ private Button splineButton;
+
/**
* @param parent
* @param style
@@ -48,6 +66,50 @@ public class MultiPopulationDiseaseModelPropertyEditor extends
int style, DiseaseModel diseaseModel,
ModifyListener projectValidator, IProject project) {
super(parent, style, diseaseModel, projectValidator, project);
+
+ final PropertyStringProviderAdapter pspa = (PropertyStringProviderAdapter) PropertyStringProviderAdapterFactory.INSTANCE
+ .adapt(diseaseModel, PropertyStringProvider.class);
+ final ComposedAdapterFactory itemProviderFactory = new ComposedAdapterFactory(
+ ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+ final IItemPropertySource propertySource = (IItemPropertySource) itemProviderFactory
+ .adapt(diseaseModel, IItemPropertySource.class);
+ final List<IItemPropertyDescriptor> properties = propertySource
+ .getPropertyDescriptors(diseaseModel);
+
+ for (final IItemPropertyDescriptor descriptor : properties) {
+ final EStructuralFeature feature = (EStructuralFeature) descriptor
+ .getFeature(null);
+
+ if (feature.getEType().getName().equals("InterpolationType")) {
+ final Label label = new Label(this, SWT.NONE);
+ label.setText(pspa.getPropertyName(descriptor));
+ final GridData labelGD = new GridData(GridData.BEGINNING);
+ labelGD.grabExcessHorizontalSpace = true;
+ labelGD.horizontalAlignment = SWT.FILL;
+ labelGD.horizontalIndent = 0;
+ label.setLayoutData(labelGD);
+
+ Composite radioComposite = new Composite(this, SWT.BORDER);
+ FillLayout fillLayout = new FillLayout();
+ fillLayout.type = SWT.HORIZONTAL;
+ radioComposite.setLayout(fillLayout);
+ linearButton = new Button(radioComposite, SWT.RADIO);
+ linearButton.setText(MultipopulationDiseaseWizardMessages.getString("linearInterpolation"));//$NON-NLS-1$
+ splineButton = new Button(radioComposite, SWT.RADIO);
+ splineButton.setText(MultipopulationDiseaseWizardMessages.getString("splineInterpolation"));//$NON-NLS-1$
+ linearButton.setSelection(true);
+ final GridData cGD = new GridData(GridData.END);
+ cGD.grabExcessHorizontalSpace = true;
+ cGD.horizontalAlignment = SWT.FILL;
+ radioComposite.setLayoutData(cGD);
+
+ final Label unitLabel = new Label(this, SWT.NONE);
+ unitLabel.setText(pspa.getPropertyUnits(descriptor));
+ final GridData unitLabelGD = new GridData(GridData.END);
+ unitLabelGD.verticalAlignment = GridData.CENTER;
+ unitLabel.setLayoutData(unitLabelGD);
+ }
+ }
} // MultiDiseaseModelPropertyEditor
/**
@@ -57,6 +119,16 @@ public class MultiPopulationDiseaseModelPropertyEditor extends
public void populate(DiseaseModel diseaseModel) {
super.populate(diseaseModel);
+ if (diseaseModel instanceof MultiPopulationSeasonalDiseaseModel) {
+ MultiPopulationSeasonalDiseaseModel model = (MultiPopulationSeasonalDiseaseModel) diseaseModel;
+
+ if (linearButton.getSelection()) {
+ model.setInterpolationType(InterpolationType.LINEAR_INTERPOLATION);
+ } else if (splineButton.getSelection()) {
+ model.setInterpolationType(InterpolationType.SPLINE_INTERPOLATION);
+ }
+ }
+
for (final Map.Entry<EStructuralFeature, Text> entry : map.entrySet()) {
double dVal = 0.0;
@@ -143,6 +215,29 @@ public class MultiPopulationDiseaseModelPropertyEditor extends
((MultiPopulationSIDiseaseModel) diseaseModel).getPopulationGroups().getValues().add(sval);
}
break;
+ case MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS:
+ dvals = getDoubleArray(entry.getValue());
+ newMatrix = CommonPackage.eINSTANCE.getCommonFactory().createDoubleValueMatrix();
+ ((MultiPopulationSeasonalDiseaseModel) diseaseModel).setModulationPoints(newMatrix);
+ // ugh
+ int points = (int) (dvals.length / 2);
+ for(int r=0;r<points;++r) {
+ DoubleValueList nl = CommonPackage.eINSTANCE.getCommonFactory().createDoubleValueList();
+ nl.setIdentifier("p" + r);
+ ((MultiPopulationSeasonalDiseaseModel) diseaseModel).getModulationPoints().getValueLists().add(nl);
+ for(int c=0;c<2;++c) {
+ DoubleValue dval = CommonPackage.eINSTANCE.getCommonFactory().createDoubleValue();
+ dval.setValue(dvals[r*2+c]);
+ nl.getValues().add(dval);
+
+ if (c == 0) {
+ dval.setIdentifier("x");
+ } else {
+ dval.setIdentifier("y");
+ }
+ }
+ }
+ break;
}
}
@@ -290,6 +385,10 @@ public class MultiPopulationDiseaseModelPropertyEditor extends
*/
@Override
public short getColCount(EStructuralFeature feature) {
+ if (feature.getName().equals("modulationPoints")) {
+ return 2;
+ }
+
String [] groups = matrixMap.get(MultipopulationPackage.eINSTANCE.getMultiPopulationSIDiseaseModel_PopulationGroups());
if(groups == null)return 0;
else return (short)groups.length;
@@ -299,11 +398,17 @@ public class MultiPopulationDiseaseModelPropertyEditor extends
public boolean getFixedSize(EStructuralFeature feature) {
if(feature.getFeatureID() == MultipopulationPackage.MULTI_POPULATION_SI_DISEASE_MODEL__POPULATION_GROUPS)
return false;
+ if(feature.getFeatureID() == MultipopulationPackage.MULTI_POPULATION_SEASONAL_DISEASE_MODEL__MODULATION_POINTS)
+ return false;
return true;
}
@Override
public String[] getRowNames(EStructuralFeature feature) {
+ if (feature.getName().equals("modulationPoints")) {
+ return null;
+ }
+
String [] groups = matrixMap.get(MultipopulationPackage.eINSTANCE.getMultiPopulationSIDiseaseModel_PopulationGroups());
if (groups != null && feature.getName().equals("transmissionRate")) {
@@ -321,6 +426,11 @@ public class MultiPopulationDiseaseModelPropertyEditor extends
@Override
public String[] getColNames(EStructuralFeature feature) {
+ if (feature.getName().equals("modulationPoints")) {
+ return new String[]{MultipopulationDiseaseWizardMessages.getString("dayOfTheYear"),
+ MultipopulationDiseaseWizardMessages.getString("transmissionFactor")};
+ }
+
String [] groups = matrixMap.get(MultipopulationPackage.eINSTANCE.getMultiPopulationSIDiseaseModel_PopulationGroups());
if (groups != null && feature.getName().equals("transmissionRate")) {
@@ -338,6 +448,16 @@ public class MultiPopulationDiseaseModelPropertyEditor extends
@Override
public short getRowCount(EStructuralFeature feature) {
+ if (feature.getName().equals("modulationPoints")) {
+ String[] points = matrixMap.get(MultipopulationPackage.eINSTANCE.getMultiPopulationSeasonalDiseaseModel_ModulationPoints());
+
+ if (points == null) {
+ return 0;
+ }
+
+ return (short) (points.length / 2);
+ }
+
String [] groups = matrixMap.get(MultipopulationPackage.eINSTANCE.getMultiPopulationSIDiseaseModel_PopulationGroups());
if(groups == null)return 0;
else return (short)groups.length;
diff --git a/org.eclipse.stem.ui.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/presentation/multipopulationdiseasemessages.properties b/org.eclipse.stem.ui.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/presentation/multipopulationdiseasemessages.properties
index a9ad73b63..8b9f4904e 100644
--- a/org.eclipse.stem.ui.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/presentation/multipopulationdiseasemessages.properties
+++ b/org.eclipse.stem.ui.diseasemodels.multipopulation/src/org/eclipse/stem/diseasemodels/multipopulation/presentation/multipopulationdiseasemessages.properties
@@ -1,6 +1,14 @@
populationGroups = Population Groups
populationGroupsUNIT =
-populationGroupsTT =
+populationGroupsTT =
+
+modulationPoints = Sampling Points for Modulation
+modulationPointsUNIT =
+modulationPointsTT =
+
+interpolationType = Type of Interpolation
+interpolationTypeUNIT =
+interpolationTypeTT =
RECOVERY_RATE_INVALID = Invalid value for recovery rate
PHYS_ADJ_INVALID = Invalid value for Physical Adjacent Infectious Proportion
@@ -8,3 +16,9 @@ ROAD_NET_INVALID = Invalid value for Road Network Infectious Proportion
transmissionFrom = from
transmissionTo = to
+
+dayOfTheYear = Day of the Year
+transmissionFactor = Transmission Factor
+
+linearInterpolation = Linear Interpolation
+splineInterpolation = Spline Interpolation
diff --git a/org.eclipse.stem.ui/src/org/eclipse/stem/ui/editors/GenericPropertyEditor.java b/org.eclipse.stem.ui/src/org/eclipse/stem/ui/editors/GenericPropertyEditor.java
index 637710187..0527531b2 100644
--- a/org.eclipse.stem.ui/src/org/eclipse/stem/ui/editors/GenericPropertyEditor.java
+++ b/org.eclipse.stem.ui/src/org/eclipse/stem/ui/editors/GenericPropertyEditor.java
@@ -20,6 +20,7 @@ import java.util.Vector;
import org.eclipse.core.resources.IProject;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
@@ -111,6 +112,10 @@ public abstract class GenericPropertyEditor extends Composite {
boolean isDataPath = false;
boolean isURI = false;
+ if (feature.getEType() instanceof EEnum) {
+ continue;
+ }
+
if (isUserSpecifiedProperty(feature)) {
// Yes
final Label label = new Label(this, SWT.NONE);

Back to the top