Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java @ 3806:881fcd01e056
merged flys-artifacts/pre2.6-2011-11-04
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:50 +0200 |
parents | eb35570df0e8 |
children | e384d78ff78b |
comparison
equal
deleted
inserted
replaced
3802:e831dc29e572 | 3806:881fcd01e056 |
---|---|
1 package de.intevation.flys.artifacts.model; | |
2 | |
3 import org.apache.log4j.Logger; | |
4 | |
5 import de.intevation.artifacts.Artifact; | |
6 import de.intevation.artifacts.CallContext; | |
7 | |
8 import de.intevation.artifactdatabase.state.DefaultFacet; | |
9 import de.intevation.artifactdatabase.state.Facet; | |
10 | |
11 import de.intevation.flys.artifacts.WINFOArtifact; | |
12 | |
13 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; | |
14 | |
15 /** | |
16 * Facet of a Waterlevel (WQKms). | |
17 */ | |
18 public class WaterlevelFacet extends DefaultFacet { | |
19 | |
20 private static Logger logger = Logger.getLogger(WaterlevelFacet.class); | |
21 | |
22 protected ComputeType type; | |
23 protected String stateID; | |
24 protected String hash; | |
25 | |
26 | |
27 public WaterlevelFacet(int index, String name, String description) { | |
28 this(index, name, description, ComputeType.ADVANCE, null, null); | |
29 } | |
30 | |
31 | |
32 public WaterlevelFacet() { | |
33 } | |
34 | |
35 | |
36 public WaterlevelFacet( | |
37 int index, | |
38 String name, | |
39 String description, | |
40 ComputeType type, | |
41 String stateID, | |
42 String hash | |
43 | |
44 ) { | |
45 super(index, name, description); | |
46 this.type = type; | |
47 this.stateID = stateID; | |
48 this.hash = hash; | |
49 } | |
50 | |
51 | |
52 /** | |
53 * Get waterlevel data. | |
54 * @return a WQKms at given index. | |
55 */ | |
56 public Object getData(Artifact artifact, CallContext context) { | |
57 logger.debug("Get data for waterlevels at index: " + index); | |
58 | |
59 WINFOArtifact winfo = (WINFOArtifact)artifact; | |
60 | |
61 CalculationResult res = (CalculationResult) | |
62 winfo.compute(context, hash, stateID, type, false); | |
63 | |
64 WQKms [] wqkms = (WQKms [])res.getData(); | |
65 | |
66 return wqkms[index]; | |
67 } | |
68 | |
69 | |
70 /** Copy deeply. */ | |
71 @Override | |
72 public Facet deepCopy() { | |
73 WaterlevelFacet copy = new WaterlevelFacet(); | |
74 copy.set(this); | |
75 copy.type = type; | |
76 copy.stateID = stateID; | |
77 copy.hash = hash; | |
78 return copy; | |
79 } | |
80 } | |
81 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |