diff flys-backend/src/main/java/de/intevation/flys/model/Gauge.java @ 480:46bb2b9e0bdc

Introduced a 'scale' parameter in Gauge.determineMinMaxW(). flys-backend/trunk@1787 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 02 May 2011 11:33:32 +0000
parents 8d76556c9616
children 5a3109b8475f
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java	Sun May 01 11:14:18 2011 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java	Mon May 02 11:33:32 2011 +0000
@@ -28,6 +28,8 @@
 public class Gauge
 implements   Serializable
 {
+    public static final int DEFAULT_SCALE = 100;
+
     private Integer    id;
     private String     name;
     private River      river;
@@ -142,11 +144,21 @@
 
 
     /**
+     * Returns min and max W values of this gauge based with a DEFAULT_SCALE.
+     *
+     * @return min and max W value of this gauge [min,max].
+     */
+    public double[] determineMinMaxW() {
+        return determineMinMaxW(DEFAULT_SCALE);
+    }
+
+
+    /**
      * Returns min and max W values of this gauge.
      *
      *  @return the min and max W value of this gauge [min,max].
      */
-    public double[] determineMinMaxW() {
+    public double[] determineMinMaxW(int scale) {
         Session session = SessionHolder.HOLDER.get();
 
         List<DischargeTable> tables   = getDischargeTables();
@@ -173,8 +185,8 @@
 
         return result != null
             ? new double[] {
-                ((BigDecimal) result[0]).doubleValue(),
-                ((BigDecimal) result[1]).doubleValue() }
+                ((BigDecimal) result[0]).doubleValue() * scale,
+                ((BigDecimal) result[1]).doubleValue() * scale}
             : null;
     }
 }

http://dive4elements.wald.intevation.org