changeset 3005:9aa1d770da4a

Fix: Better model for storing results of the delta W/t calculation. flys-artifacts/trunk@4561 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 30 May 2012 15:00:18 +0000
parents a86c1a9456ae
children 1b1af1597401
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/AnalysisPeriod.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/AnalysisPeriodsKM.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/QWD.java
diffstat 4 files changed, 179 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed May 30 14:50:33 2012 +0000
+++ b/flys-artifacts/ChangeLog	Wed May 30 15:00:18 2012 +0000
@@ -1,3 +1,17 @@
+2012-05-30	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	Better persistence model for delta w/t calculations. Supports
+	storage of Q sector averages, too. TODO: Use the new model.
+
+	* src/main/java/de/intevation/flys/artifacts/model/fixings/QWD.java:
+	  New. Will be used as a replacement for DeltaWT.
+
+	* src/main/java/de/intevation/flys/artifacts/model/fixings/AnalysisPeriod.java:
+	  New. Will be used as a replacement for DeltaWTsKM.KM.
+
+	* src/main/java/de/intevation/flys/artifacts/model/fixings/AnalysisPeriodsKM.java:
+	 New. List<AnalysisPeriodsKM> Will be used as a replacement for DeltaWTsKM.
+
 2012-05-30	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/AnalysisPeriod.java	Wed May 30 15:00:18 2012 +0000
@@ -0,0 +1,61 @@
+package de.intevation.flys.artifacts.model.fixings;
+
+import java.io.Serializable;
+
+public class AnalysisPeriod
+implements   Serializable
+{
+    protected DateRange dateRange;
+    protected QWD []    qwds;
+    protected QWD []    qSectorAverages;
+
+    public AnalysisPeriod() {
+    }
+
+    public AnalysisPeriod(DateRange dateRange) {
+        this.dateRange = dateRange;
+    }
+
+    public AnalysisPeriod(DateRange dateRange, QWD [] qwds) {
+        this(dateRange);
+        this.dateRange = dateRange;
+    }
+
+    public AnalysisPeriod(
+        DateRange dateRange,
+        QWD []    qwds,
+        QWD []    qSectorAverages
+    ) {
+        this(dateRange, qwds);
+        this.qSectorAverages = qSectorAverages;
+    }
+
+    public DateRange getDateRange() {
+        return dateRange;
+    }
+
+    public void setDateRange(DateRange dateRange) {
+        this.dateRange = dateRange;
+    }
+
+    public QWD [] getQWDs() {
+        return qwds;
+    }
+
+    public void setQWDs(QWD [] qwds) {
+        this.qwds = qwds;
+    }
+
+    public QWD [] getQSectorAverages() {
+        return qSectorAverages;
+    }
+
+    public void setQSectorAverages(QWD [] qSectorAverages) {
+        this.qSectorAverages = qSectorAverages;
+    }
+
+    public QWD getQSectorAverage(int i) {
+        return qSectorAverages[i];
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/AnalysisPeriodsKM.java	Wed May 30 15:00:18 2012 +0000
@@ -0,0 +1,53 @@
+package de.intevation.flys.artifacts.model.fixings;
+
+import java.util.Comparator;
+
+import java.io.Serializable;
+
+public class AnalysisPeriodsKM
+implements   Serializable
+{
+    public static final double EPSILON = 1e-5;
+
+    public static final Comparator<AnalysisPeriodsKM> KM_COMPARATOR =
+        new Comparator<AnalysisPeriodsKM>() {
+            @Override
+            public int compare(AnalysisPeriodsKM a, AnalysisPeriodsKM b) {
+                double d = a.km - b.km;
+                if (d < EPSILON) return -1;
+                return d > EPSILON ? +1 : 0;
+            }
+        };
+
+    protected double            km;
+    protected AnalysisPeriod [] analysisPeriods;
+
+    public AnalysisPeriodsKM() {
+    }
+
+    public AnalysisPeriodsKM(double km) {
+        this.km = km;
+    }
+
+    public AnalysisPeriodsKM(double km, AnalysisPeriod [] analysisPeriods) {
+        this(km);
+        this.analysisPeriods = analysisPeriods;
+    }
+
+    public double getKm() {
+        return km;
+    }
+
+    public void setKm(double km) {
+        this.km = km;
+    }
+
+    public AnalysisPeriod [] getAnalysisPeriods() {
+        return analysisPeriods;
+    }
+
+    public void setAnalysisPeriods(AnalysisPeriod [] analysisPeriods) {
+        this.analysisPeriods = analysisPeriods;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/QWD.java	Wed May 30 15:00:18 2012 +0000
@@ -0,0 +1,51 @@
+package de.intevation.flys.artifacts.model.fixings;
+
+import java.util.Date;
+
+import java.io.Serializable;
+
+public class QWD
+implements   Serializable
+{
+    protected double q;
+    protected double w;
+    protected double deltaW;
+    protected Date   date;
+    protected String description;
+
+    public QWD() {
+    }
+
+    public double getQ() {
+        return q;
+    }
+
+    public void setQ(double q) {
+        this.q = q;
+    }
+
+    public double getW() {
+        return w;
+    }
+
+    public void setW(double w) {
+        this.w = w;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org