Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SQRelation.java @ 3552:1df6984628c3
S/Q: Extented the result data model of the S/Q calculation to
store the curve coefficients for each iteration step
of the outlier elimination.
flys-artifacts/trunk@5146 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 27 Jul 2012 12:36:09 +0000 |
parents | 0f7abd95c6e2 |
children | f9f266504f1d |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SQRelation.java Fri Jul 27 08:36:24 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SQRelation.java Fri Jul 27 12:36:09 2012 +0000 @@ -16,10 +16,12 @@ import de.intevation.flys.artifacts.model.sq.SQCurveFacet; import de.intevation.flys.artifacts.model.sq.SQFractionResult; import de.intevation.flys.artifacts.model.sq.SQMeasurementFacet; +import de.intevation.flys.artifacts.model.sq.SQOutlierCurveFacet; import de.intevation.flys.artifacts.model.sq.SQOutlierFacet; +import de.intevation.flys.artifacts.model.sq.SQOutlierMeasurementFacet; +import de.intevation.flys.artifacts.model.sq.SQOverviewFacet; import de.intevation.flys.artifacts.model.sq.SQRelationCalculation; import de.intevation.flys.artifacts.model.sq.SQResult; -import de.intevation.flys.artifacts.model.sq.SQOverviewFacet; import de.intevation.flys.artifacts.resources.Resources; @@ -44,6 +46,11 @@ public static final String I18N_FACET_OUTLIERS = "facet.sq_relation.outliers"; + public static final String I18N_FACET_OUTLIER_CURVE = + "facet.sq_relation.outlier.curve"; + + public static final String I18N_FACET_OUTLIER_MEASUREMENT = + "facet.sq_relation.outlier.measurement"; public SQRelation() { } @@ -94,6 +101,8 @@ SQResult[] sqr, String hash ) { + boolean debug = log.isDebugEnabled(); + CallMeta meta = context.getMeta(); String stateId = getID(); for (int i = 0; i < 6; i++) { @@ -112,7 +121,7 @@ } for (int res = 0, n = sqr.length; res < n; res++) { - for (int i = 0; i < 6; i++) { + for (int i = 0; i < SQResult.NUMBER_FRACTIONS; i++) { SQFractionResult result = sqr[res].getFraction(i); if (result == null) { @@ -120,19 +129,6 @@ continue; } - container.add(new SQMeasurementFacet( - res, - i, - getFractionFacetname(1, i), - Resources.getMsg( - meta, - I18N_FACET_MEASUREMENTS, - I18N_FACET_MEASUREMENTS - ), - hash, - stateId - )); - container.add(new SQCurveFacet( res, i, @@ -146,12 +142,15 @@ stateId )); - for (int j = 0, C = result.getOutliersCount(); j < C; j++) { + for (int j = 0, C = result.numIterations()-1; j < C; j++) { + + Object [] round = new Object [] { j + 1 }; + int index = res; index = index << 16; index = index + j; - if (log.isDebugEnabled()) { + if (debug) { log.debug("new outliers facet (index=" +index+ ")"); log.debug(" result index = " + res); log.debug(" fraction idx = " + i); @@ -166,51 +165,83 @@ meta, I18N_FACET_OUTLIERS, I18N_FACET_OUTLIERS, - new Object[] { j } + round ), hash, stateId )); - } - } + + container.add(new SQOutlierCurveFacet( + index, + i, + getFractionFacetname(3, i), + Resources.getMsg( + meta, + I18N_FACET_OUTLIER_CURVE, + I18N_FACET_OUTLIER_CURVE, + round + ), + hash, + stateId + )); + + container.add(new SQOutlierMeasurementFacet( + index, + i, + getFractionFacetname(4, i), + Resources.getMsg( + meta, + I18N_FACET_OUTLIER_MEASUREMENT, + I18N_FACET_OUTLIER_MEASUREMENT, + round + ), + hash, + stateId + )); + } // for all outliers + + container.add(new SQMeasurementFacet( + res, + i, + getFractionFacetname(1, i), + Resources.getMsg( + meta, + I18N_FACET_MEASUREMENTS, + I18N_FACET_MEASUREMENTS + ), + hash, + stateId + )); + } // for all fractions + } // for all results + } + + public static final String [][] FACET_NAMES = { + { SQ_A_CURVE, SQ_B_CURVE, SQ_C_CURVE, + SQ_D_CURVE, SQ_E_CURVE, SQ_F_CURVE + }, + { SQ_A_MEASUREMENT, SQ_B_MEASUREMENT, SQ_C_MEASUREMENT, + SQ_D_MEASUREMENT, SQ_E_MEASUREMENT, SQ_F_MEASUREMENT + }, + { SQ_A_OUTLIER, SQ_B_OUTLIER, SQ_C_OUTLIER, + SQ_D_OUTLIER, SQ_E_OUTLIER, SQ_F_OUTLIER + }, + { SQ_A_OUTLIER_CURVE, SQ_B_OUTLIER_CURVE, SQ_C_OUTLIER_CURVE, + SQ_D_OUTLIER_CURVE, SQ_E_OUTLIER_CURVE, SQ_F_OUTLIER_CURVE + }, + { SQ_A_OUTLIER_MEASUREMENT, SQ_B_OUTLIER_MEASUREMENT, + SQ_C_OUTLIER_MEASUREMENT, SQ_D_OUTLIER_MEASUREMENT, + SQ_E_OUTLIER_MEASUREMENT, SQ_F_OUTLIER_MEASUREMENT } - } + }; - protected String getFractionFacetname(int type, int fractionIdx) { - log.debug("getFractionFacetname(): " + type + " | " + fractionIdx); - - switch (type) { - case 0: - switch (fractionIdx) { - case 0: return SQ_A_CURVE; - case 1: return SQ_B_CURVE; - case 2: return SQ_C_CURVE; - case 3: return SQ_D_CURVE; - case 4: return SQ_E_CURVE; - case 5: return SQ_F_CURVE; - } - case 1: - switch (fractionIdx) { - case 0: return SQ_A_MEASUREMENT; - case 1: return SQ_B_MEASUREMENT; - case 2: return SQ_C_MEASUREMENT; - case 3: return SQ_D_MEASUREMENT; - case 4: return SQ_E_MEASUREMENT; - case 5: return SQ_F_MEASUREMENT; - } - case 2: - switch (fractionIdx) { - case 0: return SQ_A_OUTLIER; - case 1: return SQ_B_OUTLIER; - case 2: return SQ_C_OUTLIER; - case 3: return SQ_D_OUTLIER; - case 4: return SQ_E_OUTLIER; - case 5: return SQ_F_OUTLIER; - } + protected static String getFractionFacetname(int type, int idx) { + if (log.isDebugEnabled()) { + log.debug("getFractionFacetname(): " + type + " | " + idx); } - - return null; + type %= FACET_NAMES.length; + return FACET_NAMES[type][idx % FACET_NAMES[type].length]; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :