Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QKmsImpl.java @ 5200:42bb6ff78d1b 2.9.11
Directly set the connectionInitSqls on the datasource
Somehow the factory fails to set the connectionInitSqls if
we add it to the dbcpProperties. So we now set it directly
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 08 Mar 2013 11:48:33 +0100 |
parents | bcf25d8c183e |
children |
rev | line source |
---|---|
4817
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
2 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
3 import gnu.trove.TDoubleArrayList; |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
4 |
4821
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4817
diff
changeset
|
5 import de.intevation.flys.utils.DoubleUtil; |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4817
diff
changeset
|
6 |
4817
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
7 public class QKmsImpl |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
8 extends NamedObjectImpl |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
9 implements QKms |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
10 { |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
11 protected TDoubleArrayList kms; |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
12 protected TDoubleArrayList qs; |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
13 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
14 public QKmsImpl() { |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
15 super(""); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
16 kms = new TDoubleArrayList(); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
17 qs = new TDoubleArrayList(); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
18 } |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
19 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
20 public QKmsImpl(String name) { |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
21 super(name); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
22 kms = new TDoubleArrayList(); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
23 qs = new TDoubleArrayList(); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
24 } |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
25 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
26 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
27 public QKmsImpl(int capacity) { |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
28 super(""); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
29 kms = new TDoubleArrayList(capacity); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
30 qs = new TDoubleArrayList(capacity); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
31 } |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
32 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
33 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
34 public QKmsImpl(TDoubleArrayList kms, TDoubleArrayList qs) { |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
35 this(kms, qs, ""); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
36 } |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
37 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
38 public QKmsImpl( |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
39 TDoubleArrayList kms, |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
40 TDoubleArrayList qs, |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
41 String name |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
42 ) { |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
43 super(name); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
44 this.kms = kms; |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
45 this.qs = qs; |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
46 } |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
47 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
48 public void add(double km, double q) { |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
49 kms.add(km); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
50 qs .add(q); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
51 } |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
52 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
53 @Override |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
54 public double getQ(int index) { |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
55 return qs.getQuick(index); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
56 } |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
57 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
58 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
59 @Override |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
60 public double getKm(int index) { |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
61 return kms.getQuick(index); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
62 } |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
63 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
64 @Override |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
65 public int size() { |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
66 return kms.size(); |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
67 } |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
68 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
69 @Override |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
70 public TDoubleArrayList allKms() { |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
71 return kms; |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
72 } |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
73 |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
74 @Override |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
75 public TDoubleArrayList allQs() { |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
76 return qs; |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
77 } |
4821
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4817
diff
changeset
|
78 |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4817
diff
changeset
|
79 public void removeNaNs() { |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4817
diff
changeset
|
80 DoubleUtil.removeNaNs(new TDoubleArrayList [] { kms, qs }); |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4817
diff
changeset
|
81 } |
4817
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
82 } |