Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java @ 8216:cb25ea4d4551
We only need to know what's going on upstream.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 08 Sep 2014 12:25:47 +0200 |
parents | 3bb00338228c |
children | 2f63c6c84540 |
comparison
equal
deleted
inserted
replaced
8215:204905c16ade | 8216:cb25ea4d4551 |
---|---|
219 | 219 |
220 private int type; | 220 private int type; |
221 | 221 |
222 private List<List<Value>> grainFractions; | 222 private List<List<Value>> grainFractions; |
223 | 223 |
224 private Station next; | |
225 private Station prev; | 224 private Station prev; |
226 | 225 |
227 public Station() { | 226 public Station() { |
228 this(BED_LOAD, 0.0); | 227 this(BED_LOAD, 0.0); |
229 } | 228 } |
257 | 256 |
258 public boolean isType(int type) { | 257 public boolean isType(int type) { |
259 return (this.type & type) != 0; | 258 return (this.type & type) != 0; |
260 } | 259 } |
261 | 260 |
262 public void setNext(Station next) { | |
263 this.next = next; | |
264 } | |
265 | |
266 public Station getNext() { | |
267 return next; | |
268 } | |
269 | |
270 public void setPrev(Station prev) { | 261 public void setPrev(Station prev) { |
271 this.prev = prev; | 262 this.prev = prev; |
272 } | 263 } |
273 | 264 |
274 public Station getPrev() { | 265 public Station getPrev() { |
295 if (b == null) return a; | 286 if (b == null) return a; |
296 a.addAll(b); | 287 a.addAll(b); |
297 // re-establish id order. | 288 // re-establish id order. |
298 Collections.sort(a, ID_CMP); | 289 Collections.sort(a, ID_CMP); |
299 return a; | 290 return a; |
300 } | |
301 | |
302 public Station nextByType(int type) { | |
303 for (Station curr = this; curr != null; curr = curr.getNext()) { | |
304 if (curr.isType(type)) { | |
305 return curr; | |
306 } | |
307 } | |
308 return null; | |
309 } | 291 } |
310 | 292 |
311 public Station prevByType(int type) { | 293 public Station prevByType(int type) { |
312 for (Station curr = this; curr != null; curr = curr.getPrev()) { | 294 for (Station curr = this; curr != null; curr = curr.getPrev()) { |
313 if (curr.isType(type)) { | 295 if (curr.isType(type)) { |
429 } | 411 } |
430 | 412 |
431 private void wireNeighbors(boolean kmUp) { | 413 private void wireNeighbors(boolean kmUp) { |
432 if (kmUp) { | 414 if (kmUp) { |
433 for (int i = stations.length - 1; i > 0; --i) { | 415 for (int i = stations.length - 1; i > 0; --i) { |
434 stations[i].setNext(stations[i-1]); | |
435 stations[i-1].setPrev(stations[i]); | 416 stations[i-1].setPrev(stations[i]); |
436 } | 417 } |
437 } | 418 } |
438 else { | 419 else { |
439 for (int i = 1; i < stations.length; ++i) { | 420 for (int i = 1; i < stations.length; ++i) { |
440 stations[i-1].setNext(stations[i]); | |
441 stations[i].setPrev(stations[i-1]); | 421 stations[i].setPrev(stations[i-1]); |
442 } | 422 } |
443 } | 423 } |
444 } | 424 } |
445 | 425 |