# HG changeset patch # User Sascha L. Teichmann # Date 1343038275 0 # Node ID cb11919cccf977753c0e0dcb51df449c3d708401 # Parent b9aff8d6ff741638631515f9c25749cce526a413 FixA 'ausgelagerte Wasserspiegellagen' move comparator code into segment class. flys-artifacts/trunk@5102 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r b9aff8d6ff74 -r cb11919cccf9 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Mon Jul 23 09:37:12 2012 +0000 +++ b/flys-artifacts/ChangeLog Mon Jul 23 10:11:15 2012 +0000 @@ -1,3 +1,10 @@ +2012-07-23 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/artifacts/model/Calculation4.java + src/main/java/de/intevation/flys/artifacts/model/Segment.java: + Moved reference point comparator to segment class be be reusable + in FixA 'ausgelagerte Wasserspiegellagen'. + 2012-07-23 Christian Lins * src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java: diff -r b9aff8d6ff74 -r cb11919cccf9 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation4.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation4.java Mon Jul 23 09:37:12 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation4.java Mon Jul 23 10:11:15 2012 +0000 @@ -2,7 +2,6 @@ import java.util.List; import java.util.Arrays; -import java.util.Comparator; import java.util.Collections; import de.intevation.flys.utils.DoubleUtil; @@ -27,15 +26,6 @@ public static final double MINIMAL_STEP_WIDTH = 1e-5; - public static final Comparator REF_CMP = - new Comparator() { - public int compare(Segment a, Segment b) { - double d = a.referencePoint - b.referencePoint; - if (d < 0d) return -1; - return d > 0d ? +1 : 0; - } - }; - protected List segments; protected boolean isQ; @@ -106,7 +96,7 @@ } } // for all segments - Collections.sort(segments, REF_CMP); + Collections.sort(segments, Segment.REF_CMP); } public CalculationResult calculate( diff -r b9aff8d6ff74 -r cb11919cccf9 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Segment.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Segment.java Mon Jul 23 09:37:12 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Segment.java Mon Jul 23 10:11:15 2012 +0000 @@ -7,6 +7,7 @@ import java.io.Serializable; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import org.apache.log4j.Logger; @@ -16,6 +17,16 @@ { private static Logger logger = Logger.getLogger(Segment.class); + public static final Comparator REF_CMP = + new Comparator() { + @Override + public int compare(Segment a, Segment b) { + double d = a.referencePoint - b.referencePoint; + if (d < 0d) return -1; + return d > 0d ? +1 : 0; + } + }; + protected double from; protected double to; protected double [] values;