Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineResultFacet.java @ 9295:385b52ccde23
Work on U-Info salix line calculation and chart (no scenario case)
author | mschaefer |
---|---|
date | Tue, 24 Jul 2018 18:51:47 +0200 |
parents | |
children | 08f46ccd37ba |
comparison
equal
deleted
inserted
replaced
9294:7a8b9331a946 | 9295:385b52ccde23 |
---|---|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU AGPL (>=v3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
6 * documentation coming with Dive4Elements River for details. | |
7 */ | |
8 | |
9 package org.dive4elements.river.artifacts.uinfo.salix; | |
10 | |
11 import org.apache.log4j.Logger; | |
12 import org.dive4elements.artifactdatabase.state.Facet; | |
13 import org.dive4elements.artifacts.Artifact; | |
14 import org.dive4elements.artifacts.CallContext; | |
15 import org.dive4elements.river.artifacts.D4EArtifact; | |
16 import org.dive4elements.river.artifacts.common.AbstractCalculationResult; | |
17 import org.dive4elements.river.artifacts.common.AbstractCalculationResults; | |
18 import org.dive4elements.river.artifacts.model.CalculationResult; | |
19 import org.dive4elements.river.artifacts.model.DataFacet; | |
20 | |
21 /** | |
22 * Facet of the U-Info salix line curve. | |
23 */ | |
24 public class SalixLineResultFacet extends DataFacet { | |
25 | |
26 private static final long serialVersionUID = 1L; | |
27 | |
28 private static Logger log = Logger.getLogger(SalixLineResultFacet.class); | |
29 | |
30 private int resultIndex; | |
31 | |
32 public SalixLineResultFacet() { | |
33 // required for clone operation deepCopy() | |
34 } | |
35 | |
36 public SalixLineResultFacet(final String name, final String description) { | |
37 super(name, description); | |
38 } | |
39 | |
40 @Override | |
41 public final Object getData(final Artifact artifact, final CallContext context) { | |
42 | |
43 log.debug("Get data for result at index: " + this.resultIndex); | |
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 AbstractCalculationResults<AbstractCalculationResult> data = (AbstractCalculationResults<AbstractCalculationResult>) res.getData(); | |
50 | |
51 return data.getResults().get(this.resultIndex); | |
52 } | |
53 | |
54 /** Copy deeply. */ | |
55 @Override | |
56 public Facet deepCopy() { | |
57 // FIXME: why not simply use the full constructor instead? | |
58 final SalixLineResultFacet copy = new SalixLineResultFacet(); | |
59 // FIXME: why does DataFacet does not override set? Bad access to variables of parent! | |
60 copy.set(this); | |
61 copy.type = this.type; | |
62 copy.hash = this.hash; | |
63 copy.stateId = this.stateId; | |
64 return copy; | |
65 } | |
66 } |