comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SQRelationCalculation.java @ 5396:aaf810d4ec82

Use new state 'outlier mehtod selection' in SQ-relation. The outlier method is no more configurable in conf.xml. The user can now select the method in SQ-relation parameters.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 25 Mar 2013 12:40:26 +0100
parents ba2f0bff0697
children
comparison
equal deleted inserted replaced
5395:5a55c5372fe1 5396:aaf810d4ec82
26 26
27 protected String river; 27 protected String river;
28 protected double location; 28 protected double location;
29 protected DateRange period; 29 protected DateRange period;
30 protected double outliers; 30 protected double outliers;
31 private String method;
31 32
32 public SQRelationCalculation() { 33 public SQRelationCalculation() {
33 } 34 }
34 35
35 public SQRelationCalculation(SQRelationAccess access) { 36 public SQRelationCalculation(SQRelationAccess access) {
36 37
37 String river = access.getRiver(); 38 String river = access.getRiver();
38 Double location = access.getLocation(); 39 Double location = access.getLocation();
39 DateRange period = access.getPeriod(); 40 DateRange period = access.getPeriod();
40 Double outliers = access.getOutliers(); 41 Double outliers = access.getOutliers();
42 String method = access.getOutlierMethod();
41 43
42 //river = "Rhein"; 44 //river = "Rhein";
43 45
44 if (river == null) { 46 if (river == null) {
45 // TODO: i18n 47 // TODO: i18n
59 if (outliers == null) { 61 if (outliers == null) {
60 // TODO: i18n 62 // TODO: i18n
61 addProblem("sq.missing.outliers"); 63 addProblem("sq.missing.outliers");
62 } 64 }
63 65
66 if (method == null) {
67 //TODO: i18n
68 addProblem("sq.missing.method");
69 }
70
64 if (!hasProblems()) { 71 if (!hasProblems()) {
65 this.river = river; 72 this.river = river;
66 this.location = location; 73 this.location = location;
67 this.period = period; 74 this.period = period;
68 this.outliers = outliers; 75 this.outliers = outliers;
76 this.method = method;
69 } 77 }
70 } 78 }
71 79
72 80
73 public CalculationResult calculate() { 81 public CalculationResult calculate() {
138 final List<SQFractionResult.Iteration> iterations = 146 final List<SQFractionResult.Iteration> iterations =
139 new ArrayList<SQFractionResult.Iteration>(); 147 new ArrayList<SQFractionResult.Iteration>();
140 148
141 boolean success = new Fitting(function, outliers).fit( 149 boolean success = new Fitting(function, outliers).fit(
142 sqs, 150 sqs,
151 method,
143 new Fitting.Callback() { 152 new Fitting.Callback() {
144 @Override 153 @Override
145 public void afterIteration( 154 public void afterIteration(
146 double [] coeffs, 155 double [] coeffs,
147 SQ [] measurements, 156 SQ [] measurements,

http://dive4elements.wald.intevation.org