[PATCH] FixA Delta W(t): Add 30 seconds to colliding dates to avoid them vanishing from the diagrams
Wald Commits
scm-commit at wald.intevation.org
Tue Aug 20 11:20:34 CEST 2013
# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1376990425 -7200
# Node ID d9dfa52f69eb22b2cd0b084293710092928446db
# Parent 6848c5c8fc2368064559f89ceced1b476c099dff
FixA Delta W(t): Add 30 seconds to colliding dates to avoid them vanishing from the diagrams.
diff -r 6848c5c8fc23 -r d9dfa52f69eb artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java Mon Aug 19 22:19:09 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java Tue Aug 20 11:20:25 2013 +0200
@@ -41,6 +41,8 @@
import org.jfree.data.time.TimeSeriesCollection;
import org.w3c.dom.Document;
+import gnu.trove.TLongHashSet;
+
/**
* Generator for Delta W(t) charts.
@@ -79,7 +81,10 @@
}
- private D4EArtifact artifact = null;
+ private D4EArtifact artifact;
+
+ // Used to make the dates collision free.
+ private TLongHashSet uniqueDates = new TLongHashSet();
@Override
@@ -247,6 +252,12 @@
}
}
+ private long uniqueDate(long date) {
+ return uniqueDates.add(date)
+ ? date
+ : uniqueDate(date+30L*1000L); // add 30secs.
+ }
+
protected void doSectorAverageOut(
D4EArtifact artifact,
@@ -323,7 +334,8 @@
int idxInterpol = 0;
int idxRegular = 0;
- RegularTimePeriod rtp = new FixedMillisecond(qwd.getDate());
+ long time = uniqueDate(qwd.getDate().getTime());
+ RegularTimePeriod rtp = new FixedMillisecond(time);
double value = qwd.getDeltaW();
boolean interpolate = qwd.getInterpolated();
if (interpolate) {
More information about the Dive4elements-commits
mailing list