Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstState.java @ 9313:6ffcbb4f35d5
bundu.bezugswst first result stump
author | gernotbelger |
---|---|
date | Thu, 26 Jul 2018 15:58:08 +0200 |
parents | 1c8eeaf6031f |
children | 7b2b086e45f0 |
rev | line source |
---|---|
9274 | 1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by Intevation GmbH | |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
3 * |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
7 */ |
9274 | 8 |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
9 package org.dive4elements.river.artifacts.bundu.bezugswst; |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
10 |
9274 | 11 import java.util.List; |
12 | |
13 import org.apache.log4j.Logger; | |
14 import org.dive4elements.artifactdatabase.state.Facet; | |
15 import org.dive4elements.artifacts.CallContext; | |
16 import org.dive4elements.river.artifacts.D4EArtifact; | |
9313 | 17 import org.dive4elements.river.artifacts.bundu.BUNDUArtifact; |
9274 | 18 import org.dive4elements.river.artifacts.model.CalculationResult; |
19 import org.dive4elements.river.artifacts.model.DataFacet; | |
20 import org.dive4elements.river.artifacts.model.FacetTypes; | |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
21 import org.dive4elements.river.artifacts.states.DefaultState; |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
22 |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
23 /** |
9274 | 24 * State to compute the fixation realizing (vollmer) results. |
25 * | |
26 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
27 */ |
9274 | 28 public class BezugswstState extends DefaultState implements FacetTypes { |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
29 |
9274 | 30 /* |
31 * TODO: THIS CLASS IS A CLONE OF FixRealizingCompute | |
32 * + | |
33 * ++ | |
34 * +++ | |
35 * ++++ | |
36 * +++++ | |
37 * ++++++ | |
38 * +++++++ | |
39 * ++++++++ | |
40 * +++++++++ | |
41 * ++++++++++ | |
42 * +++++++++++ | |
43 * IT does not work here | |
44 */ | |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
45 |
9274 | 46 /** The log used in this class. */ |
47 private static Logger log = Logger.getLogger(BezugswstState.class); | |
48 | |
49 public static final String I18N_WQ_CURVE = "fix.vollmer.wq.curve"; | |
50 | |
51 public static final String I18N_WQ_OUTLIER = "fix.vollmer.wq.outliers"; | |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
52 |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
53 /** |
9274 | 54 * The default constructor that initializes an empty State object. |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
55 */ |
9274 | 56 public BezugswstState() { |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
57 } |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
58 |
9274 | 59 @Override |
60 public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { | |
61 log.debug("BezugswstState.computeAdvance"); | |
62 | |
9313 | 63 // final CalculationResult res; |
64 // | |
65 // final FixRealizingAccess access = new FixRealizingAccess(artifact); | |
66 // | |
67 // if (old instanceof CalculationResult) { | |
68 // res = (CalculationResult) old; | |
69 // } else { | |
70 // | |
71 // final FixRealizingCalculation calc = new FixRealizingCalculation(access); | |
72 // res = calc.calculate(); | |
73 // } | |
74 // | |
75 // if (facets == null) { | |
76 // return res; | |
77 // } | |
78 // | |
79 // if (res.getReport().hasProblems()) { | |
80 // facets.add(new ReportFacet()); | |
81 // } | |
82 // | |
83 // final String id = getID(); | |
84 // final CallMeta meta = context.getMeta(); | |
85 // | |
86 // final FixRealizingResult fixRes = (FixRealizingResult) res.getData(); | |
87 // final WQKms[] wqkms = fixRes != null ? fixRes.getWQKms() : new WQKms[0]; | |
88 // | |
89 // for (int i = 0; i < wqkms.length; i++) { | |
90 // String nameW = null; | |
91 // String nameQ = null; | |
92 // | |
93 // if (access.isQ()) { | |
94 // nameQ = wqkms[i].getName(); | |
95 // nameW = "W(" + nameQ + ")"; | |
96 // } else { | |
97 // nameW = wqkms[i].getName(); | |
98 // nameQ = "Q(" + nameW + ")"; | |
99 // } | |
100 // | |
101 // final Facet wq = new FixWaterlevelFacet(i, FIX_WQ_LS, nameW, ComputeType.ADVANCE, hash, id); | |
102 // | |
103 // final Facet w = new FixWaterlevelFacet(i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, hash, id); | |
104 // | |
105 // final Facet q = new FixWaterlevelFacet(i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, hash, id); | |
106 // final Facet csFacet = new CrossSectionWaterLineFacet(i, nameW); | |
107 // | |
108 // facets.add(wq); | |
109 // facets.add(w); | |
110 // facets.add(q); | |
111 // facets.add(csFacet); | |
112 // | |
113 // // XXX: THIS CAN NOT HAPPEN! REMOVE IT! | |
114 // if (wqkms[i] instanceof WQCKms) { | |
115 // final String nameC = nameW.replace("benutzerdefiniert", "benutzerdefiniert [korrigiert]"); | |
116 // | |
117 // final Facet c = new FixWaterlevelFacet(i, DISCHARGE_LONGITUDINAL_C, nameC); | |
118 // | |
119 // facets.add(c); | |
120 // } | |
121 // } | |
122 // | |
123 // if (wqkms.length > 0) { | |
124 // final DateFormat df = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy"); | |
125 // final DateFormat lf = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy'T'HH:mm"); | |
126 // | |
127 // final Collection<Date> reds = fixRes.getReferenceEventsDates(); | |
128 // final UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, reds); | |
129 // | |
130 // int i = 0; | |
131 // for (final Date d : reds) { | |
132 // facets.add(new FixReferenceEventsFacet((1 << 9) | i, FIX_EVENTS, cf.format(d))); | |
133 // i++; | |
134 // } | |
135 // | |
136 // facets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); | |
137 // | |
138 // facets.add(new DataFacet(WST, "WST data", ComputeType.ADVANCE, hash, id)); | |
139 // | |
140 // facets.add(new DataFacet(PDF, "PDF data", ComputeType.ADVANCE, hash, id)); | |
141 // } | |
142 // | |
143 // facets.add(new DataFacet(AT, "AT data", ComputeType.ADVANCE, hash, id)); | |
144 // | |
145 // facets.add(new FixWQCurveFacet(0, Resources.getMsg(meta, I18N_WQ_CURVE, I18N_WQ_CURVE) + " (" + access.getFunction() | |
146 // + ")")); | |
147 // | |
148 // if (access.getPreprocessing()) { | |
149 // facets.add(new FixOutlierFacet(0, FIX_OUTLIER, Resources.getMsg(meta, I18N_WQ_OUTLIER, I18N_WQ_OUTLIER))); | |
150 // } | |
151 return compute((BUNDUArtifact) artifact, context, hash, facets, old); | |
152 } | |
9274 | 153 |
9313 | 154 @Override |
155 public Object computeFeed(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { | |
9274 | 156 |
9313 | 157 return compute((BUNDUArtifact) artifact, context, hash, facets, old); |
158 } | |
9274 | 159 |
9313 | 160 private Object compute(final BUNDUArtifact artifact, final CallContext context, final String hash, final List<Facet> facets, final Object old) { |
9274 | 161 |
9313 | 162 final BezugswstCalculation s = new BezugswstCalculation(context); |
163 final CalculationResult res = s.calculate(artifact); | |
9274 | 164 |
9313 | 165 if (facets == null) |
166 return res; | |
9274 | 167 |
9313 | 168 // if (!((List<Facet>) res).isEmpty()) { |
169 final Facet csv = new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id); | |
170 final Facet pdf = new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id); | |
171 | |
172 facets.add(csv); | |
173 facets.add(pdf); | |
174 // } | |
9274 | 175 |
176 return res; | |
177 } | |
9313 | 178 |
9274 | 179 } |