Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDensityFacet.java @ 5831:bd047b71ab37
Repaired internal references
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 12:06:39 +0200 |
parents | flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDensityFacet.java@9f9d5ada96ca |
children |
comparison
equal
deleted
inserted
replaced
5830:160f53ee0870 | 5831:bd047b71ab37 |
---|---|
1 package org.dive4elements.river.artifacts.model.minfo; | |
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.FLYSArtifact; | |
9 import org.dive4elements.river.artifacts.model.CalculationResult; | |
10 import org.dive4elements.river.artifacts.model.DataFacet; | |
11 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; | |
12 | |
13 | |
14 /** | |
15 * Facet for serving bed density data. | |
16 * | |
17 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
18 */ | |
19 public class BedDensityFacet extends DataFacet { | |
20 | |
21 private static final long serialVersionUID = 1L; | |
22 | |
23 private static Logger logger = Logger.getLogger(BedDensityFacet.class); | |
24 | |
25 public BedDensityFacet() { | |
26 } | |
27 | |
28 public BedDensityFacet(int idx, String name, String description, | |
29 ComputeType type, String stateId, String hash) { | |
30 super(idx, name, description, type, hash, stateId); | |
31 } | |
32 | |
33 public Object getData(Artifact artifact, CallContext context) { | |
34 logger.debug("Get data for bed density at index: " + index); | |
35 | |
36 FLYSArtifact flys = (FLYSArtifact) artifact; | |
37 | |
38 CalculationResult res = (CalculationResult) flys.compute(context, hash, | |
39 stateId, type, false); | |
40 | |
41 int ndx = index >> 8; | |
42 Object[] data = | |
43 ((BedQualityResult[]) res.getData())[ndx].getParameters(); // TODO CAST TO SPECIFIC CLASS | |
44 | |
45 int ndy = index & 255; | |
46 return data != null && data.length > ndy ? data[ndy] : null; | |
47 } | |
48 | |
49 /** Copy deeply. */ | |
50 @Override | |
51 public Facet deepCopy() { | |
52 BedDensityFacet copy = new BedDensityFacet(); | |
53 copy.set(this); | |
54 copy.type = type; | |
55 copy.hash = hash; | |
56 copy.stateId = stateId; | |
57 return copy; | |
58 } | |
59 } | |
60 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |