Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/HistoricalDischargeCurveFacet.java @ 4255:670e98f5a441
Fixed leak while merging facets.
The ThemeList that is used by OutputHelper to sort the
Facets for an Output now uses a list to store the ManagedFacets.
The correct order is made up by sorting the List using
Collections.sort() function of the Java JDK. Therfore, the
ManagedFacet class implements the Comparable interface. The
return value of its compareTo(other) method depends on the
value of the 'position' field.
author | Ingo Weinzierl <weinzierl.ingo@googlemail.com> |
---|---|
date | Thu, 25 Oct 2012 14:01:46 +0200 |
parents | 49cb65d5932d |
children |
rev | line source |
---|---|
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import de.intevation.artifactdatabase.state.Facet; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import de.intevation.artifacts.Artifact; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.artifacts.CallContext; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.flys.artifacts.FLYSArtifact; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 /** |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 */ |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 public class HistoricalDischargeCurveFacet extends DataFacet { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 public HistoricalDischargeCurveFacet() { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 public HistoricalDischargeCurveFacet(int index, String name, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 String description, ComputeType type, String stateID, String hash |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 ) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 super(index, name, description, type, hash, stateID); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 @Override |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 public Facet deepCopy() { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 WaterlevelFacet copy = new WaterlevelFacet(); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 copy.set(this); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 copy.type = type; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 copy.hash = hash; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 copy.stateId = stateId; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 return copy; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 @Override |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 public Object getData(Artifact artifact, CallContext context) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 FLYSArtifact flys = (FLYSArtifact) artifact; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 CalculationResult res = (CalculationResult) flys.compute(context, hash, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 stateId, type, false); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 HistoricalDischargeData data = (HistoricalDischargeData) res.getData(); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 WQKms[] wqkms = (WQKms[]) data.getWQs(); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 return wqkms[index]; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |