Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SQRelation.java @ 3082:9e03960b3ab8
FixA: Lowered log level in parameter interpolation.
flys-artifacts/trunk@4678 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 18 Jun 2012 08:10:44 +0000 |
parents | 8ad8a227d983 |
children | 4a76da133144 |
rev | line source |
---|---|
3058
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states; |
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
3072
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
3 import java.util.ArrayList; |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
4 import java.util.List; |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
5 |
3058
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 |
3072
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
8 import de.intevation.artifacts.CallContext; |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
9 |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
10 import de.intevation.artifactdatabase.state.Facet; |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
11 |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
12 import de.intevation.flys.artifacts.FLYSArtifact; |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
13 import de.intevation.flys.artifacts.MINFOArtifact; |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
14 import de.intevation.flys.artifacts.model.DataFacet; |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
15 import de.intevation.flys.artifacts.model.FacetTypes; |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
16 import de.intevation.flys.artifacts.model.CalculationResult; |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
17 import de.intevation.flys.artifacts.model.sq.SQCurveFacet; |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
18 import de.intevation.flys.artifacts.model.sq.SQMeasurementFacet; |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
19 import de.intevation.flys.artifacts.model.sq.SQOutlierFacet; |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
20 import de.intevation.flys.artifacts.model.sq.SQRelationCalculation; |
3079
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
21 import de.intevation.flys.artifacts.model.sq.SQResult; |
3058
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.flys.artifacts.states.DefaultState; |
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 |
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 /** |
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 */ |
3072
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
27 public class SQRelation extends DefaultState implements FacetTypes { |
3058
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 |
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 private static Logger logger = Logger.getLogger(SQRelation.class); |
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 |
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 |
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 public SQRelation() { |
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 } |
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 |
3072
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
35 |
3058
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 @Override |
3072
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
37 public Object computeAdvance( |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
38 FLYSArtifact artifact, |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
39 String hash, |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
40 CallContext context, |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
41 List<Facet> facets, |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
42 Object old |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
43 ) { |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
44 logger.debug("SQRelation.computeAdvance"); |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
45 |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
46 List<Facet> newFacets = new ArrayList<Facet>(); |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
47 |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
48 CalculationResult res = old instanceof CalculationResult |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
49 ? (CalculationResult) old |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
50 : new SQRelationCalculation().calculate((MINFOArtifact) artifact); |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
51 |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
52 if (facets == null || res == null) { |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
53 return res; |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
54 } |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
55 |
3079
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
56 SQResult[] sqr = (SQResult[]) res.getData(); |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
57 createFacets(newFacets, sqr, hash); |
3072
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
58 |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
59 Facet csv = new DataFacet( |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
60 CSV, "CSV data", ComputeType.ADVANCE, hash, id); |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
61 |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
62 Facet pdf = new DataFacet( |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
63 PDF, "PDF data", ComputeType.ADVANCE, hash, id); |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
64 |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
65 newFacets.add(csv); |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
66 newFacets.add(pdf); |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
67 |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
68 logger.debug("Created " + newFacets.size() + " new Facets."); |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
69 |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
70 facets.addAll(newFacets); |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
71 |
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
72 return res; |
3058
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 } |
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 |
3072
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
75 |
3079
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
76 protected void createFacets( |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
77 List<Facet> container, |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
78 SQResult[] sqr, |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
79 String hash |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
80 ) { |
3072
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
81 // TODO Create facets for each parameter type (A-F) |
3079
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
82 container.add(new SQMeasurementFacet(0, SQ_A_MEASUREMENT, "TODO")); |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
83 container.add(new SQCurveFacet(0, SQ_A_CURVE, "TODO")); |
3072
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
84 |
3079
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
85 for (int i = 0; i < sqr[0].getOutliersCount(); i++) { |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
86 container.add(new SQOutlierFacet( |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
87 0, |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
88 i, |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
89 SQ_A_OUTLIER, |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
90 "OUTLIER AT" + i, |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
91 getID(), |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
92 hash |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
93 )); |
8ad8a227d983
Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3072
diff
changeset
|
94 } |
3072
0d3dd8230064
Added component stubs for SQ relation calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3058
diff
changeset
|
95 } |
3058
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 } |
df4d6b286af8
Added states and transitions for S-Q-relation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |