comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SQRelationCalculation.java @ 3079:8ad8a227d983

Added model classes for SQ calculation; generate fake results and improved the SQRelationGenerator which now draws the outliers. flys-artifacts/trunk@4675 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 15 Jun 2012 12:23:08 +0000
parents 0d3dd8230064
children b31397addf2f
comparison
equal deleted inserted replaced
3078:0e0efd1acb4f 3079:8ad8a227d983
1 package de.intevation.flys.artifacts.model.sq; 1 package de.intevation.flys.artifacts.model.sq;
2
3 import java.util.ArrayList;
4 import java.util.List;
2 5
3 import org.apache.log4j.Logger; 6 import org.apache.log4j.Logger;
4 7
5 import de.intevation.flys.artifacts.model.Calculation; 8 import de.intevation.flys.artifacts.model.Calculation;
6 import de.intevation.flys.artifacts.model.CalculationResult; 9 import de.intevation.flys.artifacts.model.CalculationResult;
25 28
26 protected CalculationResult buildCalculationResult( 29 protected CalculationResult buildCalculationResult(
27 // TODO Insert input params here 30 // TODO Insert input params here
28 ) { 31 ) {
29 logger.info("SQRelationCalculation.buildCalculationResult"); 32 logger.info("SQRelationCalculation.buildCalculationResult");
30
31 logger.error("Not implemented!"); 33 logger.error("Not implemented!");
32 34
33 return new CalculationResult(new Object[0], this); 35 SQResult[] result = getFakeResult();
36
37 return new CalculationResult(result, this);
38 }
39
40
41 protected SQResult[] getFakeResult() {
42
43 SQ[] measurements = getFakeMeasurements();
44 SQ[] fOutliers = getFakeOutliers(10);
45 SQ[] tOutliers = getFakeOutliers(20);
46
47 List<SQ[]> outliers = new ArrayList<SQ[]>();
48 outliers.add(fOutliers);
49 outliers.add(tOutliers);
50
51 return new SQResult[] { new SQResult(null, measurements, outliers) };
52 }
53
54 protected SQ[] getFakeMeasurements() {
55 List<SQ> a = new ArrayList<SQ>();
56
57 a.add(new SQ(11.172500000000001, 1250.0));
58 a.add(new SQ(13.407000000000002, 1500.0));
59 a.add(new SQ(15.641500000000002, 1750.0));
60 a.add(new SQ(17.876000000000005, 2000.0));
61 a.add(new SQ(20.110500000000005, 2250.0));
62 a.add(new SQ(22.345000000000002, 2500.0));
63 a.add(new SQ(24.579500000000003, 2750.0));
64 a.add(new SQ(26.814000000000004, 3000.0));
65 a.add(new SQ(29.048500000000004, 3250.0));
66 a.add(new SQ(31.283000000000005, 3500.0));
67 a.add(new SQ(33.517500000000005, 3750.0));
68 a.add(new SQ(35.75200000000001, 4000.0));
69 a.add(new SQ(37.98650000000001, 4250.0));
70 a.add(new SQ(40.22100000000001, 4500.0));
71 a.add(new SQ(42.45550000000001, 4750.0));
72
73 return (SQ[]) a.toArray(new SQ[a.size()]);
74 }
75
76
77 protected SQ[] getFakeOutliers(int diff) {
78 List<SQ> a = new ArrayList<SQ>();
79
80 a.add(new SQ(11.172500000000001-diff, 1250.0));
81 a.add(new SQ(13.407000000000002+diff, 1500.0));
82 a.add(new SQ(25.641500000000002-diff, 1750.0));
83 a.add(new SQ(17.876000000000005+diff, 2000.0));
84 a.add(new SQ(20.110500000000005-diff, 2250.0));
85 a.add(new SQ(22.345000000000002+diff, 2500.0));
86 a.add(new SQ(24.579500000000003-diff, 2750.0));
87 a.add(new SQ(26.814000000000004+diff, 3000.0));
88 a.add(new SQ(29.048500000000004-diff, 3250.0));
89 a.add(new SQ(31.283000000000005+diff, 3500.0));
90 a.add(new SQ(33.517500000000005-diff, 3750.0));
91 a.add(new SQ(35.75200000000001-diff, 4000.0));
92 a.add(new SQ(37.98650000000001+diff, 4250.0));
93 a.add(new SQ(40.22100000000001+diff, 4500.0));
94 a.add(new SQ(42.45550000000001+diff, 4750.0));
95
96 return (SQ[]) a.toArray(new SQ[a.size()]);
34 } 97 }
35 } 98 }
36 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : 99 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org