Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WWQQ.java @ 2424:092e519ff461
merged flys-artifacts/2.6.1
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:26 +0200 |
parents | 3973a2451cf7 |
children | 5642a83420f2 |
comparison
equal
deleted
inserted
replaced
2392:8112ec686a9a | 2424:092e519ff461 |
---|---|
1 package de.intevation.flys.artifacts.model; | |
2 | |
3 import de.intevation.flys.artifacts.math.Identity; | |
4 | |
5 import gnu.trove.TDoubleArrayList; | |
6 | |
7 public class WWQQ | |
8 extends WW | |
9 { | |
10 public static class ApplyFunctionIterator | |
11 extends WW.ApplyFunctionIterator | |
12 { | |
13 public ApplyFunctionIterator(WWQQ ww) { | |
14 super(ww, Identity.IDENTITY, Identity.IDENTITY); | |
15 } | |
16 | |
17 @Override | |
18 public void get(int idx, double [] wwqqPair) { | |
19 WWQQ wwqq = (WWQQ)ww; | |
20 wwqqPair[0] = function1.value(wwqq.getW(idx)); | |
21 wwqqPair[1] = function2.value(wwqq.getW2(idx)); | |
22 wwqqPair[2] = wwqq.getQ1(idx); | |
23 wwqqPair[3] = wwqq.getQ2(idx); | |
24 } | |
25 } // class ApplyFunctionIterator | |
26 | |
27 protected TDoubleArrayList qs1; | |
28 protected TDoubleArrayList qs2; | |
29 | |
30 public WWQQ() { | |
31 this(""); | |
32 } | |
33 | |
34 public WWQQ(String name) { | |
35 super(name); | |
36 } | |
37 | |
38 public WWQQ(int capacity) { | |
39 this(capacity, ""); | |
40 } | |
41 | |
42 public WWQQ(int capacity, String name) { | |
43 super(capacity, name); | |
44 } | |
45 | |
46 public WWQQ( | |
47 String name, | |
48 double startKm, | |
49 Double startDatum, | |
50 double [] ws1, | |
51 double [] qs1, | |
52 double endKm, | |
53 Double endDatum, | |
54 double [] ws2, | |
55 double [] qs2 | |
56 ) { | |
57 super(name, startKm, startDatum, ws1, endKm, endDatum, ws2); | |
58 this.qs1 = new TDoubleArrayList(qs1); | |
59 this.qs2 = new TDoubleArrayList(qs2); | |
60 } | |
61 | |
62 public double getQ1(int idx) { | |
63 return qs1.getQuick(idx); | |
64 } | |
65 | |
66 public double getQ2(int idx) { | |
67 return qs2.getQuick(idx); | |
68 } | |
69 | |
70 public double [] getQs1() { | |
71 return qs1.toNativeArray(); | |
72 } | |
73 | |
74 public double [] getQs2() { | |
75 return qs2.toNativeArray(); | |
76 } | |
77 | |
78 @Override | |
79 public double [] get(int idx) { | |
80 return get(idx, new double[4]); | |
81 } | |
82 | |
83 @Override | |
84 public double [] get(int idx, double [] dst) { | |
85 dst[0] = ws .getQuick(idx); | |
86 dst[1] = ws2.getQuick(idx); | |
87 dst[2] = qs1.getQuick(idx); | |
88 dst[3] = qs2.getQuick(idx); | |
89 return dst; | |
90 } | |
91 | |
92 @Override | |
93 public void removeNaNs() { | |
94 removeNaNs(new TDoubleArrayList [] { ws, ws2, qs1, qs2 }); | |
95 } | |
96 } | |
97 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |