annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQ.java @ 2081:aa9cc91c8193

#444 Take care on NullPointerExceptions in getWQMode. Take 'false' as default value if no 'wq_free' item is existing. flys-artifacts/trunk@3597 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 05 Jan 2012 14:15:07 +0000
parents 03fbf1b30e72
children bda04ae1154f
rev   line source
726
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
1678
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1033
diff changeset
3 import de.intevation.flys.utils.DataUtil;
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1033
diff changeset
4
726
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 import gnu.trove.TDoubleArrayList;
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6
1033
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
7 import org.apache.log4j.Logger;
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
8
726
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 public class WQ
925
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 748
diff changeset
10 extends NamedObjectImpl
726
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 {
1033
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
12 private static Logger logger = Logger.getLogger(WQ.class);
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
13
925
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 748
diff changeset
14 // TODO: s/w/ws/g
726
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 protected TDoubleArrayList w;
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16
925
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 748
diff changeset
17 // TODO: s/q/qs/g
726
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 protected TDoubleArrayList q;
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 public WQ() {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 this("");
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 public WQ(String name) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 w = new TDoubleArrayList();
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 q = new TDoubleArrayList();
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 public WQ(int capacity) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 this(capacity, "");
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 public WQ(int capacity, String name) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 super(name);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 w = new TDoubleArrayList(capacity);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 q = new TDoubleArrayList(capacity);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 public WQ(double [] qs, double [] ws) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 this(qs, ws, "");
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 public WQ(double [] qs, double [] ws, String name) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45 super(name);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 w = new TDoubleArrayList(ws);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 q = new TDoubleArrayList(qs);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50 public void add(double w, double q) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 this.w.add(w);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 this.q.add(q);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 public int size() {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 return w.size();
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 public double getW(int idx) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60 return w.getQuick(idx);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63 public double getQ(int idx) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 return q.getQuick(idx);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 public double [] get(int idx) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 return get(idx, new double [2]);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 public double [] get(int idx, double [] dst) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72 dst[0] = w.getQuick(idx);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73 dst[1] = q.getQuick(idx);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 return dst;
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77 public double [] getWs() {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 return w.toNativeArray();
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
80
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81 public double [] getQs() {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82 return q.toNativeArray();
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
85 public static void removeNaNs(TDoubleArrayList [] arrays) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
86
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
87 int dest = 0;
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
88
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
89 int A = arrays.length;
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90 int N = arrays[0].size();
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
91
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
92 OUTER: for (int i = 0; i < N; ++i) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
93 for (int j = 0; j < A; ++j) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
94 TDoubleArrayList a = arrays[j];
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
95 double v = a.getQuick(i);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
96 if (Double.isNaN(v)) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97 continue OUTER;
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
98 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
99 a.setQuick(dest, v);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
101 ++dest;
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
103
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
104 if (dest < N) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
105 for (int i = 0; i < A; ++i) {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
106 arrays[i].remove(dest, N-dest);
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
107 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
108 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
109 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
110
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
111 public void removeNaNs() {
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
112 removeNaNs(new TDoubleArrayList [] { w, q });
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
113 }
744
b385577bcaca WQ: Added a method to guess is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 726
diff changeset
114
b385577bcaca WQ: Added a method to guess is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 726
diff changeset
115 public boolean guessWaterIncreasing() {
b385577bcaca WQ: Added a method to guess is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 726
diff changeset
116 return guessWaterIncreasing(0.05f);
b385577bcaca WQ: Added a method to guess is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 726
diff changeset
117 }
b385577bcaca WQ: Added a method to guess is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 726
diff changeset
118
b385577bcaca WQ: Added a method to guess is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 726
diff changeset
119 public boolean guessWaterIncreasing(float factor) {
1678
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1033
diff changeset
120 return DataUtil.guessWaterIncreasing(w, factor);
744
b385577bcaca WQ: Added a method to guess is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 726
diff changeset
121 }
b385577bcaca WQ: Added a method to guess is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 726
diff changeset
122
1033
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
123 public int [] longestIncreasingWRangeIndices() {
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
124 return longestIncreasingWRangeIndices(new int[2]);
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
125 }
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
126
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
127 public int [] longestIncreasingWRangeIndices(int [] bounds) {
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
128
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
129 int N = size();
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
130 int start = 0;
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
131 int stop = 0;
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
132
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
133 double lastW = Double.MAX_VALUE;
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
134
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
135 for (int i = 0; i < N; ++i) {
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
136 double v = w.getQuick(i);
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
137 if (v <= lastW) {
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
138 if (stop-start > bounds[1]-bounds[0]) {
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
139 bounds[0] = start;
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
140 bounds[1] = stop;
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
141 if (logger.isDebugEnabled()) {
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
142 logger.debug("new range: " +
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
143 bounds[0] + " - " + bounds[1] + " (" +
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
144 w.getQuick(bounds[0]) + ", " +
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
145 w.getQuick(bounds[1]) + ")");
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
146
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
147 }
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
148 }
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
149 start = stop = i;
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
150 }
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
151 else {
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
152 stop = i;
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
153 }
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
154 lastW = v;
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
155 }
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
156
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
157 if (stop-start > bounds[1]-bounds[0]) {
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
158 bounds[0] = start;
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
159 bounds[1] = stop;
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
160 if (logger.isDebugEnabled()) {
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
161 logger.debug("new range @end: " +
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
162 bounds[0] + " - " + bounds[1] + " (" +
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
163 w.getQuick(bounds[0]) + ", " +
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
164 w.getQuick(bounds[1]) + ")");
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
165
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
166 }
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
167 }
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
168
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
169 return bounds;
821aaceb2776 Fix for flys/issue191
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 926
diff changeset
170 }
726
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
171 }
cbaa3ca86f2f Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
172 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org