annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeCurveState.java @ 8858:a805211690f7 3.2.x

Fix license headers.
author Tom Gottfried <tom@intevation.de>
date Thu, 18 Jan 2018 20:52:41 +0100
parents 5e38e2924c07
children
rev   line source
8858
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
2 * Software engineering by Intevation GmbH
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
3 *
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
6 * documentation coming with Dive4Elements River for details.
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
7 */
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
8
8302
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 package org.dive4elements.river.artifacts.states;
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 import java.util.List;
8435
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
12 import java.util.Date;
8302
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 import org.dive4elements.artifactdatabase.state.Facet;
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15 import org.dive4elements.artifacts.CallContext;
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 import org.dive4elements.river.artifacts.D4EArtifact;
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 import org.dive4elements.river.artifacts.access.RiverAccess;
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 import org.dive4elements.river.artifacts.model.GaugeDischargeCurveFacet;
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 import org.dive4elements.river.artifacts.resources.Resources;
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20
8435
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
21 import org.dive4elements.river.model.TimeInterval;
8302
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 public class GaugeDischargeCurveState
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 extends DefaultState
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 {
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 @Override
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 public Object computeAdvance(
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 D4EArtifact artifact,
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 String hash,
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 CallContext context,
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 List<Facet> facets,
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 Object old
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 ) {
8435
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
35 String gaugeName = artifact.getDataAsString("gauge_name");
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
36 TimeInterval validity = new RiverAccess(artifact).getRiver()
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
37 .determineGaugeByName(gaugeName).fetchMasterDischargeTable()
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
38 .getTimeInterval();
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
39 Date stopTime = validity.getStopTime();
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
40 String description = Resources.getMsg(
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
41 context.getMeta(),
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8435
diff changeset
42 "chart.discharge.curve.model"
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8435
diff changeset
43 + (stopTime != null ? "" : ".nostop"),
8435
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
44 new Object[] {gaugeName,
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
45 validity.getStartTime(),
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
46 stopTime
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
47 }
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
48 );
6ebad936d82b Unify descriptions of model discharge curve at gauge.
"Tom Gottfried <tom@intevation.de>"
parents: 8302
diff changeset
49
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8435
diff changeset
50 facets.add(new GaugeDischargeCurveFacet("gauge_discharge_curve",
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8435
diff changeset
51 description));
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8435
diff changeset
52 facets.add(new GaugeDischargeCurveFacet("at",
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8435
diff changeset
53 "gauge_discharge_curve"));
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8435
diff changeset
54 facets.add(new GaugeDischargeCurveFacet("csv",
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8435
diff changeset
55 "gauge_discharge_curve"));
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8435
diff changeset
56 facets.add(new GaugeDischargeCurveFacet("pdf",
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8435
diff changeset
57 "gauge_discharge_curve"));
8302
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 return null;
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 }
8578babdb2c8 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 }

http://dive4elements.wald.intevation.org