# HG changeset patch # User Sascha L. Teichmann # Date 1338390018 0 # Node ID 9aa1d770da4aba1263015c1b962cf86b39165f6f # Parent a86c1a9456aedc3e8dfda25901a332b8758ae38e Fix: Better model for storing results of the delta W/t calculation. flys-artifacts/trunk@4561 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r a86c1a9456ae -r 9aa1d770da4a flys-artifacts/ChangeLog --- 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 + + 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 Will be used as a replacement for DeltaWTsKM. + 2012-05-30 Sascha L. Teichmann * src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java, diff -r a86c1a9456ae -r 9aa1d770da4a flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/AnalysisPeriod.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 : diff -r a86c1a9456ae -r 9aa1d770da4a flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/AnalysisPeriodsKM.java --- /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 KM_COMPARATOR = + new Comparator() { + @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 : diff -r a86c1a9456ae -r 9aa1d770da4a flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/QWD.java --- /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 :