diff backend/src/main/java/org/dive4elements/river/model/MeasurementStation.java @ 8665:8fbc0649da13

Move static measurement types to their natural home.
author Tom Gottfried <tom@intevation.de>
date Wed, 08 Apr 2015 14:47:30 +0200
parents 0860e4f642c4
children 851ea37d35f3
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/model/MeasurementStation.java	Tue Apr 07 16:35:11 2015 +0200
+++ b/backend/src/main/java/org/dive4elements/river/model/MeasurementStation.java	Wed Apr 08 14:47:30 2015 +0200
@@ -50,12 +50,17 @@
 
     private TimeInterval observationTimerange;
 
+    public static final String MEASUREMENT_TYPE_BEDLOAD = "Geschiebe";
+    public static final String MEASUREMENT_TYPE_SUSP = "Schwebstoff";
+
     public static final class MeasurementStationComparator
         implements Comparator<MeasurementStation> {
 
         public MeasurementStationComparator() {
         }
 
+        /* Compare MeasurementStations by km and consider MeasurementStations
+           of type "Geschiebe" as smaller if at same km. */
         @Override
         public int compare(MeasurementStation m1, MeasurementStation m2)
             throws IllegalArgumentException {
@@ -80,7 +85,9 @@
                         "Two stations of same type at same km");
                 }
 
-                return m1.getMeasurementType().equals("Geschiebe") ? -1 : +1;
+                return m1.getMeasurementType().equals(MEASUREMENT_TYPE_BEDLOAD)
+                    ? -1
+                    : +1;
             }
             return cmpStations;
         }

http://dive4elements.wald.intevation.org