comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeDischargeFacet.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeDischargeFacet.java@bd047b71ab37
children 4897a58c8746
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 package org.dive4elements.river.artifacts.model;
2
3 import org.apache.log4j.Logger;
4
5 import org.dive4elements.artifacts.Artifact;
6 import org.dive4elements.artifacts.CallContext;
7
8 import org.dive4elements.artifactdatabase.state.Facet;
9
10 import org.dive4elements.river.artifacts.FLYSArtifact;
11 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
12
13
14 /**
15 * Access Discharge Curve of a gauge.
16 */
17 public class GaugeDischargeFacet extends DataFacet {
18
19 /** Private logger. */
20 private static final Logger logger =
21 Logger.getLogger(GaugeDischargeFacet.class);
22
23
24 public GaugeDischargeFacet() {
25 }
26
27
28 /**
29 * @param index Index translates to index of WQ-array.
30 * @param name Name of the facet.
31 * @param desc Description of the facet (visible in client).
32 */
33 public GaugeDischargeFacet(int index, String name, String desc) {
34 super(index, name, desc, ComputeType.ADVANCE, null,
35 "state.gaugedischarge.init");
36 }
37
38
39 public GaugeDischargeFacet(
40 int index,
41 String name,
42 String description,
43 ComputeType type,
44 String stateID,
45 String hash
46
47 ) {
48 super(index, name, description, type, hash, stateID);
49 }
50
51
52 @Override
53 public Facet deepCopy() {
54 GaugeDischargeFacet copy = new GaugeDischargeFacet();
55 copy.set(this);
56 copy.type = type;
57 copy.hash = hash;
58 copy.stateId = stateId;
59 return copy;
60 }
61
62
63 /**
64 * @return wqkms corresponding to gauge of artifact and index of facet.
65 */
66 @Override
67 public Object getData(Artifact artifact, CallContext context) {
68 if (logger.isDebugEnabled()) {
69 logger.debug("Get data for discharge curves at index: " +
70 index + " / stateId: " + stateId);
71 }
72
73 if (stateId == null) {
74 logger.error("GaugeDischargeFacet.getData: stateId is null.");
75 }
76 FLYSArtifact flys = (FLYSArtifact) artifact;
77
78 CalculationResult res = (CalculationResult)
79 flys.compute(context, hash, stateId, type, true);
80
81 WQKms[] discharge = (WQKms[]) res.getData();
82
83 return discharge[index];
84 }
85 }
86 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org