changeset 3138:9c147bbffc36

FixA: Move Range out of FixingsOverview flys-artifacts/trunk@4746 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 21 Jun 2012 15:18:46 +0000
parents 3b6ab6fac843
children 5888c4685701
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsFilterBuilder.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsOverview.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Range.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsOverviewService.java
diffstat 6 files changed, 74 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- 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	<sascha.teichmann@intevation.de>
+2012-06-21	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* 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	<sascha.teichmann@intevation.de>
 
 	* 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	<sascha.teichmann@intevation.de>
+2012-06-21	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/FixingsFilterBuilder.java:
 	  Fixed stupid i/j switch bug.
--- 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;
 
--- 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 {
--- /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 :
--- 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;
 
--- 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;

http://dive4elements.wald.intevation.org