Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDensityFacet.java @ 4357:11cf29eb002c
FacetTypes: New type: exreme_wq_curve_base (for the Stuetz-Q-Poits).
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 02 Nov 2012 11:58:11 +0100 |
parents | 9f9d5ada96ca |
children |
rev | line source |
---|---|
3757
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model.minfo; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.artifactdatabase.state.Facet; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifacts.Artifact; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.artifacts.CallContext; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.artifacts.FLYSArtifact; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.flys.artifacts.model.CalculationResult; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.flys.artifacts.model.DataFacet; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 /** |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 * Facet for serving bed density data. |
3772
5a8f8fd5310c
The usual wipe after for ill configured Eclipses.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3757
diff
changeset
|
16 * |
3757
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 */ |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 public class BedDensityFacet extends DataFacet { |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 private static final long serialVersionUID = 1L; |
3772
5a8f8fd5310c
The usual wipe after for ill configured Eclipses.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3757
diff
changeset
|
22 |
3757
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 private static Logger logger = Logger.getLogger(BedDensityFacet.class); |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 public BedDensityFacet() { |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 } |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 public BedDensityFacet(int idx, String name, String description, |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 ComputeType type, String stateId, String hash) { |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 super(idx, name, description, type, hash, stateId); |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 } |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 public Object getData(Artifact artifact, CallContext context) { |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 logger.debug("Get data for bed density at index: " + index); |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 FLYSArtifact flys = (FLYSArtifact) artifact; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 CalculationResult res = (CalculationResult) flys.compute(context, hash, |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 stateId, type, false); |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
3784
9f9d5ada96ca
Merged revisions 5498-5499 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3772
diff
changeset
|
41 int ndx = index >> 8; |
9f9d5ada96ca
Merged revisions 5498-5499 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3772
diff
changeset
|
42 Object[] data = |
9f9d5ada96ca
Merged revisions 5498-5499 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3772
diff
changeset
|
43 ((BedQualityResult[]) res.getData())[ndx].getParameters(); // TODO CAST TO SPECIFIC CLASS |
3757
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
3784
9f9d5ada96ca
Merged revisions 5498-5499 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3772
diff
changeset
|
45 int ndy = index & 255; |
9f9d5ada96ca
Merged revisions 5498-5499 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3772
diff
changeset
|
46 return data != null && data.length > ndy ? data[ndy] : null; |
3757
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 } |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 /** Copy deeply. */ |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 @Override |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 public Facet deepCopy() { |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 BedDensityFacet copy = new BedDensityFacet(); |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 copy.set(this); |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 copy.type = type; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 copy.hash = hash; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 copy.stateId = stateId; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 return copy; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 } |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 } |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |