# HG changeset patch # User Sascha L. Teichmann # Date 1345632689 0 # Node ID d2ae58f6730dcfad447b643be5f6371e9f98c30a # Parent e1fd2dfdcb801c5d1a7e8dd98ac80d08ac7b76b7 FixA: Use the column cache to establish a consistent index scheme. flys-artifacts/trunk@5229 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r e1fd2dfdcb80 -r d2ae58f6730d flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Wed Aug 22 10:18:00 2012 +0000 +++ b/flys-artifacts/ChangeLog Wed Aug 22 10:51:29 2012 +0000 @@ -1,3 +1,17 @@ +2012-08-20 Sascha L. Teichmann + + Use the column cache to establish a consistent index scheme. + TODO: Store the index values in the created QWDs. + + * src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java: + doFitting() fetches the columns from column cache, too. + + * src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisCalculation.java: + Reuse same column cache from fitting to have the same index scheme. + + * src/main/java/de/intevation/flys/artifacts/model/fixings/FixRealizingCalculation.java: + Adjusted to use the column cache. + 2012-08-22 Christian Lins * src/main/java/de/intevation/flys/artifacts/model/HYKFacet.java, diff -r e1fd2dfdcb80 -r d2ae58f6730d flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisCalculation.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisCalculation.java Wed Aug 22 10:18:00 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisCalculation.java Wed Aug 22 10:51:29 2012 +0000 @@ -68,7 +68,9 @@ FixingsOverview overview, Function func ) { - FitResult fitResult = doFitting(overview, func); + ColumnCache cc = new ColumnCache(); + + FitResult fitResult = doFitting(overview, cc, func); if (fitResult == null) { return new CalculationResult(this); @@ -78,7 +80,8 @@ calculateAnalysisPeriods( func, fitResult.getParameters(), - overview); + overview, + cc); analysisPeriods.sort(); @@ -103,15 +106,14 @@ protected KMIndex calculateAnalysisPeriods( Function function, Parameters parameters, - FixingsOverview overview + FixingsOverview overview, + ColumnCache cc ) { Range range = new Range(from, to); int kmIndex = parameters.columnIndex("km"); int maxQIndex = parameters.columnIndex("max_q"); - ColumnCache cc = new ColumnCache(); - double [] wq = new double[2]; int [] parameterIndices = diff -r e1fd2dfdcb80 -r d2ae58f6730d flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java Wed Aug 22 10:18:00 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java Wed Aug 22 10:51:29 2012 +0000 @@ -82,13 +82,15 @@ protected Fixing.Column meta; protected FixingsColumn data; + protected int index; public Column() { } - public Column(Fixing.Column meta, FixingsColumn data) { - this.meta = meta; - this.data = data; + public Column(Fixing.Column meta, FixingsColumn data, int index) { + this.meta = meta; + this.data = data; + this.index = index; } public Date getDate() { @@ -99,6 +101,10 @@ return meta.getDescription(); } + public int getIndex() { + return index; + } + public boolean getQW( double km, double [] qs, @@ -136,7 +142,7 @@ .getInstance() .getColumnData(meta); if (data != null) { - column = new Column(meta, data); + column = new Column(meta, data, columns.size()); columns.put(key, column); } } @@ -234,8 +240,10 @@ return new IdsFilter(events); } - protected List getEventColumns(FixingsOverview overview) { - + protected List getEventColumns( + FixingsOverview overview, + ColumnCache cc + ) { FixingsColumnFactory fcf = FixingsColumnFactory.getInstance(); Filter filter = createFilter(); @@ -246,23 +254,26 @@ for (Fixing.Column meta: metas) { - FixingsColumn data = fcf.getColumnData(meta); + Column data = cc.getColumn(meta); if (data == null) { addProblem("fix.cannot.load.data"); } else { - columns.add(new Column(meta, data)); + columns.add(data); } } return columns; } - protected FitResult doFitting(FixingsOverview overview, Function func) { - + protected FitResult doFitting( + FixingsOverview overview, + ColumnCache cc, + Function func + ) { boolean debug = log.isDebugEnabled(); - final List eventColumns = getEventColumns(overview); + final List eventColumns = getEventColumns(overview, cc); if (eventColumns.size() < 2) { addProblem("fix.too.less.data.columns"); diff -r e1fd2dfdcb80 -r d2ae58f6730d flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixRealizingCalculation.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixRealizingCalculation.java Wed Aug 22 10:18:00 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixRealizingCalculation.java Wed Aug 22 10:51:29 2012 +0000 @@ -66,7 +66,8 @@ FixingsOverview overview, Function func ) { - FitResult fitResult = doFitting(overview, func); + ColumnCache cc = new ColumnCache(); + FitResult fitResult = doFitting(overview, cc, func); if (fitResult == null) { return new CalculationResult(this);