Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java @ 4356:375550eb45b7
ExtremeCompute: Improve naming of facets.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 02 Nov 2012 09:10:34 +0100 |
parents | c6db11e3b83a |
children | 02d40d832af0 |
rev | line source |
---|---|
3775
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states.extreme; |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import de.intevation.artifactdatabase.state.Facet; |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.artifacts.CallContext; |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.artifacts.FLYSArtifact; |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.flys.artifacts.access.ExtremeAccess; |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.flys.artifacts.model.CalculationResult; |
4302
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
12 import de.intevation.flys.artifacts.model.FacetTypes; |
3775
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.artifacts.model.ReportFacet; |
4302
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
14 import de.intevation.flys.artifacts.model.WaterlevelFacet; |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
15 import de.intevation.flys.artifacts.model.WQKms; |
3775
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
4315
e7b923cf3a9c
ExtremeCompute: Add ExtremeCurveFacet in this state.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4302
diff
changeset
|
17 import de.intevation.flys.artifacts.model.extreme.ExtremeCurveFacet; |
3775
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.flys.artifacts.model.extreme.ExtremeCalculation; |
4302
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
19 import de.intevation.flys.artifacts.model.extreme.ExtremeResult; |
3775
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.flys.artifacts.states.DefaultState; |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 |
4302
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
23 import de.intevation.flys.utils.FLYSUtils; |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
24 |
3775
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 import java.util.List; |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 import org.apache.log4j.Logger; |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 |
4043
eb5564662e19
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3775
diff
changeset
|
29 /** State in which to deliver extreme value analysis result. */ |
3775
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 public class ExtremeCompute |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 extends DefaultState |
4302
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
32 implements FacetTypes |
3775
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 { |
4043
eb5564662e19
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3775
diff
changeset
|
34 /** Private logger. */ |
4301
1f304cb5729b
ExtremeCompute: Renamed log to logger.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4043
diff
changeset
|
35 private static Logger logger = Logger.getLogger(ExtremeCompute.class); |
3775
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 public ExtremeCompute() { |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 } |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 @Override |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 public Object computeAdvance( |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 FLYSArtifact artifact, |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 String hash, |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 CallContext context, |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 List<Facet> facets, |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 Object old |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 ) { |
4301
1f304cb5729b
ExtremeCompute: Renamed log to logger.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4043
diff
changeset
|
48 logger.debug("ExtremeCompute.computeAdvance"); |
3775
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 CalculationResult res; |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 ExtremeAccess access = new ExtremeAccess(artifact); |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 if (old instanceof CalculationResult) { |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 res = (CalculationResult)old; |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 } |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 else { |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 ExtremeCalculation calc = new ExtremeCalculation(access); |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 res = calc.calculate(); |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 } |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 if (facets == null) { |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 return res; |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 } |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 if (res.getReport().hasProblems()) { |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 facets.add(new ReportFacet()); |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 } |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 |
4302
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
70 ExtremeResult eres = (ExtremeResult) res.getData(); |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
71 WQKms [] wqkms = (WQKms []) eres.getWQKms(); |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
72 |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
73 if (wqkms == null) { |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
74 logger.error("No computation result!"); |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
75 } |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
76 |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
77 for (int i = 0; i < wqkms.length; i++) { |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
78 String name = wqkms[i].getName(); |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
79 |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
80 Facet w = new WaterlevelFacet( |
4356
375550eb45b7
ExtremeCompute: Improve naming of facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4344
diff
changeset
|
81 i, LONGITUDINAL_W, "W("+name+")", ComputeType.ADVANCE, id, hash); |
4302
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
82 Facet q = new WaterlevelFacet( |
4356
375550eb45b7
ExtremeCompute: Improve naming of facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4344
diff
changeset
|
83 i, LONGITUDINAL_Q, name, ComputeType.ADVANCE, id, hash); |
4302
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
84 |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
85 // TODO add more facets like: |
4315
e7b923cf3a9c
ExtremeCompute: Add ExtremeCurveFacet in this state.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4302
diff
changeset
|
86 // csv, data, pdf wst facet, data facet |
4302
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
87 // furthermore, waterlevel |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
88 //facets.add(new CrossSectionWaterLineFacet(i, nameW)); |
4315
e7b923cf3a9c
ExtremeCompute: Add ExtremeCurveFacet in this state.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4302
diff
changeset
|
89 facets.add(new ExtremeCurveFacet("WQ")); |
4302
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
90 |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
91 facets.add(w); |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
92 facets.add(q); |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
93 } |
ce10b846bc86
ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4301
diff
changeset
|
94 |
3775
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 return res; |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 } |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 } |
d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |