# HG changeset patch # User Sascha L. Teichmann # Date 1340291926 0 # Node ID 9c147bbffc36ce7fea40b700252e91871440ee56 # Parent 3b6ab6fac843cd01030f798b372539103b2bbfa0 FixA: Move Range out of FixingsOverview flys-artifacts/trunk@4746 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 3b6ab6fac843 -r 9c147bbffc36 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Thu Jun 21 14:26:34 2012 +0000 +++ b/flys-artifacts/ChangeLog Thu Jun 21 15:18:46 2012 +0000 @@ -1,10 +1,23 @@ -2012-06-20 Sascha L. Teichmann +2012-06-21 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/artifacts/model/Range.java: + New. Moved out of FixingsOverview. + + * src/main/java/de/intevation/flys/artifacts/model/FixingsOverview.java: + Moved Range into top level class. + + * src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java, + src/main/java/de/intevation/flys/artifacts/model/FixingsFilterBuilder.java, + src/main/java/de/intevation/flys/artifacts/services/FixingsOverviewService.java: + Adjusted imports. + +2012-06-21 Sascha L. Teichmann * src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java: Fixed problem with select the wrong meta data (date, descriptions, etc.) for a data column. -2012-06-20 Sascha L. Teichmann +2012-06-21 Sascha L. Teichmann * src/main/java/de/intevation/flys/artifacts/model/FixingsFilterBuilder.java: Fixed stupid i/j switch bug. diff -r 3b6ab6fac843 -r 9c147bbffc36 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsFilterBuilder.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsFilterBuilder.java Thu Jun 21 14:26:34 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsFilterBuilder.java Thu Jun 21 15:18:46 2012 +0000 @@ -6,12 +6,13 @@ import de.intevation.flys.artifacts.model.FixingsOverview.Fixing.Filter; +import de.intevation.flys.artifacts.model.Range; + import de.intevation.flys.artifacts.model.FixingsOverview.IdFilter; import de.intevation.flys.artifacts.model.FixingsOverview.IdsFilter; import de.intevation.flys.artifacts.model.FixingsOverview.KmFilter; import de.intevation.flys.artifacts.model.FixingsOverview.NotFilter; import de.intevation.flys.artifacts.model.FixingsOverview.OrFilter; -import de.intevation.flys.artifacts.model.FixingsOverview.Range; import de.intevation.flys.artifacts.model.FixingsOverview.SectorFilter; import de.intevation.flys.artifacts.model.FixingsOverview.SectorRangeFilter; diff -r 3b6ab6fac843 -r 9c147bbffc36 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsOverview.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsOverview.java Thu Jun 21 14:26:34 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsOverview.java Thu Jun 21 15:18:46 2012 +0000 @@ -114,54 +114,6 @@ "WHERE" + " wst_column_id = :column_id"; - public static class Range implements Serializable { - - protected double start; - protected double end; - - public Range() { - } - - public Range(double start, double end) { - this.start = start; - this.end = end; - } - - public double getStart() { - return start; - } - - public double getEnd() { - return end; - } - - public boolean disjoint(Range other) { - return start > other.end || other.start > end; - } - - public boolean intersects(Range other) { - return !disjoint(other); - } - - public void extend(Range other) { - if (other.start < start) start = other.start; - if (other.end > end ) end = other.end; - } - - public boolean clip(Range other) { - if (disjoint(other)) return false; - - if (other.start > start) start = other.start; - if (other.end < end ) end = other.end; - - return true; - } - - public boolean inside(double x) { - return x > start-EPSILON && x < end+EPSILON; - } - } // class Range - public static class GaugeRange extends Range { private static final class Sector implements Serializable { diff -r 3b6ab6fac843 -r 9c147bbffc36 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Range.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Range.java Thu Jun 21 15:18:46 2012 +0000 @@ -0,0 +1,54 @@ +package de.intevation.flys.artifacts.model; + +import java.io.Serializable; + +public class Range implements Serializable { + + public static final double EPSILON = 1e-5; + + protected double start; + protected double end; + + public Range() { + } + + public Range(double start, double end) { + this.start = start; + this.end = end; + } + + public double getStart() { + return start; + } + + public double getEnd() { + return end; + } + + public boolean disjoint(Range other) { + return start > other.end || other.start > end; + } + + public boolean intersects(Range other) { + return !disjoint(other); + } + + public void extend(Range other) { + if (other.start < start) start = other.start; + if (other.end > end ) end = other.end; + } + + public boolean clip(Range other) { + if (disjoint(other)) return false; + + if (other.start > start) start = other.start; + if (other.end < end ) end = other.end; + + return true; + } + + public boolean inside(double x) { + return x > start-EPSILON && x < end+EPSILON; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 3b6ab6fac843 -r 9c147bbffc36 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java Thu Jun 21 14:26:34 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java Thu Jun 21 15:18:46 2012 +0000 @@ -15,10 +15,11 @@ import de.intevation.flys.artifacts.model.FixingsOverview.Fixing.Filter; +import de.intevation.flys.artifacts.model.Range; + import de.intevation.flys.artifacts.model.FixingsOverview.Fixing; import de.intevation.flys.artifacts.model.FixingsOverview.IdsFilter; import de.intevation.flys.artifacts.model.FixingsOverview.KmFilter; -import de.intevation.flys.artifacts.model.FixingsOverview.Range; import de.intevation.flys.artifacts.model.FixingsOverview.SectorFilter; import de.intevation.flys.artifacts.model.FixingsOverview.SectorRangeFilter; diff -r 3b6ab6fac843 -r 9c147bbffc36 flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsOverviewService.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsOverviewService.java Thu Jun 21 14:26:34 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsOverviewService.java Thu Jun 21 15:18:46 2012 +0000 @@ -9,7 +9,7 @@ import de.intevation.flys.artifacts.model.FixingsOverview.Fixing.Filter; -import de.intevation.flys.artifacts.model.FixingsOverview.Range; +import de.intevation.flys.artifacts.model.Range; import de.intevation.flys.artifacts.model.FixingsOverview; import de.intevation.flys.artifacts.model.FixingsOverviewFactory;