changeset 3605:7196f06e0928

FixA: Made indices of analysis periods QWs zero based. flys-artifacts/trunk@5232 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 22 Aug 2012 11:58:48 +0000
parents 2382b26079ac
children 2b308a5d5281
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisCalculation.java
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Aug 22 11:02:56 2012 +0000
+++ b/flys-artifacts/ChangeLog	Wed Aug 22 11:58:48 2012 +0000
@@ -1,3 +1,8 @@
+2012-08-20	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisCalculation.java:
+	  Made indices of analysis periods QWs zero based.
+
 2012-08-20	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/fixings/QW.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisCalculation.java	Wed Aug 22 11:02:56 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisCalculation.java	Wed Aug 22 11:58:48 2012 +0000
@@ -26,6 +26,7 @@
 
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 
 import org.apache.commons.math.stat.descriptive.moment.StandardDeviation;
@@ -128,6 +129,9 @@
 
         IdsFilter idsFilter = new IdsFilter(events);
 
+        HashMap<Integer, Integer> col2index = new HashMap<Integer, Integer>();
+
+
         for (int row = 0, R = parameters.size(); row < R; ++row) {
             double km = parameters.get(row, kmIndex);
             parameters.get(row, parameterIndices, parameterValues);
@@ -199,11 +203,18 @@
                         Date date = column.getDate();
                         String description = column.getDescription();
 
+                        Integer colIdx = column.getIndex();
+                        Integer index = col2index.get(colIdx);
+                        if (index == null) {
+                            index = col2index.size();
+                            col2index.put(colIdx, index);
+                        }
+
                         QWD qwd = new QWD(
                             wq[1], wq[0],
                             description,
                             date, true,
-                            dw, column.getIndex());
+                            dw, index);
 
                         qwds.add(qwd);
 

http://dive4elements.wald.intevation.org