Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
8664:b9e5fa7f7a28 | 8665:8fbc0649da13 |
---|---|
48 private Gauge gauge; | 48 private Gauge gauge; |
49 private String gaugeName; | 49 private String gaugeName; |
50 | 50 |
51 private TimeInterval observationTimerange; | 51 private TimeInterval observationTimerange; |
52 | 52 |
53 public static final String MEASUREMENT_TYPE_BEDLOAD = "Geschiebe"; | |
54 public static final String MEASUREMENT_TYPE_SUSP = "Schwebstoff"; | |
55 | |
53 public static final class MeasurementStationComparator | 56 public static final class MeasurementStationComparator |
54 implements Comparator<MeasurementStation> { | 57 implements Comparator<MeasurementStation> { |
55 | 58 |
56 public MeasurementStationComparator() { | 59 public MeasurementStationComparator() { |
57 } | 60 } |
58 | 61 |
62 /* Compare MeasurementStations by km and consider MeasurementStations | |
63 of type "Geschiebe" as smaller if at same km. */ | |
59 @Override | 64 @Override |
60 public int compare(MeasurementStation m1, MeasurementStation m2) | 65 public int compare(MeasurementStation m1, MeasurementStation m2) |
61 throws IllegalArgumentException { | 66 throws IllegalArgumentException { |
62 | 67 |
63 if (m1.getRange().getRiver() != m2.getRange().getRiver()) { | 68 if (m1.getRange().getRiver() != m2.getRange().getRiver()) { |
78 if (m1.getMeasurementType().equals(m2.getMeasurementType())) { | 83 if (m1.getMeasurementType().equals(m2.getMeasurementType())) { |
79 throw new IllegalArgumentException( | 84 throw new IllegalArgumentException( |
80 "Two stations of same type at same km"); | 85 "Two stations of same type at same km"); |
81 } | 86 } |
82 | 87 |
83 return m1.getMeasurementType().equals("Geschiebe") ? -1 : +1; | 88 return m1.getMeasurementType().equals(MEASUREMENT_TYPE_BEDLOAD) |
89 ? -1 | |
90 : +1; | |
84 } | 91 } |
85 return cmpStations; | 92 return cmpStations; |
86 } | 93 } |
87 } | 94 } |
88 | 95 |