Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadDiameterFacet.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 bedload diameter 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 BedloadDiameterFacet 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(BedloadDiameterFacet.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 BedloadDiameterFacet() { |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 // required for clone operation deepCopy() |
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 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 public BedloadDiameterFacet(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
|
30 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
|
31 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
|
32 } |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 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
|
35 logger.debug("Get data for bedload diameter at index: " + index); |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 FLYSArtifact flys = (FLYSArtifact) artifact; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 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
|
40 stateId, type, false); |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
3784
9f9d5ada96ca
Merged revisions 5498-5499 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3772
diff
changeset
|
42 int ndx = index >> 8; |
9f9d5ada96ca
Merged revisions 5498-5499 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3772
diff
changeset
|
43 Object[] data = |
9f9d5ada96ca
Merged revisions 5498-5499 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3772
diff
changeset
|
44 ((BedQualityResult[]) res.getData())[ndx].getBedloadResults(); // 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
|
45 |
3784
9f9d5ada96ca
Merged revisions 5498-5499 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3772
diff
changeset
|
46 int ndy = index & 255; |
9f9d5ada96ca
Merged revisions 5498-5499 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3772
diff
changeset
|
47 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
|
48 } |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 /** Copy deeply. */ |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 @Override |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 public Facet deepCopy() { |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 BedloadDiameterFacet copy = new BedloadDiameterFacet(); |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 copy.set(this); |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 copy.type = type; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 copy.hash = hash; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 copy.stateId = stateId; |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 return copy; |
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 } |
e8a90a5ce624
Added facets and chart generator for bed quality calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |