Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/LinearInterpolated.java @ 6510:1e6bd2831280
artifacts: Desktop-FLYS conform official line messages in error reports.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 28 Jun 2013 20:20:14 +0200 |
parents | 12af732c9d0f |
children | 1dff8e71c4d6 |
rev | line source |
---|---|
6152
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
3 * |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
7 */ |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
8 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
9 package org.dive4elements.river.artifacts.model; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
10 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
11 import gnu.trove.TDoubleArrayList; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
12 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
13 import java.io.Serializable; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
14 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
15 import java.util.ArrayList; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
16 import java.util.List; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
17 import java.util.Set; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
18 import java.util.TreeSet; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
19 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
20 import org.apache.commons.math.stat.descriptive.moment.StandardDeviation; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
21 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
22 import org.dive4elements.river.artifacts.math.Linear; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
23 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
24 import org.dive4elements.river.utils.EpsilonComparator; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
25 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
26 public class LinearInterpolated |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
27 implements Serializable |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
28 { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
29 public static final double EPSILON = 1e-5; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
30 public static final double MULTIPLE_STD_DEV = 4d; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
31 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
32 public static final EpsilonComparator CMP = new EpsilonComparator(EPSILON); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
33 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
34 private TDoubleArrayList xs; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
35 private TDoubleArrayList ys; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
36 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
37 private List<Range> gaps; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
38 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
39 public interface Operator { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
40 double evaluate(double y1, double y2); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
41 } // interface Operator |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
42 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
43 public static final Operator SUB = new Operator() { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
44 @Override |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
45 public double evaluate(double y1, double y2) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
46 return y1 - y2; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
47 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
48 }; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
49 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
50 public static final Operator MAX = new Operator() { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
51 @Override |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
52 public double evaluate(double y1, double y2) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
53 return Math.max(y1, y2); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
54 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
55 }; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
56 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
57 public LinearInterpolated() { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
58 xs = new TDoubleArrayList(); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
59 ys = new TDoubleArrayList(); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
60 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
61 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
62 public LinearInterpolated(int capacity) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
63 xs = new TDoubleArrayList(capacity); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
64 ys = new TDoubleArrayList(capacity); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
65 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
66 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
67 public void add(double x, double y) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
68 xs.add(x); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
69 ys.add(y); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
70 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
71 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
72 public int size() { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
73 return xs.size(); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
74 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
75 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
76 public void pointsInRange(double from, double to, Set<Double> points) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
77 if (from > to) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
78 double t = from; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
79 from = to; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
80 to = t; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
81 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
82 for (int i = 0, S = size(); i < S; ++i) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
83 double x = xs.getQuick(i); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
84 if (x >= from && x <= to) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
85 points.add(x); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
86 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
87 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
88 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
89 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
90 public boolean inGap(double x) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
91 if (gaps != null) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
92 for (Range gap: gaps) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
93 if (gap.inside(x)) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
94 return true; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
95 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
96 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
97 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
98 return false; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
99 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
100 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
101 public void detectGaps(double threshold) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
102 List<Range> gabs = new ArrayList<Range>(); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
103 for (int i = 1, S = size(); i < S; ++i) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
104 double x0 = xs.getQuick(i-1); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
105 double x1 = xs.getQuick(i); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
106 double minX, maxX; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
107 if (x0 < x1) { minX = x0; maxX = x1; } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
108 else { minX = x1; maxX = x0; } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
109 double diff = maxX - minX - 2d*EPSILON; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
110 if (diff > threshold) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
111 gaps.add(new Range(minX+EPSILON, maxX-EPSILON)); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
112 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
113 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
114 this.gaps = gaps.isEmpty() ? null : gabs; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
115 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
116 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
117 public void resetGaps() { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
118 gaps = null; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
119 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
120 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
121 public double guessGapThreshold() { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
122 return guessGapThreshold(MULTIPLE_STD_DEV); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
123 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
124 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
125 public double guessGapThreshold(double scale) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
126 int S = size(); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
127 if (S < 5) { // Too less points. |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
128 return Double.MAX_VALUE; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
129 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
130 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
131 StandardDeviation s = new StandardDeviation(); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
132 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
133 for (int i = 1; i < S; ++i) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
134 double diff = Math.abs(xs.getQuick(i-1) - xs.getQuick(i)); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
135 s.increment(diff); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
136 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
137 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
138 return scale*s.getResult(); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
139 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
140 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
141 public double value(double x) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
142 for (int i = 0, S = size(); i < S; ++i) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
143 double x1 = xs.getQuick(i); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
144 if (Math.abs(x1 - x) < EPSILON) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
145 return ys.getQuick(i); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
146 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
147 if (i > 0) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
148 double x0 = xs.getQuick(i-1); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
149 double minX, maxX; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
150 if (x0 < x1) { minX = x0; maxX = x1; } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
151 else { minX = x1; maxX = x0; } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
152 if (x > minX && x < maxX) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
153 return Linear.linear( |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
154 x, |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
155 x0, x1, |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
156 ys.getQuick(i-1), ys.getQuick(i)); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
157 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
158 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
159 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
160 return Double.NaN; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
161 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
162 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
163 public LinearInterpolated sub( |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
164 LinearInterpolated other, |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
165 double from, |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
166 double to |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
167 ) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
168 return apply(SUB, other, from, to); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
169 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
170 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
171 public LinearInterpolated max( |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
172 LinearInterpolated other, |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
173 double from, |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
174 double to |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
175 ) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
176 return apply(MAX, other, from, to); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
177 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
178 |
6153
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
179 public boolean intersect(LinearInterpolated other) { |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
180 if (xs.isEmpty() || other.xs.isEmpty()) { |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
181 return false; |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
182 } |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
183 |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
184 double tMax = xs.max(); |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
185 double oMin = other.xs.min(); |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
186 if (tMax < oMin) { |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
187 return false; |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
188 } |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
189 |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
190 double tMin = xs.min(); |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
191 double oMax = other.xs.max(); |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
192 return !(tMin > oMax); |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
193 } |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
194 |
6152
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
195 public LinearInterpolated apply( |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
196 Operator operator, |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
197 LinearInterpolated other, |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
198 double from, |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
199 double to |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
200 ) { |
6153
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
201 LinearInterpolated result = new LinearInterpolated(); |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
202 if (!intersect(other)) { |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
203 return result; |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
204 } |
12af732c9d0f
LinearInterpolated#apply(): Added simple test if the two datasets intersect at all.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6152
diff
changeset
|
205 |
6152
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
206 Set<Double> points = new TreeSet<Double>(CMP); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
207 points.add(from); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
208 points.add(to); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
209 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
210 this .pointsInRange(from, to, points); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
211 other.pointsInRange(from, to, points); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
212 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
213 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
214 for (double x: points) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
215 if (!inGap(x) && !other.inGap(x)) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
216 double y1 = this .value(x); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
217 double y2 = other.value(x); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
218 double y = operator.evaluate(y1, y2); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
219 if (!Double.isNaN(y)) { |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
220 result.add(x, y); |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
221 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
222 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
223 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
224 |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
225 return result; |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
226 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
227 } |
0587819960c3
Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
228 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |