changeset 8039:3a769d5fb733

Use GF_UNKNOWN constant instead of -1 to identify unknown grain fractions.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 16 Jul 2014 15:53:11 +0200
parents aa622bddfdac
children f1500a524b76
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java
diffstat 2 files changed, 11 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java	Wed Jul 16 13:06:09 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java	Wed Jul 16 15:53:11 2014 +0200
@@ -19,15 +19,14 @@
 
 public class SedimentLoadData implements Serializable
 {
-    public static final double STATION_EPS = 0.0001;
-
-    public static final int GF_COARSE        = 0;
-    public static final int GF_FINE_MIDDLE   = 1;
-    public static final int GF_SAND          = 2;
-    public static final int GF_SUSP_SAND     = 3;
-    public static final int GF_SUSP_SAND_BED = 4;
-    public static final int GF_SUSP_SEDIMENT = 5;
-    public static final int GF_MAX           = 5;
+    public static final int GF_UNKNOWN       = -1;
+    public static final int GF_COARSE        =  0;
+    public static final int GF_FINE_MIDDLE   =  1;
+    public static final int GF_SAND          =  2;
+    public static final int GF_SUSP_SAND     =  3;
+    public static final int GF_SUSP_SAND_BED =  4;
+    public static final int GF_SUSP_SEDIMENT =  5;
+    public static final int GF_MAX           =  5;
 
     public static final int grainFractionIndex(String name) {
         if ("coarse".equals(name))             return GF_COARSE;
@@ -36,7 +35,7 @@
         if ("susp_sand".equals(name))          return GF_SUSP_SAND;
         if ("susp_sand_bed".equals(name))      return GF_SUSP_SAND_BED;
         if ("suspended_sediment".equals(name)) return GF_SUSP_SEDIMENT;
-        return -1;
+        return GF_UNKNOWN;
     }
 
     public interface Visitor {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java	Wed Jul 16 13:06:09 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java	Wed Jul 16 15:53:11 2014 +0200
@@ -110,7 +110,7 @@
         sqlQuery.setString("river", river);
 
         SedimentLoadData.Load load = null;
-        int grainFractionIndex = -1;
+        int grainFractionIndex = SedimentLoadData.GF_UNKNOWN;
 
         HashMap<Integer, SedimentLoadData.Station> id2station
             = new HashMap<Integer, SedimentLoadData.Station>();
@@ -136,7 +136,7 @@
                 grainFractionIndex =
                     SedimentLoadData.grainFractionIndex(gf_name);
 
-                if (grainFractionIndex == -1) {
+                if (grainFractionIndex == SedimentLoadData.GF_UNKNOWN) {
                     log.error("Unknown grain fraction type: " + gf_name);
                     break;
                 }

http://dive4elements.wald.intevation.org