comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/DifferenceCurveFacet.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/DifferenceCurveFacet.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.artifactdatabase.state.Facet;
6 import org.dive4elements.artifacts.Artifact;
7 import org.dive4elements.artifacts.CallContext;
8 import org.dive4elements.river.artifacts.WINFOArtifact;
9 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
10
11
12 /**
13 * Facet with the curve of a subtraction of two waterlevel-lines.
14 * TODO inherit directly from DataFacet? Check whether this Facet is obsolete.
15 */
16 public class DifferenceCurveFacet extends WaterlevelFacet {
17
18 private static Logger logger = Logger.getLogger(DifferenceCurveFacet.class);
19
20
21 public DifferenceCurveFacet() {
22 }
23
24 public DifferenceCurveFacet(
25 int index,
26 String name,
27 String description,
28 ComputeType type,
29 String stateID,
30 String hash
31
32 ) {
33 super(index, name, description, type, stateID, hash);
34 }
35
36 /**
37 * Get difference curve data.
38 * @return a WKms at given index.
39 */
40 @Override
41 public Object getData(Artifact artifact, CallContext context) {
42 WINFOArtifact winfo = (WINFOArtifact)artifact;
43
44 CalculationResult res = (CalculationResult)
45 winfo.compute(context, hash, stateId, type, false);
46
47 WKms [] wkms = (WKms [])res.getData();
48
49 WKms result = wkms[index];
50 logger.debug("Got difference curve data (" + result.getName()
51 + ") at index: " + index);
52
53 return result;
54 }
55
56
57 /** Copy deeply. */
58 @Override
59 public Facet deepCopy() {
60 WaterlevelFacet copy = new DifferenceCurveFacet();
61 copy.set(this);
62 copy.type = type;
63 copy.stateId = stateId;
64 copy.hash = hash;
65 return copy;
66 }
67 }
68 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org