diff artifacts/src/main/java/org/dive4elements/river/artifacts/access/HistoricalDischargeAccess.java @ 5914:1058b3436dad

D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
author Sascha L. Teichmann <teichmann@intevation.de>
date Tue, 07 May 2013 17:32:33 +0200
parents 59ff03ff48f1
children af13ceeba52a
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/HistoricalDischargeAccess.java	Tue May 07 12:47:05 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/HistoricalDischargeAccess.java	Tue May 07 17:32:33 2013 +0200
@@ -17,12 +17,23 @@
 public class HistoricalDischargeAccess extends RiverAccess {
 
     public static enum EvaluationMode {
-        W, Q
+        W(0), Q(1);
+
+        private final int mode;
+
+        EvaluationMode(int mode) {
+            this.mode = mode;
+        }
+
+        public int getMode() {
+            return mode;
+        }
     }
 
     public static final String DATA_EVALUATION_TIME = "year_range";
     public static final String DATA_EVALUATION_MODE = "historical_mode";
-    public static final String DATA_INPUT_VALUES = "historical_values";
+    public static final String DATA_INPUT_VALUES    = "historical_values";
+    public static final String DATA_REFERENCE_GAUGE = "reference_gauge";
 
     private Timerange evaluationTimerange;
     private EvaluationMode evaluationMode;
@@ -30,6 +41,8 @@
     private double[] qs;
     private double[] ws;
 
+    private Long officialGaugeNumber;
+
     public HistoricalDischargeAccess(D4EArtifact artifact) {
         super(artifact);
     }
@@ -51,6 +64,7 @@
         return evaluationMode;
     }
 
+
     /**
      * This method returns the time range specified by <i>year_range</i>
      * parameter. This parameter has to be a string that consists of two long
@@ -67,6 +81,7 @@
                 Date end = new Date(startend[1]);
 
                 evaluationTimerange = new Timerange(start, end);
+                evaluationTimerange.sort();
             }
         }
 
@@ -114,4 +129,11 @@
 
         return ws;
     }
+
+    public Long getOfficialGaugeNumber() {
+        if (officialGaugeNumber == null) {
+            officialGaugeNumber = getLong(DATA_REFERENCE_GAUGE);
+        }
+        return officialGaugeNumber;
+    }
 }

http://dive4elements.wald.intevation.org