annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixAnalysisCompute.java @ 6846:b87b20c71407

Removed _stupid_ TODO question. WE WANT PULL OUT LOGIC OUT OF ARTIFACTS!
author Sascha L. Teichmann <teichmann@intevation.de>
date Sat, 17 Aug 2013 12:17:42 +0200
parents 437d056ce426
children 90f66b4fc34d
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
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
83 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
84 // 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
85 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
86 "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
87 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
88 @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
89 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
90 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
91 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
92 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
93 ) {
4166
48e09640e8ec Let fix sector average facets in deltawt-diagrams enter inactively.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3917
diff changeset
94 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
95 // 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
96 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
97
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 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
99 || 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
100 || 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
101 || 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
102 || 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
103 || 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
104 ) {
bdf855b5693f Fixing analysis longitudinal section chart has now initially deactivated A1/B facets
Christian Lins <christian.lins@intevation.de>
parents: 3907
diff changeset
105 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
106 }
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
107 }
4433
5b8919ef601d Backed out changeset e8a4d2fd25cc
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4432
diff changeset
108 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
109 && 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
110 return Boolean.FALSE;
48e09640e8ec Let fix sector average facets in deltawt-diagrams enter inactively.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3917
diff changeset
111 }
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
112
a5f65e8983be Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3730
diff changeset
113 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
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 });
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
5646
14009b194871 Doc, Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5380
diff changeset
118
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
119 /**
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
120 * 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
121 */
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
122 public FixAnalysisCompute() {
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
5646
14009b194871 Doc, Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5380
diff changeset
125
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
126 @Override
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
127 public Object computeAdvance(
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
128 D4EArtifact artifact,
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
129 String hash,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
130 CallContext context,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
131 List<Facet> facets,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
132 Object old
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
133 ) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
134 log.debug("FixAnalysisCompute.computeAdvance");
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 CalculationResult res;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
137
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
138 FixAnalysisAccess access = new FixAnalysisAccess(artifact);
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
139
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
140 if (old instanceof CalculationResult) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
141 res = (CalculationResult)old;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
142 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
143 else {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
144 FixAnalysisCalculation calc = new FixAnalysisCalculation(access);
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
145 res = calc.calculate();
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
146 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
147
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
148 if (facets == null) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
149 return res;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
150 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
151
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
152 if (res.getReport().hasProblems()) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
153 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
154 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
155
3415
e3c7a3228bc2 FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3412
diff changeset
156 FixAnalysisResult fr = (FixAnalysisResult)res.getData();
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
157 if (fr == null) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
158 return res;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
159 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
160
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
161 facets.add(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
162 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
163 facets.add(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
164 new DataFacet(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
165 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
166 facets.add(
659c1111db13 FixA: Added exporter for AT files.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3415
diff changeset
167 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
168
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
169 int maxId = -100;
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 sectorMask = fr.getUsedSectorsInAnalysisPeriods();
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 qsS = access.getQSectorStart();
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
174 int qsE = access.getQSectorEnd();
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
175
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
176 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
177 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
178
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
179 DateRange [] periods = access.getAnalysisPeriods();
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 for (int i = 0; i < periods.length; i++) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
182 DateRange period = periods[i];
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
183 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
184 String endDate = df.format(period.getTo());
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
185
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
186 for (int j = qsS; j <= qsE; j++) {
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 // 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
189 if ((sectorMask & (1 << j)) == 0) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
190 continue;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
191 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
192
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
193 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
194 String description = "\u0394W (" +
75371c9ef472 I1174: Changed label for some themes in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 4866
diff changeset
195 Resources.getMsg(context.getMeta(),
75371c9ef472 I1174: Changed label for some themes in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 4866
diff changeset
196 sector,
75371c9ef472 I1174: Changed label for some themes in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 4866
diff changeset
197 sector) +
75371c9ef472 I1174: Changed label for some themes in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 4866
diff changeset
198 ")";
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
199
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
200 int sectorNdx = j - qsS;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
201 int facetNdx = i << 2;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
202 facetNdx = facetNdx | j;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
203
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
204 if (facetNdx > maxId) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
205 maxId = facetNdx;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
206 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
207
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
208 facets.add(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
209 new FixAvSectorFacet(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
210 facetNdx,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
211 FIX_SECTOR_AVERAGE_DWT + "_" + sectorNdx,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
212 description));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
213 facets.add(
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
214 new FixLongitudinalAvSectorFacet(
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
215 facetNdx,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
216 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
217 description + ":" + startDate + " - " + endDate));
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
218 // TODO: i18n
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
219 String dev = "Abweichung: " + description;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
220 facets.add(
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
221 new FixLongitudinalAvSectorFacet(
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
222 facetNdx,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
223 FIX_SECTOR_AVERAGE_LS_DEVIATION + "_" + sectorNdx,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
224 dev));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
225 facets.add(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
226 new FixAvSectorFacet(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
227 facetNdx,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
228 FIX_SECTOR_AVERAGE_WQ + "_" + sectorNdx,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
229 description));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
230
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
231 }
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 String eventDesc =
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
234 Resources.getMsg(context.getMeta(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
235 I18N_ANALYSIS,
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
236 I18N_ANALYSIS);
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
237
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
238 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
239 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
240
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
241 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
242 for (Date d: aeds) {
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
243 int anaNdx = i << 8;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
244 anaNdx = anaNdx | k;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
245 facets.add(new FixAnalysisEventsFacet(anaNdx,
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
246 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
247 eventDesc + (i+1) + " - " + cf.format(d)));
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
248 facets.add(new FixLongitudinalAnalysisFacet(anaNdx,
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
249 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
250 eventDesc + (i+1) + " - " + cf.format(d)));
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
251 facets.add(new FixAnalysisEventsFacet(anaNdx,
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
252 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
253 eventDesc + (i+1) +" - " + cf.format(d)));
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
254 k++;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
255 }
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
256 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
257
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
258 IdGenerator idg = new IdGenerator(maxId + 1);
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 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
261 I18N_REFERENCEPERIOD_SHORT,
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
262 I18N_REFERENCEPERIOD_SHORT);
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
263 String i18n_dev = Resources.getMsg(context.getMeta(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
264 I18N_REFERENCEDEVIATION,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
265 I18N_REFERENCEDEVIATION);
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
266
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
267 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
268 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
269
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
270 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
271 for (Date d: reds) {
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
272 int refNdx = idg.next() << 8;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
273 refNdx |= i;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
274 facets.add(new FixReferenceEventsFacet(refNdx,
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
275 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
276 i18n_ref + " - " + cf.format(d)));
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
277 refNdx = idg.next() << 8;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
278 refNdx = refNdx | i;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
279 facets.add(new FixLongitudinalReferenceFacet(refNdx,
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
280 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
281 i18n_ref + " - " + cf.format(d)));
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
282 refNdx = idg.next() << 8;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
283 refNdx |= i;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
284 facets.add(new FixReferenceEventsFacet(refNdx,
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
285 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
286 i18n_ref + " - " + cf.format(d)));
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
287 i++;
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3599
diff changeset
288 }
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
289
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
290 facets.add(new FixLongitudinalDeviationFacet(idg.next(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
291 FIX_DEVIATION_LS,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
292 i18n_dev));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
293
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
294 String i18n_ana = Resources.getMsg(context.getMeta(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
295 I18N_ANALYSISPERIODS,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
296 I18N_ANALYSISPERIODS);
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
297 facets.add(new FixAnalysisPeriodsFacet(idg.next(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
298 FIX_ANALYSIS_PERIODS_DWT,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
299 i18n_ana));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
300 facets.add(new FixAnalysisPeriodsFacet(idg.next(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
301 FIX_ANALYSIS_PERIODS_LS,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
302 i18n_ana));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
303 facets.add(new FixAnalysisPeriodsFacet(idg.next(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
304 FIX_ANALYSIS_PERIODS_WQ,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
305 i18n_ana));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
306
3907
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
307 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
308 I18N_REFERENCEPERIOD,
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
309 I18N_REFERENCEPERIOD);
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
310 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
311 FIX_REFERENCE_PERIOD_DWT,
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
312 i18n_refp,
9a2c38fb5f29 Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents: 3785
diff changeset
313 ComputeType.ADVANCE, null, null));
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
314
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
315 facets.add(new FixWQCurveFacet(idg.next(), "W/Q"));
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 Boolean preprocessing = access.getPreprocessing();
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 if (preprocessing != null && preprocessing) {
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
320 facets.add(new FixOutlierFacet(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
321 idg.next(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
322 FIX_OUTLIER,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
323 Resources.getMsg(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
324 context.getMeta(), I18N_OUTLIER, I18N_OUTLIER)));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
325 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
326
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
327 facets.add(new FixDerivateFacet(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
328 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
329 FIX_DERIVATE_CURVE,
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
330 Resources.getMsg(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
331 context.getMeta(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
332 I18N_DERIVATIVE,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
333 I18N_DERIVATIVE)));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
334
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
335 facets.add(new FixDeviationFacet(
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
336 idg.next(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
337 FIX_DEVIATION_DWT,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
338 Resources.getMsg(context.getMeta(),
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
339 I18N_DEVIATION,
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
340 I18N_DEVIATION)));
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
341 return res;
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
342 }
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
343
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
344 /** 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
345 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
346
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 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
348 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
349 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
350
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 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
352 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
353 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
354 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
355 ) {
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 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
357 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
358 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
359 }
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
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 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
362 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
363 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
364 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
365 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
366 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
367 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
368 }
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 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
370 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
371 }
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 }
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 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
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
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 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
377 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
378 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
379 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
380 ? 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 : 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
382 }
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 } // class UniqueDateFormatter
3412
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
384 }
da000d9513f7 FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
385 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org