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