Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WW.java @ 2198:672a41efe222
"Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
flys-artifacts/trunk@3814 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sat, 28 Jan 2012 12:50:03 +0000 |
parents | 5781847433d8 |
children | 4e3bfa2d9584 |
comparison
equal
deleted
inserted
replaced
2197:5781847433d8 | 2198:672a41efe222 |
---|---|
1 package de.intevation.flys.artifacts.model; | 1 package de.intevation.flys.artifacts.model; |
2 | |
3 import de.intevation.flys.artifacts.math.Function; | |
4 import de.intevation.flys.artifacts.math.Identity; | |
2 | 5 |
3 import gnu.trove.TDoubleArrayList; | 6 import gnu.trove.TDoubleArrayList; |
4 | 7 |
5 public class WW | 8 public class WW |
6 extends W | 9 extends W |
7 { | 10 { |
11 public static class ApplyFunctionIterator | |
12 { | |
13 protected Function function1; | |
14 protected Function function2; | |
15 protected int pos; | |
16 protected WW ww; | |
17 | |
18 public ApplyFunctionIterator(WW ww) { | |
19 this.ww = ww; | |
20 this.function1 = Identity.IDENTITY; | |
21 this.function2 = Identity.IDENTITY; | |
22 } | |
23 | |
24 public boolean hasNext() { | |
25 return pos < ww.size(); | |
26 } | |
27 | |
28 public int size() { | |
29 return ww.size(); | |
30 } | |
31 | |
32 public void reset() { | |
33 pos = 0; | |
34 } | |
35 | |
36 public WW getWW() { | |
37 return ww; | |
38 } | |
39 | |
40 public void get(int idx, double [] wwPair) { | |
41 wwPair[0] = function1.value(ww.getW(idx)); | |
42 wwPair[1] = function2.value(ww.getW2(idx)); | |
43 } | |
44 | |
45 public void next(double [] wwPair) { | |
46 get(pos++, wwPair); | |
47 } | |
48 } // class FunctionIterator | |
49 | |
8 protected TDoubleArrayList ws2; | 50 protected TDoubleArrayList ws2; |
9 | 51 |
10 public WW() { | 52 public WW() { |
11 } | 53 } |
12 | 54 |
63 @Override | 105 @Override |
64 public void removeNaNs() { | 106 public void removeNaNs() { |
65 removeNaNs(new TDoubleArrayList [] { ws, ws2 }); | 107 removeNaNs(new TDoubleArrayList [] { ws, ws2 }); |
66 } | 108 } |
67 | 109 |
68 public WW createNormalized() { | 110 public double minWs2() { |
69 | 111 return ws2.min(); |
70 double minW1 = ws. min(); | |
71 double minW2 = ws2.min(); | |
72 | |
73 int N = size(); | |
74 | |
75 TDoubleArrayList ws1c = new TDoubleArrayList(N); | |
76 TDoubleArrayList ws2c = new TDoubleArrayList(N); | |
77 | |
78 for (int i = 0; i < N; ++i) { | |
79 ws1c.add(ws. getQuick(i) - minW1); | |
80 ws2c.add(ws2.getQuick(i) - minW2); | |
81 } | |
82 | |
83 return new WW(getName(), ws1c, ws2c); | |
84 } | 112 } |
85 } | 113 } |
86 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 114 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |