Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixWaterlevelFacet.java @ 5712:84e02b3f7a4f
Avoid NPE in sediment density factory and return a valid density if no exists.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Mon, 15 Apr 2013 17:04:38 +0200 |
parents | bae2b1568f3d |
children |
rev | line source |
---|---|
3461
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model.fixings; |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import de.intevation.artifactdatabase.state.Facet; |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.flys.artifacts.model.CalculationResult; |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.flys.artifacts.model.WQKms; |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.artifacts.model.WaterlevelFacet; |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
5644 | 11 /** Waterlevel from fix realize compute. */ |
3461
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 public class FixWaterlevelFacet |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 extends WaterlevelFacet |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 { |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 public FixWaterlevelFacet() { |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 } |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 public FixWaterlevelFacet(int index, String name, String description) { |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 super(index, name, description, ComputeType.ADVANCE, null, null); |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 } |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 public FixWaterlevelFacet( |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 int index, |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 String name, |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 String description, |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 ComputeType type, |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 String stateID, |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 String hash |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 ) { |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 super(index, name, description, type, hash, stateID); |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 } |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 @Override |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 protected WQKms [] getWQKms(CalculationResult res) { |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 FixRealizingResult fr = (FixRealizingResult)res.getData(); |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 return fr != null ? fr.getWQKms() : null; |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 } |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 /** Copy deeply. */ |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 @Override |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 public Facet deepCopy() { |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 FixWaterlevelFacet copy = new FixWaterlevelFacet(); |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 copy.set(this); |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 copy.type = type; |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 copy.hash = hash; |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 copy.stateId = stateId; |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 return copy; |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 } |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 } |
1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |