Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceCurveState.java @ 2230:59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
flys-artifacts/trunk@3872 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 01 Feb 2012 15:41:11 +0000 |
parents | 606f4fd7f815 |
children | c9c788eea200 |
rev | line source |
---|---|
2170
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states; |
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
3 import de.intevation.artifactdatabase.state.Facet; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
4 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
5 import de.intevation.artifacts.CallContext; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
6 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
7 import de.intevation.flys.artifacts.FLYSArtifact; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
8 import de.intevation.flys.artifacts.WINFOArtifact; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
9 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
10 import de.intevation.flys.artifacts.model.CalculationResult; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
11 import de.intevation.flys.artifacts.model.FacetTypes; |
2222
606f4fd7f815
Add more-or-less dummy Facet in ReferenceCurveState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2195
diff
changeset
|
12 import de.intevation.flys.artifacts.model.ReferenceCurveFacet; |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
13 import de.intevation.flys.artifacts.model.ReportFacet; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
14 import de.intevation.flys.artifacts.model.WW; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
15 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
16 import java.util.List; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
17 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
18 import org.apache.log4j.Logger; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
19 |
2170
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 public class ReferenceCurveState |
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 extends DefaultState |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
22 implements FacetTypes |
2170
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 { |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
24 private static Logger log = Logger.getLogger(ReferenceCurveState.class); |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
25 |
2170
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 public ReferenceCurveState() { |
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 } |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
28 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
29 @Override |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
30 public Object computeAdvance( |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
31 FLYSArtifact artifact, |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
32 String hash, |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
33 CallContext context, |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
34 List<Facet> facets, |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
35 Object old |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
36 ) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
37 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
38 if (!(artifact instanceof WINFOArtifact)) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
39 return null; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
40 } |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
41 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
42 WINFOArtifact winfo = (WINFOArtifact)artifact; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
43 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
44 CalculationResult res = old instanceof CalculationResult |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
45 ? (CalculationResult)old |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
46 : winfo.getReferenceCurveData(); |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
47 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
48 if (facets == null) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
49 return res; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
50 } |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
51 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
52 WW [] wws = (WW [])res.getData(); |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
53 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
54 for (int i = 0; i < wws.length; ++i) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
55 // TODO: Add data facets. |
2222
606f4fd7f815
Add more-or-less dummy Facet in ReferenceCurveState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2195
diff
changeset
|
56 facets.add(new ReferenceCurveFacet(i, REFERENCE_CURVE, REFERENCE_CURVE)); |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
57 } |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
58 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
59 if (wws.length > 0) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
60 // TODO: Add CSV/PDF facets. |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
61 } |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
62 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
63 if (res.getReport().hasProblems()) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
64 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id)); |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
65 } |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
66 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
67 return res; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
68 } |
2170
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 } |
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |