# HG changeset patch # User Ingo Weinzierl # Date 1350558744 -7200 # Node ID eaf83d4ae6b165e12010cf93e6535d87bd3e5c96 # Parent 7d4480c0e68ebc0e228b46bdc0538adf73f3fec7 Sorted gauges for reference gauge selection in historical discharge calculation based on their name. Now, Gauge implements the Java Comparable interface and takes its name into account. diff -r 7d4480c0e68e -r eaf83d4ae6b1 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java Thu Oct 18 12:13:48 2012 +0200 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java Thu Oct 18 13:12:24 2012 +0200 @@ -1,5 +1,6 @@ package de.intevation.flys.artifacts.states; +import java.util.Collections; import java.util.List; import org.w3c.dom.Element; @@ -33,6 +34,7 @@ { River river = FLYSUtils.getRiver((FLYSArtifact) artifact); List gauges = river.getGauges(); + Collections.sort(gauges); int num = gauges != null ? gauges.size() : 0; diff -r 7d4480c0e68e -r eaf83d4ae6b1 flys-backend/src/main/java/de/intevation/flys/model/Gauge.java --- a/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java Thu Oct 18 12:13:48 2012 +0200 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java Thu Oct 18 13:12:24 2012 +0200 @@ -25,7 +25,7 @@ @Entity @Table(name = "gauges") public class Gauge -implements Serializable +implements Serializable, Comparable { public static final int DEFAULT_SCALE = 100; @@ -325,5 +325,10 @@ return new MinMaxWQ(minw, maxw, minq, maxq); } + + @Override + public int compareTo(Gauge o) { + return getName().compareTo(o.getName()); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :