annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java @ 4382:3937c6a85db4

Removed superfluous imports.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 02 Nov 2012 17:26:16 +0100
parents 8d568bc22765
children 193f11d20bd8
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
4367
8d568bc22765 Even better Extreme W/Q Facet names. i18n thereof.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4360
diff changeset
21 import de.intevation.flys.artifacts.resources.Resources;
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 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
23
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 import java.util.List;
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 import org.apache.log4j.Logger;
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27
4043
eb5564662e19 Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3775
diff changeset
28 /** 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
29 public class ExtremeCompute
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 extends DefaultState
4302
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
31 implements FacetTypes
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 {
4043
eb5564662e19 Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3775
diff changeset
33 /** Private logger. */
4301
1f304cb5729b ExtremeCompute: Renamed log to logger.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4043
diff changeset
34 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
35
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 public ExtremeCompute() {
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 }
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 @Override
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 public Object computeAdvance(
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 FLYSArtifact artifact,
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 String hash,
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 CallContext context,
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 List<Facet> facets,
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45 Object old
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 ) {
4301
1f304cb5729b ExtremeCompute: Renamed log to logger.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4043
diff changeset
47 logger.debug("ExtremeCompute.computeAdvance");
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 CalculationResult res;
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 ExtremeAccess access = new ExtremeAccess(artifact);
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 if (old instanceof CalculationResult) {
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 res = (CalculationResult)old;
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 }
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 else {
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 ExtremeCalculation calc = new ExtremeCalculation(access);
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 res = calc.calculate();
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 }
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 if (facets == null) {
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 return res;
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63 }
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 if (res.getReport().hasProblems()) {
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 facets.add(new ReportFacet());
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 }
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68
4302
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
69 ExtremeResult eres = (ExtremeResult) res.getData();
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
70 WQKms [] wqkms = (WQKms []) eres.getWQKms();
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
71
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
72 if (wqkms == null) {
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
73 logger.error("No computation result!");
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
74 }
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 for (int i = 0; i < wqkms.length; i++) {
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
77 String name = wqkms[i].getName();
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
78
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
79 Facet w = new WaterlevelFacet(
4356
375550eb45b7 ExtremeCompute: Improve naming of facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4344
diff changeset
80 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
81 Facet q = new WaterlevelFacet(
4356
375550eb45b7 ExtremeCompute: Improve naming of facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4344
diff changeset
82 i, LONGITUDINAL_Q, name, ComputeType.ADVANCE, id, hash);
4302
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
83
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
84 // TODO add more facets like:
4315
e7b923cf3a9c ExtremeCompute: Add ExtremeCurveFacet in this state.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4302
diff changeset
85 // csv, data, pdf wst facet, data facet
4302
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
86 // furthermore, waterlevel
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
87 //facets.add(new CrossSectionWaterLineFacet(i, nameW));
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
88
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
89 facets.add(w);
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
90 facets.add(q);
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
91 }
ce10b846bc86 ExtremeCompute: Generate LS-Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4301
diff changeset
92
4367
8d568bc22765 Even better Extreme W/Q Facet names. i18n thereof.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4360
diff changeset
93 facets.add(new ExtremeCurveFacet(Resources.getMsg(context.getMeta(),
8d568bc22765 Even better Extreme W/Q Facet names. i18n thereof.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4360
diff changeset
94 "extreme_wq_curve", "extreme_wq_curve")));
8d568bc22765 Even better Extreme W/Q Facet names. i18n thereof.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4360
diff changeset
95 facets.add(new ExtremeCurveFacet(Resources.getMsg(context.getMeta(),
8d568bc22765 Even better Extreme W/Q Facet names. i18n thereof.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4360
diff changeset
96 "extreme_wq_base_curve", "extreme_wq_base_curve")
8d568bc22765 Even better Extreme W/Q Facet names. i18n thereof.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4360
diff changeset
97 , true));
3775
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 return res;
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100 }
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
101 }
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org