annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixAnalysisCompute.java @ 6844:437d056ce426

Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 15 Aug 2013 18:56:20 +0200
parents a0078e5e3b39
children b87b20c71407
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
9 package org.dive4elements.river.artifacts.states.fixation;
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
11 import java.text.DateFormat;
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
12 import java.util.Collection;
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
13 import java.util.Date;
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
14 import java.util.HashMap;
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
15 import java.util.List;
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
16 import java.util.Map;
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
17
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
18 import org.apache.log4j.Logger;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
19
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
20 import org.dive4elements.artifactdatabase.state.Facet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
21 import org.dive4elements.artifactdatabase.state.FacetActivity;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
22 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
23 import org.dive4elements.artifacts.CallContext;
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
24 import org.dive4elements.river.artifacts.D4EArtifact;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
25 import org.dive4elements.river.artifacts.access.FixAnalysisAccess;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
26 import org.dive4elements.river.artifacts.model.CalculationResult;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
27 import org.dive4elements.river.artifacts.model.DataFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
28 import org.dive4elements.river.artifacts.model.DateRange;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
29 import org.dive4elements.river.artifacts.model.FacetTypes;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
30 import org.dive4elements.river.artifacts.model.ReportFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
31 import org.dive4elements.river.artifacts.model.fixings.FixAnalysisCalculation;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
32 import org.dive4elements.river.artifacts.model.fixings.FixAnalysisEventsFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
33 import org.dive4elements.river.artifacts.model.fixings.FixAnalysisPeriodsFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
34 import org.dive4elements.river.artifacts.model.fixings.FixAnalysisResult;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
35 import org.dive4elements.river.artifacts.model.fixings.FixAvSectorFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
36 import org.dive4elements.river.artifacts.model.fixings.FixDerivateFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
37 import org.dive4elements.river.artifacts.model.fixings.FixDeviationFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
38 import org.dive4elements.river.artifacts.model.fixings.FixLongitudinalAnalysisFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
39 import org.dive4elements.river.artifacts.model.fixings.FixLongitudinalAvSectorFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
40 import org.dive4elements.river.artifacts.model.fixings.FixLongitudinalDeviationFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
41 import org.dive4elements.river.artifacts.model.fixings.FixLongitudinalReferenceFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
42 import org.dive4elements.river.artifacts.model.fixings.FixOutlierFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
43 import org.dive4elements.river.artifacts.model.fixings.FixReferenceEventsFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
44 import org.dive4elements.river.artifacts.model.fixings.FixWQCurveFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
45 import org.dive4elements.river.artifacts.resources.Resources;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
46 import org.dive4elements.river.artifacts.states.DefaultState;
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
47 import org.dive4elements.river.utils.Formatter;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5646
diff changeset
48 import org.dive4elements.river.utils.IdGenerator;
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50 /**
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 */
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 public class FixAnalysisCompute
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 extends DefaultState
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 implements FacetTypes
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 /** The log used in this class. */
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 private static Logger log = Logger.getLogger(FixAnalysisCompute.class);
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59
3907
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
60 private static final String I18N_REFERENCEPERIOD_SHORT = "fix.reference.period.event.short";
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 private static final String I18N_ANALYSISPERIODS = "fix.analysis.periods";
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 private static final String I18N_DERIVATIVE = "fix.derivative";
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 private static final String I18N_OUTLIER = "fix.outlier";
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
68 private static final String I18N_ANALYSIS = "fix.analysis.short";
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 private static final String I18N_DEVIATION = "fix.deviation";
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72 private static final String I18N_REFERENCEDEVIATION = "fix.reference.deviation";
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73
3907
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
74 private static final String I18N_REFERENCEPERIOD = "state.fix.analysis.referenceperiod";
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
75
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 public static final String [] SECTOR_LABELS = {
5380
75371c9ef472 I1174: Changed label for some themes in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 4866
diff changeset
77 "fix.mnq",
75371c9ef472 I1174: Changed label for some themes in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 4866
diff changeset
78 "fix.mq",
75371c9ef472 I1174: Changed label for some themes in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 4866
diff changeset
79 "fix.mhq",
75371c9ef472 I1174: Changed label for some themes in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 4866
diff changeset
80 "fix.hq5"
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81 };
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82
4166
48e09640e8ec Let fix sector average facets in deltawt-diagrams enter inactively.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3917
diff changeset
83 // TODO Why does this happen here? In other cases its implemented in the
48e09640e8ec Let fix sector average facets in deltawt-diagrams enter inactively.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3917
diff changeset
84 // respective artifact, not State.
3785
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
85 static {
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
86 // Active/deactivate facets.
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
87 FacetActivity.Registry.getInstance().register(
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
88 "fixanalysis",
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
89 new FacetActivity() {
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
90 @Override
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
91 public Boolean isInitialActive(
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
92 Artifact artifact,
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
93 Facet facet,
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
94 String output
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
95 ) {
4166
48e09640e8ec Let fix sector average facets in deltawt-diagrams enter inactively.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3917
diff changeset
96 if (output.contains(FacetTypes.ChartType.FLSC.toString())) {
48e09640e8ec Let fix sector average facets in deltawt-diagrams enter inactively.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3917
diff changeset
97 // Longitudinal section chart
3913
bdf855b5693f Fixing analysis longitudinal section chart has now initially deactivated A1/B facets
Christian Lins <christian.lins@intevation.de>
parents: 3907
diff changeset
98 String name = facet.getName();
3785
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
99
3913
bdf855b5693f Fixing analysis longitudinal section chart has now initially deactivated A1/B facets
Christian Lins <christian.lins@intevation.de>
parents: 3907
diff changeset
100 if (name.contains(FacetTypes.FIX_ANALYSIS_EVENTS_DWT)
bdf855b5693f Fixing analysis longitudinal section chart has now initially deactivated A1/B facets
Christian Lins <christian.lins@intevation.de>
parents: 3907
diff changeset
101 || name.contains(FacetTypes.FIX_ANALYSIS_EVENTS_LS)
bdf855b5693f Fixing analysis longitudinal section chart has now initially deactivated A1/B facets
Christian Lins <christian.lins@intevation.de>
parents: 3907
diff changeset
102 || name.contains(FacetTypes.FIX_ANALYSIS_EVENTS_WQ)
bdf855b5693f Fixing analysis longitudinal section chart has now initially deactivated A1/B facets
Christian Lins <christian.lins@intevation.de>
parents: 3907
diff changeset
103 || name.contains(FacetTypes.FIX_REFERENCE_EVENTS_DWT)
bdf855b5693f Fixing analysis longitudinal section chart has now initially deactivated A1/B facets
Christian Lins <christian.lins@intevation.de>
parents: 3907
diff changeset
104 || name.contains(FacetTypes.FIX_REFERENCE_EVENTS_LS)
bdf855b5693f Fixing analysis longitudinal section chart has now initially deactivated A1/B facets
Christian Lins <christian.lins@intevation.de>
parents: 3907
diff changeset
105 || name.contains(FacetTypes.FIX_REFERENCE_EVENTS_WQ)
bdf855b5693f Fixing analysis longitudinal section chart has now initially deactivated A1/B facets
Christian Lins <christian.lins@intevation.de>
parents: 3907
diff changeset
106 ) {
bdf855b5693f Fixing analysis longitudinal section chart has now initially deactivated A1/B facets
Christian Lins <christian.lins@intevation.de>
parents: 3907
diff changeset
107 return Boolean.FALSE;
bdf855b5693f Fixing analysis longitudinal section chart has now initially deactivated A1/B facets
Christian Lins <christian.lins@intevation.de>
parents: 3907
diff changeset
108 }
3785
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
109 }
4433
5b8919ef601d Backed out changeset e8a4d2fd25cc
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4432
diff changeset
110 if (output.contains(FacetTypes.ChartType.FDWC.toString())
4166
48e09640e8ec Let fix sector average facets in deltawt-diagrams enter inactively.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3917
diff changeset
111 && facet.getName().contains(FacetTypes.FIX_SECTOR_AVERAGE_DWT)) {
48e09640e8ec Let fix sector average facets in deltawt-diagrams enter inactively.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3917
diff changeset
112 return Boolean.FALSE;
48e09640e8ec Let fix sector average facets in deltawt-diagrams enter inactively.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3917
diff changeset
113 }
3785
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
114
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
115 return Boolean.TRUE;
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
116 }
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
117 });
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
118 }
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
119
5646
14009b194871 Doc, Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5380
diff changeset
120
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
121 /**
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
122 * The default constructor that initializes an empty State object.
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
123 */
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
124 public FixAnalysisCompute() {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
125 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
126
5646
14009b194871 Doc, Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5380
diff changeset
127
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
128 @Override
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
129 public Object computeAdvance(
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
130 D4EArtifact artifact,
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
131 String hash,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
132 CallContext context,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
133 List<Facet> facets,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
134 Object old
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
135 ) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
136 log.debug("FixAnalysisCompute.computeAdvance");
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
137
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
138 CalculationResult res;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
139
6101
a0078e5e3b39 Removed unused context from RangeAccess and subclasses leading to some dead code removal.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
140 FixAnalysisAccess access = new FixAnalysisAccess(artifact);
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
141
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
142 if (old instanceof CalculationResult) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
143 res = (CalculationResult)old;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
144 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
145 else {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
146 FixAnalysisCalculation calc = new FixAnalysisCalculation(access);
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
147 res = calc.calculate();
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
148 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
149
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
150 if (facets == null) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
151 return res;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
152 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
153
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
154 if (res.getReport().hasProblems()) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
155 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
156 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
157
3415
e3c7a3228bc2 FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3412
diff changeset
158 FixAnalysisResult fr = (FixAnalysisResult)res.getData();
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
159 if (fr == null) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
160 return res;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
161 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
162
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
163 facets.add(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
164 new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
165 facets.add(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
166 new DataFacet(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
167 FIX_PARAMETERS, "parameters", ComputeType.ADVANCE, hash, id));
3599
659c1111db13 FixA: Added exporter for AT files.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3415
diff changeset
168 facets.add(
659c1111db13 FixA: Added exporter for AT files.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3415
diff changeset
169 new DataFacet(AT, "AT data", ComputeType.ADVANCE, hash, id));
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
170
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
171 int maxId = -100;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
172
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
173 int sectorMask = fr.getUsedSectorsInAnalysisPeriods();
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
174
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
175 int qsS = access.getQSectorStart();
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
176 int qsE = access.getQSectorEnd();
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
177
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
178 DateFormat df = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy");
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
179 DateFormat lf = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyy'T'HH:mm");
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
180
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
181 DateRange [] periods = access.getAnalysisPeriods();
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
182
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
183 for (int i = 0; i < periods.length; i++) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
184 DateRange period = periods[i];
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
185 String startDate = df.format(period.getFrom());
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
186 String endDate = df.format(period.getTo());
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
187
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
188 for (int j = qsS; j <= qsE; j++) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
189
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
190 // Only emit facets for sectors that really have data.
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
191 if ((sectorMask & (1 << j)) == 0) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
192 continue;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
193 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
194
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
195 String sector = SECTOR_LABELS[j];
5380
75371c9ef472 I1174: Changed label for some themes in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 4866
diff changeset
196 String description = "\u0394W (" +
75371c9ef472 I1174: Changed label for some themes in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 4866
diff changeset
197 Resources.getMsg(context.getMeta(),
75371c9ef472 I1174: Changed label for some themes in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 4866
diff changeset
198 sector,
75371c9ef472 I1174: Changed label for some themes in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 4866
diff changeset
199 sector) +
75371c9ef472 I1174: Changed label for some themes in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 4866
diff changeset
200 ")";
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
201
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
202 int sectorNdx = j - qsS;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
203 int facetNdx = i << 2;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
204 facetNdx = facetNdx | j;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
205
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
206 if (facetNdx > maxId) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
207 maxId = facetNdx;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
208 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
209
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
210 facets.add(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
211 new FixAvSectorFacet(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
212 facetNdx,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
213 FIX_SECTOR_AVERAGE_DWT + "_" + sectorNdx,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
214 description));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
215 facets.add(
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
216 new FixLongitudinalAvSectorFacet(
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
217 facetNdx,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
218 FIX_SECTOR_AVERAGE_LS + "_" + sectorNdx,
5380
75371c9ef472 I1174: Changed label for some themes in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 4866
diff changeset
219 description + ":" + startDate + " - " + endDate));
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
220 // TODO: i18n
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
221 String dev = "Abweichung: " + description;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
222 facets.add(
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
223 new FixLongitudinalAvSectorFacet(
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
224 facetNdx,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
225 FIX_SECTOR_AVERAGE_LS_DEVIATION + "_" + sectorNdx,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
226 dev));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
227 facets.add(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
228 new FixAvSectorFacet(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
229 facetNdx,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
230 FIX_SECTOR_AVERAGE_WQ + "_" + sectorNdx,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
231 description));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
232
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
233 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
234
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
235 String eventDesc =
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
236 Resources.getMsg(context.getMeta(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
237 I18N_ANALYSIS,
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
238 I18N_ANALYSIS);
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
239
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
240 Collection<Date> aeds = fr.getAnalysisEventsDates(i);
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
241 UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, aeds);
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
242
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
243 int k = 0;
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
244 for (Date d: aeds) {
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
245 int anaNdx = i << 8;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
246 anaNdx = anaNdx | k;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
247 facets.add(new FixAnalysisEventsFacet(anaNdx,
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
248 FIX_ANALYSIS_EVENTS_DWT,
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
249 eventDesc + (i+1) + " - " + cf.format(d)));
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
250 facets.add(new FixLongitudinalAnalysisFacet(anaNdx,
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
251 FIX_ANALYSIS_EVENTS_LS,
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
252 eventDesc + (i+1) + " - " + cf.format(d)));
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
253 facets.add(new FixAnalysisEventsFacet(anaNdx,
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
254 FIX_ANALYSIS_EVENTS_WQ,
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
255 eventDesc + (i+1) +" - " + cf.format(d)));
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
256 k++;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
257 }
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
258 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
259
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
260 IdGenerator idg = new IdGenerator(maxId + 1);
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
261
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
262 String i18n_ref = Resources.getMsg(context.getMeta(),
3907
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
263 I18N_REFERENCEPERIOD_SHORT,
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
264 I18N_REFERENCEPERIOD_SHORT);
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
265 String i18n_dev = Resources.getMsg(context.getMeta(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
266 I18N_REFERENCEDEVIATION,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
267 I18N_REFERENCEDEVIATION);
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
268
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
269 Collection<Date> reds = fr.getReferenceEventsDates();
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
270 UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, reds);
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
271
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
272 int i = 0;
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
273 for (Date d: reds) {
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
274 int refNdx = idg.next() << 8;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
275 refNdx |= i;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
276 facets.add(new FixReferenceEventsFacet(refNdx,
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
277 FIX_REFERENCE_EVENTS_DWT,
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
278 i18n_ref + " - " + cf.format(d)));
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
279 refNdx = idg.next() << 8;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
280 refNdx = refNdx | i;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
281 facets.add(new FixLongitudinalReferenceFacet(refNdx,
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
282 FIX_REFERENCE_EVENTS_LS,
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
283 i18n_ref + " - " + cf.format(d)));
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
284 refNdx = idg.next() << 8;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
285 refNdx |= i;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
286 facets.add(new FixReferenceEventsFacet(refNdx,
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
287 FIX_REFERENCE_EVENTS_WQ,
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
288 i18n_ref + " - " + cf.format(d)));
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
289 i++;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
290 }
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
291
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
292 facets.add(new FixLongitudinalDeviationFacet(idg.next(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
293 FIX_DEVIATION_LS,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
294 i18n_dev));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
295
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
296 String i18n_ana = Resources.getMsg(context.getMeta(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
297 I18N_ANALYSISPERIODS,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
298 I18N_ANALYSISPERIODS);
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
299 facets.add(new FixAnalysisPeriodsFacet(idg.next(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
300 FIX_ANALYSIS_PERIODS_DWT,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
301 i18n_ana));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
302 facets.add(new FixAnalysisPeriodsFacet(idg.next(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
303 FIX_ANALYSIS_PERIODS_LS,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
304 i18n_ana));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
305 facets.add(new FixAnalysisPeriodsFacet(idg.next(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
306 FIX_ANALYSIS_PERIODS_WQ,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
307 i18n_ana));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
308
3907
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
309 String i18n_refp = Resources.getMsg(context.getMeta(),
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
310 I18N_REFERENCEPERIOD,
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
311 I18N_REFERENCEPERIOD);
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
312 facets.add(new DataFacet(idg.next(),
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
313 FIX_REFERENCE_PERIOD_DWT,
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
314 i18n_refp,
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
315 ComputeType.ADVANCE, null, null));
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
316
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
317 facets.add(new FixWQCurveFacet(idg.next(), "W/Q"));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
318
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
319 Boolean preprocessing = access.getPreprocessing();
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
320
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
321 if (preprocessing != null && preprocessing) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
322 facets.add(new FixOutlierFacet(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
323 idg.next(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
324 FIX_OUTLIER,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
325 Resources.getMsg(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
326 context.getMeta(), I18N_OUTLIER, I18N_OUTLIER)));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
327 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
328
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
329 facets.add(new FixDerivateFacet(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
330 idg.next(),
3917
1ff257ab38ca Rename fix_derivate to fix_derivate_curve to enable manual points on it
Christian Lins <christian.lins@intevation.de>
parents: 3913
diff changeset
331 FIX_DERIVATE_CURVE,
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
332 Resources.getMsg(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
333 context.getMeta(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
334 I18N_DERIVATIVE,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
335 I18N_DERIVATIVE)));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
336
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
337 facets.add(new FixDeviationFacet(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
338 idg.next(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
339 FIX_DEVIATION_DWT,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
340 Resources.getMsg(context.getMeta(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
341 I18N_DEVIATION,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
342 I18N_DEVIATION)));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
343 return res;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
344 }
6844
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
345
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
346 /** Little hack to format dates unique if they collide. */
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
347 private static class UniqueDateFormatter {
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
348
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
349 private DateFormat df;
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
350 private DateFormat lf;
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
351 private Map<String, int[]> collisions;
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
352
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
353 UniqueDateFormatter(
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
354 DateFormat df,
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
355 DateFormat lf,
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
356 Collection<Date> dates
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
357 ) {
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
358 this.df = df;
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
359 this.lf = lf;
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
360 collisions = build(dates);
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
361 }
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
362
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
363 private Map<String, int []> build(Collection<Date> dates) {
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
364 Map<String, int []> collisions = new HashMap<String, int[]>();
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
365 for (Date d: dates) {
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
366 String s = df.format(d);
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
367 int [] count = collisions.get(s);
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
368 if (count == null) {
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
369 collisions.put(s, count = new int[1]);
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
370 }
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
371 if (++count[0] > 1) {
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
372 log.debug("date collsion found: " + d);
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
373 }
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
374 }
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
375 return collisions;
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
376 }
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
377
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
378 String format(Date date) {
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
379 String s = df.format(date);
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
380 int [] count = collisions.get(s);
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
381 return count == null || count[0] < 2
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
382 ? s
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
383 : lf.format(date);
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
384 }
437d056ce426 Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
385 } // class UniqueDateFormatter
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
386 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
387 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org