Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalcFacet.java @ 9215:0fc9c82e744e
work on collison, flood_duration
author | gernotbelger |
---|---|
date | Tue, 03 Jul 2018 17:00:48 +0200 |
parents | 3dae6b78e1da |
children | 08f46ccd37ba |
comparison
equal
deleted
inserted
replaced
9214:091fd9676496 | 9215:0fc9c82e744e |
---|---|
9 */ | 9 */ |
10 | 10 |
11 package org.dive4elements.river.artifacts.sinfo.collision; | 11 package org.dive4elements.river.artifacts.sinfo.collision; |
12 | 12 |
13 import org.dive4elements.artifactdatabase.state.Facet; | 13 import org.dive4elements.artifactdatabase.state.Facet; |
14 import org.dive4elements.artifacts.Artifact; | 14 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultFacet; |
15 import org.dive4elements.artifacts.CallContext; | |
16 import org.dive4elements.river.artifacts.D4EArtifact; | |
17 import org.dive4elements.river.artifacts.model.CalculationResult; | |
18 import org.dive4elements.river.artifacts.model.DataFacet; | |
19 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; | 15 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; |
20 | 16 |
21 /** | 17 /** |
22 * Facet for calculated river bed collision counts | 18 * Facet for calculated river bed collision counts |
23 * | 19 * |
24 * @author Matthias Schäfer | 20 * @author Matthias Schäfer |
25 */ | 21 */ |
26 // FIXME: remove | 22 public class CollisionCalcFacet extends SInfoResultFacet { |
27 public class CollisionCalcFacet extends DataFacet { | |
28 | 23 |
29 private static final long serialVersionUID = 1; | 24 private static final long serialVersionUID = 1; |
25 private int year; | |
30 | 26 |
31 public CollisionCalcFacet() { | 27 private CollisionCalcFacet() { |
28 super(); | |
32 // required for clone operation deepCopy() | 29 // required for clone operation deepCopy() |
33 } | 30 } |
34 | 31 |
35 public CollisionCalcFacet(final int idx, final String name, final String description, final String yAxisLabelKey, final ComputeType type, | 32 public CollisionCalcFacet(final int facetIndex, final int resultIndex, final int year, final String name, final String description, |
36 final String stateId, final String hash) { | 33 final String yAxisLabelKey, final ComputeType type, final String hash, final String stateId) { |
37 super(idx, name, description, type, hash, stateId); | 34 super(facetIndex, resultIndex, name, description, yAxisLabelKey, type, stateId, hash); |
38 this.metaData.put("X", "sinfo.chart.km.xaxis.label"); | 35 |
39 this.metaData.put("Y", yAxisLabelKey); | 36 this.year = year; |
40 } | 37 } |
41 | 38 |
42 @Override | 39 public int getYear() { |
43 public Object getData(final Artifact artifact, final CallContext context) { | 40 return this.year; |
44 | |
45 final D4EArtifact flys = (D4EArtifact) artifact; | |
46 | |
47 final CalculationResult res = (CalculationResult) flys.compute(context, this.hash, this.stateId, this.type, false); | |
48 | |
49 final CollisionCalculationResults data = (CollisionCalculationResults) res.getData(); | |
50 | |
51 return data.getResults().get(0); // first result is always the one and only CollisionCalcOverviewResult | |
52 } | 41 } |
53 | 42 |
54 /** Copy deeply. */ | 43 /** Copy deeply. */ |
55 @Override | 44 @Override |
56 public Facet deepCopy() { | 45 public Facet deepCopy() { |
59 // FIXME: why does DataFacet does not override set? Bad access to variables of parent! | 48 // FIXME: why does DataFacet does not override set? Bad access to variables of parent! |
60 copy.set(this); | 49 copy.set(this); |
61 copy.type = this.type; | 50 copy.type = this.type; |
62 copy.hash = this.hash; | 51 copy.hash = this.hash; |
63 copy.stateId = this.stateId; | 52 copy.stateId = this.stateId; |
53 copy.year = this.year; | |
64 return copy; | 54 return copy; |
65 } | 55 } |
66 } | 56 } |