comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsOverview.java @ 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 0b86b005bb9a
children 3582e87e9171
comparison
equal deleted inserted replaced
3137:3b6ab6fac843 3138:9c147bbffc36
112 "FROM" + 112 "FROM" +
113 " wst_column_values " + 113 " wst_column_values " +
114 "WHERE" + 114 "WHERE" +
115 " wst_column_id = :column_id"; 115 " wst_column_id = :column_id";
116 116
117 public static class Range implements Serializable {
118
119 protected double start;
120 protected double end;
121
122 public Range() {
123 }
124
125 public Range(double start, double end) {
126 this.start = start;
127 this.end = end;
128 }
129
130 public double getStart() {
131 return start;
132 }
133
134 public double getEnd() {
135 return end;
136 }
137
138 public boolean disjoint(Range other) {
139 return start > other.end || other.start > end;
140 }
141
142 public boolean intersects(Range other) {
143 return !disjoint(other);
144 }
145
146 public void extend(Range other) {
147 if (other.start < start) start = other.start;
148 if (other.end > end ) end = other.end;
149 }
150
151 public boolean clip(Range other) {
152 if (disjoint(other)) return false;
153
154 if (other.start > start) start = other.start;
155 if (other.end < end ) end = other.end;
156
157 return true;
158 }
159
160 public boolean inside(double x) {
161 return x > start-EPSILON && x < end+EPSILON;
162 }
163 } // class Range
164
165 public static class GaugeRange extends Range { 117 public static class GaugeRange extends Range {
166 118
167 private static final class Sector implements Serializable { 119 private static final class Sector implements Serializable {
168 120
169 int sector; 121 int sector;

http://dive4elements.wald.intevation.org