# HG changeset patch # User gernotbelger # Date 1530630048 -7200 # Node ID 0fc9c82e744eae2d631db73187a8010d037cfab6 # Parent 091fd9676496aa63ea4b5723d191f124336432c7 work on collison, flood_duration diff -r 091fd9676496 -r 0fc9c82e744e artifacts/doc/conf/generators/longitudinal-diagram-defaults.xml --- a/artifacts/doc/conf/generators/longitudinal-diagram-defaults.xml Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/doc/conf/generators/longitudinal-diagram-defaults.xml Tue Jul 03 17:00:48 2018 +0200 @@ -57,9 +57,9 @@ - - - + + + @@ -68,7 +68,7 @@ - + \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/doc/conf/themes/default.xml --- a/artifacts/doc/conf/themes/default.xml Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/doc/conf/themes/default.xml Tue Jul 03 17:00:48 2018 +0200 @@ -1,3113 +1,2859 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/doc/conf/themes/second.xml --- a/artifacts/doc/conf/themes/second.xml Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/doc/conf/themes/second.xml Tue Jul 03 17:00:48 2018 +0200 @@ -3088,7 +3088,7 @@ - + @@ -3096,20 +3096,4 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/common/DefaultCalculationResult.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/DefaultCalculationResult.java Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/common/DefaultCalculationResult.java Tue Jul 03 17:00:48 2018 +0200 @@ -23,5 +23,4 @@ // this class only serves as instantiable version of AbstractCalculationResult // not intended for pdf/csv-export } - -} +} \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionArtifact.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionArtifact.java Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionArtifact.java Tue Jul 03 17:00:48 2018 +0200 @@ -24,7 +24,6 @@ import org.dive4elements.river.artifacts.AbstractStaticStateArtifact; import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.model.FacetTypes; -import org.dive4elements.river.artifacts.sinfo.common.CollisionCountProcessor; import org.dive4elements.river.artifacts.states.StaticState; import org.w3c.dom.Document; @@ -90,21 +89,24 @@ else seriesName = "name?"; + // if different facet wanted, e.g. for each year use different facetIndex + // if multiple Result treated, get each Result from data createFacets(callMeta, code, seriesName, getDataAsString("year")); super.setup(identifier, factory, context, callMeta, data, loadFacets); } - private void createFacets(final CallMeta callMeta, final String code, final String seriesName, final String year) { + private void createFacets(final CallMeta callMeta, final String code, final String seriesName, final String yearForName) { if (code == null) return; + final String[] parts = code.split("-"); if (parts.length < 2) { log.error("Invalid datacage ID '" + code + "'"); return; } final ArrayList facets = new ArrayList<>(1); - facets.add(CollisionCountProcessor.createFacet(callMeta, year)); + facets.add(CollisionCountProcessor.createFacet(0, callMeta, yearForName)); // facets.add(CollisionGaugeWProcessor.createFacet(callMeta, seriesName)); //REMARK gauge_w is the cm above gauge datum, // therefore only useful with transformation to NHN addFacets(STATIC_STATE_NAME, facets); diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalcFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalcFacet.java Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalcFacet.java Tue Jul 03 17:00:48 2018 +0200 @@ -11,11 +11,7 @@ package org.dive4elements.river.artifacts.sinfo.collision; import org.dive4elements.artifactdatabase.state.Facet; -import org.dive4elements.artifacts.Artifact; -import org.dive4elements.artifacts.CallContext; -import org.dive4elements.river.artifacts.D4EArtifact; -import org.dive4elements.river.artifacts.model.CalculationResult; -import org.dive4elements.river.artifacts.model.DataFacet; +import org.dive4elements.river.artifacts.sinfo.common.SInfoResultFacet; import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; /** @@ -23,32 +19,25 @@ * * @author Matthias Schäfer */ -// FIXME: remove -public class CollisionCalcFacet extends DataFacet { +public class CollisionCalcFacet extends SInfoResultFacet { private static final long serialVersionUID = 1; + private int year; - public CollisionCalcFacet() { + private CollisionCalcFacet() { + super(); // required for clone operation deepCopy() } - public CollisionCalcFacet(final int idx, final String name, final String description, final String yAxisLabelKey, final ComputeType type, - final String stateId, final String hash) { - super(idx, name, description, type, hash, stateId); - this.metaData.put("X", "sinfo.chart.km.xaxis.label"); - this.metaData.put("Y", yAxisLabelKey); + public CollisionCalcFacet(final int facetIndex, final int resultIndex, final int year, final String name, final String description, + final String yAxisLabelKey, final ComputeType type, final String hash, final String stateId) { + super(facetIndex, resultIndex, name, description, yAxisLabelKey, type, stateId, hash); + + this.year = year; } - @Override - public Object getData(final Artifact artifact, final CallContext context) { - - final D4EArtifact flys = (D4EArtifact) artifact; - - final CalculationResult res = (CalculationResult) flys.compute(context, this.hash, this.stateId, this.type, false); - - final CollisionCalculationResults data = (CollisionCalculationResults) res.getData(); - - return data.getResults().get(0); // first result is always the one and only CollisionCalcOverviewResult + public int getYear() { + return this.year; } /** Copy deeply. */ @@ -61,6 +50,7 @@ copy.type = this.type; copy.hash = this.hash; copy.stateId = this.stateId; + copy.year = this.year; return copy; } } \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalcProcessor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalcProcessor.java Tue Jul 03 17:00:48 2018 +0200 @@ -0,0 +1,89 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ + +package org.dive4elements.river.artifacts.sinfo.collision; + +import java.util.HashSet; +import java.util.Set; + +import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; +import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.river.artifacts.common.AbstractCalculationResult; +import org.dive4elements.river.artifacts.resources.Resources; +import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoProcessor; +import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; +import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; +import org.dive4elements.river.exports.DiagramGenerator; +import org.dive4elements.river.themes.ThemeDocument; + +/** + * Processor to generate the facet and data series of calculated bed collision counts + * + * @author Matthias Schäfer + * + */ +public final class CollisionCalcProcessor extends AbstractSInfoProcessor { + + public static final String FACET_COLLISION_CALC_COUNT = "sinfo_facet_collision_calc_count"; + + public static final String FACET_COLLISION_CALC_COUNT_2 = "sinfo_facet_collision_calc_count.2"; + + public static final String FACET_COLLISION_CALC_COUNT_3 = "sinfo_facet_collision_calc_count.3"; + + private static final String[] COLLISION_FACETS = new String[] { FACET_COLLISION_CALC_COUNT, FACET_COLLISION_CALC_COUNT_2, FACET_COLLISION_CALC_COUNT_3 }; + + private static final String I18N_AXIS_LABEL = "chart.collision_count.section.yaxis.label"; + + private static final String I18N_SERIES_NAME_PATTERN = "collision.count.title"; + + private static final Set HANDLED_FACET_TYPES = new HashSet<>(); + + static { + HANDLED_FACET_TYPES.add(FACET_COLLISION_CALC_COUNT); + HANDLED_FACET_TYPES.add(FACET_COLLISION_CALC_COUNT_2); + HANDLED_FACET_TYPES.add(FACET_COLLISION_CALC_COUNT_3); + } + + public CollisionCalcProcessor() { + super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); + } + + @Override + protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { + + final CollisionCalcFacet facet = (CollisionCalcFacet) bundle.getFacet(); + final int year = facet.getYear(); + + final CollisionCalcOverviewResult result = (CollisionCalcOverviewResult) getResult(generator, bundle); + + final double[][] points = result.getStationPointsByYear(SInfoResultType.collisionCount, year); + + return buildSeriesForType(points, generator, bundle, theme, visible, null); + } + + public static final Facet createFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, + final int resultIndex, final int year, final int themeCount) { + + // REMARK: we are using themeCount as facet index, because we get several lines (with the same facet name) for the same + // result index; however name and index are used on client side as unique id. + + final CollisionCalcOverviewResult ccoResult = (CollisionCalcOverviewResult) result; + if (ccoResult.getSingleYears() == null) { + final String facetDescription = Resources.getMsg(context.getMeta(), I18N_SERIES_NAME_PATTERN, I18N_SERIES_NAME_PATTERN, result.getLabel()); + return new CollisionCalcFacet(themeCount, resultIndex, -1, FACET_COLLISION_CALC_COUNT, facetDescription, I18N_AXIS_LABEL, ComputeType.ADVANCE, hash, + id); + } else { + final String facetDescription = Resources.getMsg(context.getMeta(), I18N_SERIES_NAME_PATTERN, I18N_SERIES_NAME_PATTERN, Integer.toString(year)); + return new CollisionCalcFacet(themeCount, resultIndex, year, COLLISION_FACETS[themeCount % 3], facetDescription, I18N_AXIS_LABEL, + ComputeType.ADVANCE, hash, id); + } + } +} \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCountProcessor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCountProcessor.java Tue Jul 03 17:00:48 2018 +0200 @@ -0,0 +1,59 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ + +package org.dive4elements.river.artifacts.sinfo.collision; + +import java.util.HashSet; +import java.util.Set; + +import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; +import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.artifacts.CallMeta; +import org.dive4elements.river.artifacts.resources.Resources; +import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoProcessor; +import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; +import org.dive4elements.river.exports.DiagramGenerator; +import org.dive4elements.river.themes.ThemeDocument; + +/** + * Processor to generate a data series for bed collision count data loaded from the database + * + * @author Matthias Schäfer + * + */ +public class CollisionCountProcessor extends AbstractSInfoProcessor { + + public static final String FACET_COLLISION_COUNT = "sinfo_facet_collision_count"; + + private static final String I18N_AXIS_LABEL = "chart.collision_count.section.yaxis.label"; + + private static final String I18N_SERIES_NAME_PATTERN = "collision.count.title"; + + private static final Set HANDLED_FACET_TYPES = new HashSet<>(); + + static { + HANDLED_FACET_TYPES.add(FACET_COLLISION_COUNT); + } + + public CollisionCountProcessor() { + super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); + } + + public static Facet createFacet(final int facetIndex, final CallMeta callMeta, final String year) { + return new CollisionFacet(facetIndex, FACET_COLLISION_COUNT, Resources.getMsg(callMeta, I18N_SERIES_NAME_PATTERN, I18N_SERIES_NAME_PATTERN, year), + I18N_AXIS_LABEL); + } + + @Override + protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { + + return buildSeriesForType(generator, bundle, theme, visible, SInfoResultType.collisionCount, null); + } +} \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionFacet.java Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionFacet.java Tue Jul 03 17:00:48 2018 +0200 @@ -21,7 +21,6 @@ import org.dive4elements.river.artifacts.common.GeneralResultType; import org.dive4elements.river.artifacts.common.ResultRow; import org.dive4elements.river.artifacts.model.BlackboardDataFacet; -import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; import org.dive4elements.river.model.sinfo.Collision; import org.dive4elements.river.model.sinfo.CollisionAggregateValue; @@ -31,12 +30,12 @@ * * @author Matthias Schäfer */ -public class CollisionFacet extends BlackboardDataFacet implements FacetTypes { +public class CollisionFacet extends BlackboardDataFacet { private static final long serialVersionUID = 1; - public CollisionFacet(final String name, final String description, final String yAxisLabel) { - super(0, name, description); + public CollisionFacet(final int facetIndex, final String name, final String description, final String yAxisLabel) { + super(facetIndex, name, description); this.metaData.put("X", "chart.longitudinal.section.xaxis.label"); this.metaData.put("Y", yAxisLabel); @@ -61,8 +60,15 @@ final List values = CollisionAggregateValue.getValuesByKm(series, access.getFrom(true), access.getTo(true)); final Collection rows = new ArrayList<>(); for (final CollisionAggregateValue value : values) { - rows.add(ResultRow.create().putValue(GeneralResultType.station, value.getStation()) // - .putValue(SInfoResultType.collisionCount, value.getCount()).putValue(SInfoResultType.collisionGaugeW, value.getGaugeW())); + + final ResultRow row = ResultRow.create(); + + row.putValue(GeneralResultType.station, value.getStation()); + // Not needed: row.putValue(SInfoResultType.years, series.getYear()); + row.putValue(SInfoResultType.collisionCount, value.getCount()); + row.putValue(SInfoResultType.collisionGaugeW, value.getGaugeW()); + + rows.add(row); } return new DefaultCalculationResult(series.getFilename(), rows); } @@ -74,7 +80,7 @@ */ @Override public CollisionFacet deepCopy() { - final CollisionFacet copy = new CollisionFacet(this.name, this.description, this.metaData.get("Y")); + final CollisionFacet copy = new CollisionFacet(this.index, this.name, this.description, this.metaData.get("Y")); copy.set(this); return copy; } diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionState.java Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionState.java Tue Jul 03 17:00:48 2018 +0200 @@ -22,7 +22,6 @@ import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.model.ReportFacet; import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; -import org.dive4elements.river.artifacts.sinfo.common.CollisionCalcProcessor; import org.dive4elements.river.artifacts.states.DefaultState; /** diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractSInfoProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractSInfoProcessor.java Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractSInfoProcessor.java Tue Jul 03 17:00:48 2018 +0200 @@ -81,10 +81,6 @@ return data; } - protected static final int getDataIndex(final ArtifactAndFacet bundle) { - return ((SInfoResultFacet) bundle.getFacet()).getDataIndex(); - } - /** * @return The axis label */ @@ -246,12 +242,7 @@ protected static final Facet createFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, final int resultIndex, final String axisLabel, final String facetId, final String description) { - return createFacet(context, hash, id, result, resultIndex, -1, axisLabel, facetId, description); - } - - protected static final Facet createFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, - final int resultIndex, final int dataIndex, final String axisLabel, final String facetId, final String description) { final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), description, description, result.getLabel()); - return new SInfoResultFacet(resultIndex, dataIndex, facetId, facetFlowDepthFilteredDescription, axisLabel, ComputeType.ADVANCE, id, hash); + return new SInfoResultFacet(resultIndex, facetId, facetFlowDepthFilteredDescription, axisLabel, ComputeType.ADVANCE, id, hash); } } \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/CollisionCalcProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/CollisionCalcProcessor.java Tue Jul 03 14:26:56 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde - * Software engineering by - * Björnsen Beratende Ingenieure GmbH - * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt - * - * This file is Free Software under the GNU AGPL (>=v3) - * and comes with ABSOLUTELY NO WARRANTY! Check out the - * documentation coming with Dive4Elements River for details. - */ - -package org.dive4elements.river.artifacts.sinfo.common; - -import java.util.HashSet; -import java.util.Set; - -import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; -import org.dive4elements.artifactdatabase.state.Facet; -import org.dive4elements.artifacts.CallContext; -import org.dive4elements.river.artifacts.common.AbstractCalculationResult; -import org.dive4elements.river.artifacts.resources.Resources; -import org.dive4elements.river.artifacts.sinfo.collision.CollisionCalcOverviewResult; -import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; -import org.dive4elements.river.exports.DiagramGenerator; -import org.dive4elements.river.themes.ThemeDocument; - -/** - * Processor to generate the facet and data series of calculated bed collision counts - * - * @author Matthias Schäfer - * - */ -public final class CollisionCalcProcessor extends AbstractSInfoProcessor { - - public static final String FACET_COLLISION_CALC_COUNT = "sinfo_facet_collision_calc_count"; - - public static final String FACET_COLLISION_CALC_COUNT_2 = "sinfo_facet_collision_calc_count.2"; - - public static final String FACET_COLLISION_CALC_COUNT_3 = "sinfo_facet_collision_calc_count.3"; - - private static final String[] COLLISION_FACETS = new String[] { FACET_COLLISION_CALC_COUNT, FACET_COLLISION_CALC_COUNT_2, FACET_COLLISION_CALC_COUNT_3 }; - - private static final String I18N_AXIS_LABEL = "chart.collision_count.section.yaxis.label"; - - private static final String I18N_SERIES_NAME_PATTERN = "collision.count.title"; - - private static final Set HANDLED_FACET_TYPES = new HashSet<>(); - - static { - HANDLED_FACET_TYPES.add(FACET_COLLISION_CALC_COUNT); - HANDLED_FACET_TYPES.add(FACET_COLLISION_CALC_COUNT_2); - HANDLED_FACET_TYPES.add(FACET_COLLISION_CALC_COUNT_3); - } - - public CollisionCalcProcessor() { - super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); - } - - @Override - protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { - - final int year = getDataIndex(bundle); - - final CollisionCalcOverviewResult result = (CollisionCalcOverviewResult) getResult(generator, bundle); - - final double[][] points = result.getStationPointsByYear(SInfoResultType.collisionCount, year); - - return buildSeriesForType(points, generator, bundle, theme, visible, null); - } - - public static final Facet createFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, - final int resultIndex, final int year, final int themeCount) { - - // REMARK: we are using themeCount as facet index, because we get several lines (with the same facet name) for the same - // result index; however name and index are used on client side as unique id. - - final CollisionCalcOverviewResult ccoResult = (CollisionCalcOverviewResult) result; - if (ccoResult.getSingleYears() == null) { - final String facetDescription = Resources.getMsg(context.getMeta(), I18N_SERIES_NAME_PATTERN, I18N_SERIES_NAME_PATTERN, result.getLabel()); - return new SInfoResultFacet(themeCount, resultIndex, -1, FACET_COLLISION_CALC_COUNT, facetDescription, I18N_AXIS_LABEL, ComputeType.ADVANCE, id, - hash); - } else { - final String facetDescription = Resources.getMsg(context.getMeta(), I18N_SERIES_NAME_PATTERN, I18N_SERIES_NAME_PATTERN, Integer.toString(year)); - return new SInfoResultFacet(themeCount, resultIndex, year, COLLISION_FACETS[themeCount % 3], facetDescription, I18N_AXIS_LABEL, ComputeType.ADVANCE, - id, hash); - } - } -} \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/CollisionCountProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/CollisionCountProcessor.java Tue Jul 03 14:26:56 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde - * Software engineering by - * Björnsen Beratende Ingenieure GmbH - * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt - * - * This file is Free Software under the GNU AGPL (>=v3) - * and comes with ABSOLUTELY NO WARRANTY! Check out the - * documentation coming with Dive4Elements River for details. - */ - -package org.dive4elements.river.artifacts.sinfo.common; - -import java.util.HashSet; -import java.util.Set; - -import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; -import org.dive4elements.artifactdatabase.state.Facet; -import org.dive4elements.artifacts.CallMeta; -import org.dive4elements.river.artifacts.resources.Resources; -import org.dive4elements.river.artifacts.sinfo.collision.CollisionFacet; -import org.dive4elements.river.exports.DiagramGenerator; -import org.dive4elements.river.themes.ThemeDocument; - -/** - * Processor to generate a data series for bed collision count data loaded from the database - * - * @author Matthias Schäfer - * - */ -public class CollisionCountProcessor extends AbstractSInfoProcessor { - - // private final static Logger log = Logger.getLogger(CollisionCountProcessor.class); - - public static final String FACET_COLLISION_COUNT = "sinfo_facet_collision_count"; - - private static final String I18N_AXIS_LABEL = "chart.collision_count.section.yaxis.label"; - - private static final String I18N_SERIES_NAME_PATTERN = "collision.count.title"; - - private static final Set HANDLED_FACET_TYPES = new HashSet<>(); - - static { - HANDLED_FACET_TYPES.add(FACET_COLLISION_COUNT); - } - - public CollisionCountProcessor() { - super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); - } - - public static Facet createFacet(final CallMeta callMeta, final String seriesName) { - return new CollisionFacet(FACET_COLLISION_COUNT, Resources.getMsg(callMeta, I18N_SERIES_NAME_PATTERN, I18N_SERIES_NAME_PATTERN, seriesName), - I18N_AXIS_LABEL); - } - - @Override - protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { - - return buildSeriesForType(generator, bundle, theme, visible, SInfoResultType.collisionCount, null); - } - -} \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FloodDurationProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FloodDurationProcessor.java Tue Jul 03 14:26:56 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde - * Software engineering by - * Björnsen Beratende Ingenieure GmbH - * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt - * - * This file is Free Software under the GNU AGPL (>=v3) - * and comes with ABSOLUTELY NO WARRANTY! Check out the - * documentation coming with Dive4Elements River for details. - */ - -package org.dive4elements.river.artifacts.sinfo.common; - -import java.util.HashSet; -import java.util.Set; - -import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; -import org.dive4elements.artifactdatabase.state.Facet; -import org.dive4elements.artifacts.CallContext; -import org.dive4elements.river.artifacts.common.AbstractCalculationResult; -import org.dive4elements.river.artifacts.resources.Resources; -import org.dive4elements.river.artifacts.sinfo.flood_duration.DurationWaterlevel; -import org.dive4elements.river.artifacts.sinfo.flood_duration.FloodDurationCalculationResult; -import org.dive4elements.river.artifacts.sinfo.flood_duration.FloodDurationCalculationResult.ValueGetter; -import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; -import org.dive4elements.river.exports.DiagramGenerator; -import org.dive4elements.river.themes.ThemeDocument; - -/** - * Processor to generate the facet and data series of infrastructure flood durations - * - * @author Matthias Schäfer - * - */ -public final class FloodDurationProcessor extends AbstractSInfoProcessor { - - private static final String FACET_FLOOD_DURATION = "sinfo_facet_flood_duration"; - - private static final String FACET_FLOOD_DURATION_DESCRIPTION = "sinfo_facet_flood_duration.description"; - - private static final String FACET_MAIN_VALUE_DURATION = "mainvalue.duration"; - - private static final String FACET_MAIN_VALUE_DURATION_DESCRIPTION = "mainvalue.duration.description"; - - private static final String I18N_AXIS_LABEL = "sinfo.chart.flood_duration.section.yaxis.label"; - - private static final Set HANDLED_FACET_TYPES = new HashSet<>(); - - static { - HANDLED_FACET_TYPES.add(FACET_FLOOD_DURATION); - HANDLED_FACET_TYPES.add(FACET_MAIN_VALUE_DURATION); - - } - - public FloodDurationProcessor() { - super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); - } - - public static Facet createFloodDurationFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, - final int resultIndex) { - - return AbstractSInfoProcessor.createFacet(context, hash, id, result, resultIndex, -1, I18N_AXIS_LABEL, FACET_FLOOD_DURATION, - FACET_FLOOD_DURATION_DESCRIPTION); - } - - public static Facet createMainValueDurationFacet(final CallContext context, final String hash, final String id, final FloodDurationCalculationResult result, - final int facetIndex, final int resultIndex, final int dataIndex) { - - final String description = Resources.getMsg(context.getMeta(), FACET_MAIN_VALUE_DURATION_DESCRIPTION, FACET_MAIN_VALUE_DURATION_DESCRIPTION, - result.getMainValueLabel(dataIndex)); - - return new SInfoResultFacet(facetIndex, resultIndex, dataIndex, FACET_MAIN_VALUE_DURATION, description, I18N_AXIS_LABEL, ComputeType.ADVANCE, id, hash); - } - - @Override - protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { - final String facetName = bundle.getFacetName(); - - if (FACET_FLOOD_DURATION.contentEquals(facetName)) - return buildSeriesForType(generator, bundle, theme, visible, SInfoResultType.floodDuration, null); - - if (FACET_MAIN_VALUE_DURATION.contentEquals(facetName)) { - - final AbstractCalculationResult data = getResult(generator, bundle); - - if (data instanceof FloodDurationCalculationResult) { - final int index = getDataIndex(bundle); - final FloodDurationCalculationResult.ValueGetter valuegetter = new ValueGetter() { - @Override - public double getValue(final DurationWaterlevel waterlevel) { - return waterlevel.getFloodDurDaysPerYear(); - } - }; - final double[][] points = ((FloodDurationCalculationResult) data).getMainValueDurationPoints(generator, bundle, valuegetter, index); - return buildSeriesForType(points, generator, bundle, theme, visible, null); - } - - } - - final String error = String.format("Unknown facet name: %s", facetName); - throw new UnsupportedOperationException(error); - } - -} \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FloodHeightProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FloodHeightProcessor.java Tue Jul 03 14:26:56 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde - * Software engineering by - * Björnsen Beratende Ingenieure GmbH - * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt - * - * This file is Free Software under the GNU AGPL (>=v3) - * and comes with ABSOLUTELY NO WARRANTY! Check out the - * documentation coming with Dive4Elements River for details. - */ - -package org.dive4elements.river.artifacts.sinfo.common; - -import java.util.HashSet; -import java.util.Set; - -import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; -import org.dive4elements.artifactdatabase.state.Facet; -import org.dive4elements.artifacts.CallContext; -import org.dive4elements.river.artifacts.common.AbstractCalculationResult; -import org.dive4elements.river.artifacts.resources.Resources; -import org.dive4elements.river.artifacts.sinfo.flood_duration.DurationWaterlevel; -import org.dive4elements.river.artifacts.sinfo.flood_duration.FloodDurationCalculationResult; -import org.dive4elements.river.artifacts.sinfo.flood_duration.FloodDurationCalculationResult.ValueGetter; -import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; -import org.dive4elements.river.exports.DiagramGenerator; -import org.dive4elements.river.exports.LongitudinalSectionGenerator; -import org.dive4elements.river.themes.ThemeDocument; - -/** - * Processor to generate the facet and data series of infrastructure flood heights - * - * @author Matthias Schäfer - * - */ -public final class FloodHeightProcessor extends AbstractSInfoProcessor { - - private static final String FACET_FLOOD_HEIGHT = "sinfo_facet_flood_height"; - - private static final String FACET_FLOOD_HEIGHT_DESCRIPTION = "sinfo_facet_flood_height.description"; - - private static final String FACET_MAIN_VALUE_HEIGHT = "mainvalue.w"; - - private static final String FACET_MAIN_VALUE_HEIGHT_DESCRIPTION = "mainvalue.w.description"; - - private static final String I18N_AXIS_LABEL = LongitudinalSectionGenerator.I18N_YAXIS_LABEL; - - private static final Set HANDLED_FACET_TYPES = new HashSet<>(); - - static { - HANDLED_FACET_TYPES.add(FACET_FLOOD_HEIGHT); - HANDLED_FACET_TYPES.add(FACET_MAIN_VALUE_HEIGHT); - } - - public FloodHeightProcessor() { - super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); - } - - public static Facet createFloodHeightFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, - final int index) { - return AbstractSInfoProcessor.createFacet(context, hash, id, result, index, -1, I18N_AXIS_LABEL, FACET_FLOOD_HEIGHT, FACET_FLOOD_HEIGHT_DESCRIPTION); - } - - public static Facet createMainValueHeightFacet(final CallContext context, final String hash, final String id, final FloodDurationCalculationResult result, - final int facetIndex, final int resultIndex, final int dataIndex) { - final String description = Resources.getMsg(context.getMeta(), FACET_MAIN_VALUE_HEIGHT_DESCRIPTION, FACET_MAIN_VALUE_HEIGHT_DESCRIPTION, - result.getMainValueLabel(dataIndex)); - - return new SInfoResultFacet(facetIndex, resultIndex, dataIndex, FACET_MAIN_VALUE_HEIGHT, description, I18N_AXIS_LABEL, ComputeType.ADVANCE, id, hash); - } - - @Override - protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { - - final String facetName = bundle.getFacetName(); - - if (FACET_FLOOD_HEIGHT.contentEquals(facetName)) - return buildSeriesForType(generator, bundle, theme, visible, SInfoResultType.infrastructureHeight, null); - - if (FACET_MAIN_VALUE_HEIGHT.contentEquals(facetName)) { - - final AbstractCalculationResult data = getResult(generator, bundle); - - if (data instanceof FloodDurationCalculationResult) { - final int index = getDataIndex(bundle); - final FloodDurationCalculationResult.ValueGetter valuegetter = new ValueGetter() { - @Override - public double getValue(final DurationWaterlevel waterlevel) { - return waterlevel.getWaterlevel(); - } - }; - final double[][] points = ((FloodDurationCalculationResult) data).getMainValueDurationPoints(generator, bundle, valuegetter, index); - return buildSeriesForType(points, generator, bundle, theme, visible, null); - } - - } - - final String error = String.format("Unknown facet name: %s", facetName); - throw new UnsupportedOperationException(error); - } -} \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultFacet.java Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultFacet.java Tue Jul 03 17:00:48 2018 +0200 @@ -22,14 +22,12 @@ /** * Facet of one of the S-Info curves. */ -public final class SInfoResultFacet extends DataFacet { +public class SInfoResultFacet extends DataFacet { private static final long serialVersionUID = 1L; private static Logger log = Logger.getLogger(SInfoResultFacet.class); - private int dataIndex; - private int resultIndex; public SInfoResultFacet() { @@ -38,35 +36,24 @@ public SInfoResultFacet(final int resultIndex, final String name, final String description, final String yAxisLabelKey, final ComputeType type, final String stateId, final String hash) { - // REMARK: - this(resultIndex, resultIndex, -1, name, description, yAxisLabelKey, type, stateId, hash); + this(resultIndex, resultIndex, name, description, yAxisLabelKey, type, stateId, hash); } - public SInfoResultFacet(final int resultIndex, final int dataIndex, final String name, final String description, final String yAxisLabelKey, + public SInfoResultFacet(final int facetIndex, final int resultIndex, final String name, final String description, final String yAxisLabelKey, final ComputeType type, final String stateId, final String hash) { - // REMARK: in some cases, we have several - this(resultIndex, resultIndex, dataIndex, name, description, yAxisLabelKey, type, stateId, hash); - } - - public SInfoResultFacet(final int facetIndex, final int resultIndex, final int dataIndex, final String name, final String description, - // REMARK: in some cases, we have several data-lines for the same result (which normally determines the facet index) and - // facet name. But index and name are used by the client side as unique keys for the chart themes... - // So we might have different facet index and result index. - final String yAxisLabelKey, final ComputeType type, final String stateId, final String hash) { + // REMARK: in some cases, we have several data-lines for the same result (which normally determines the facet index) and + // facet name. But index and name are used by the client side as unique keys for the chart themes... + // So we might have different facet index and result index. super(facetIndex, name, description, type, hash, stateId); this.resultIndex = resultIndex; - this.dataIndex = dataIndex; + this.metaData.put("X", "sinfo.chart.km.xaxis.label"); this.metaData.put("Y", yAxisLabelKey); } - public int getDataIndex() { - return this.dataIndex; - } - @Override - public Object getData(final Artifact artifact, final CallContext context) { - log.debug("Get data for result at index: " + this.index); + public final Object getData(final Artifact artifact, final CallContext context) { + log.debug("Get data for result at index: " + this.resultIndex); final D4EArtifact flys = (D4EArtifact) artifact; diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculation.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculation.java Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculation.java Tue Jul 03 17:00:48 2018 +0200 @@ -58,14 +58,8 @@ // Calculate the selected main values, if any /* misuse winfo-artifact to calculate waterlevels in the same way */ final WINFOArtifact winfo = new WinfoArtifactWrapper(sinfo); - // FIXME: check! wenn mainValueCount nicht mehr benutzt --> weg! - int mainValueCount = 0; - if (winfo.isW()) - mainValueCount = winfo.getWs().length; - else if (winfo.isQ()) - mainValueCount = winfo.getQs().length; - final FloodDurationCalculationResults results = new FloodDurationCalculationResults(calcModeLabel, user, riverInfo, calcRange, mainValueCount); + final FloodDurationCalculationResults results = new FloodDurationCalculationResults(calcModeLabel, user, riverInfo, calcRange); final FloodDurationCalculationResult result = calculateResult(infrasType, riverside, calcRange, infoProvider, RiversideChoiceKey.fromKey(access.getRiverside()), problems, winfo); diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java Tue Jul 03 17:00:48 2018 +0200 @@ -15,7 +15,6 @@ import java.util.Collections; import java.util.List; -import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; import org.dive4elements.river.artifacts.common.AbstractExportContext; import org.dive4elements.river.artifacts.common.ExportContextCSV; @@ -47,7 +46,7 @@ private final int maxWaterlevelPdf = 3; public interface ValueGetter { - abstract double getValue(DurationWaterlevel waterlevel); + double getValue(DurationWaterlevel waterlevel); } private enum ExportMode { @@ -56,7 +55,7 @@ public FloodDurationCalculationResult(final String label, final String[] mainvalueLabels, final Collection rows) { super(label, rows); - this.mainvalueLabels = mainvalueLabels; // TODO: löschen (?) + this.mainvalueLabels = mainvalueLabels; this.waterlevelCount = mainvalueLabels.length; } @@ -279,9 +278,7 @@ return ""; } - public final double[][] getMainValueDurationPoints(final DiagramGenerator generator, final ArtifactAndFacet bundle, - // final Function valueGetter - final ValueGetter valuegetter, final int dataIndex) { + public final double[][] getMainValueDurationPoints(final DiagramGenerator generator, final ValueGetter valuegetter, final int dataIndex) { final TDoubleArrayList xPoints = new TDoubleArrayList(this.rows.size()); final TDoubleArrayList yPoints = new TDoubleArrayList(this.rows.size()); diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResults.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResults.java Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResults.java Tue Jul 03 17:00:48 2018 +0200 @@ -20,15 +20,7 @@ private static final long serialVersionUID = 1L; - private final int mainValueCount; - - public FloodDurationCalculationResults(final String calcModeLabel, final String user, final RiverInfo river, final DoubleRange calcRange, - final int mainValueCount) { + public FloodDurationCalculationResults(final String calcModeLabel, final String user, final RiverInfo river, final DoubleRange calcRange) { super(calcModeLabel, user, river, calcRange); - this.mainValueCount = mainValueCount; - } - - public int getMainValueCount() { - return this.mainValueCount; } } \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java Tue Jul 03 17:00:48 2018 +0200 @@ -82,6 +82,7 @@ // Merge all stations (range/step, borders of gauge ranges, infrastructures) final Map allStations = new HashMap<>(); final Map secondBank = new HashMap<>(); // any second infrastructure in case of both-banks-option + // FIXME: check, do we really need all stations? compare with tkh... addRangeStations(allStations, winfo); addGaugeLimits(allStations, durFinders.keySet(), calcRange.getMinimumDouble(), calcRange.getMaximumDouble()); addInfrastructures(allStations, secondBank, infras); @@ -197,9 +198,17 @@ final String[] mainValueLabels = new String[wqkmsArray.length]; if (wqkmsArray.length >= 1) { + + // FIXME + // WaterlevelDescriptionBuilder builder = new WaterlevelDescriptionBuilder(artifact, context); + // Labels like Q=123 or W=123 - for (int i = 0; i <= wqkmsArray.length - 1; i++) + for (int i = 0; i <= wqkmsArray.length - 1; i++) { + // FIXME + // String label = builder.getDesc(wqkmsArray[i]); + mainValueLabels[i] = wqkmsArray[i].getName(); + } // Replace labels for named main Q values final GaugeMainValueFinder zoneFinder = GaugeMainValueFinder.loadValues(MainValueTypeKey.Q, gauge, problems); if ((zoneFinder != null) && (qs != null)) { diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationFacet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationFacet.java Tue Jul 03 17:00:48 2018 +0200 @@ -0,0 +1,53 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ +package org.dive4elements.river.artifacts.sinfo.flood_duration; + +import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.river.artifacts.sinfo.common.SInfoResultFacet; +import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; + +/** + * @author Domenico Nardi Tironi + */ +final class FloodDurationFacet extends SInfoResultFacet { + + private static final long serialVersionUID = 1L; + + protected int waterlevelIndex = -1; // for custom result + + private FloodDurationFacet() { + // required for clone operation deepCopy() + } + + public FloodDurationFacet(final int facetIndex, final int resultIndex, final int waterlevelIndex, final String name, final String description, + final ComputeType type, final String yAxisLabelKey, final String hash, final String stateId) { + super(facetIndex, resultIndex, name, description, yAxisLabelKey, type, stateId, hash); + + this.waterlevelIndex = waterlevelIndex; + } + + public int getWaterlevelIndex() { + return this.waterlevelIndex; + } + + /** Copy deeply. */ + @Override + public Facet deepCopy() { + // FIXME: why not simply use the full constructor instead? + final FloodDurationFacet copy = new FloodDurationFacet(); + // FIXME: why does DataFacet does not override set? Bad access to variables of parent! + copy.set(this); + copy.type = this.type; + copy.hash = this.hash; + copy.stateId = this.stateId; + copy.waterlevelIndex = this.waterlevelIndex; + return copy; + } +} \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationProcessor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationProcessor.java Tue Jul 03 17:00:48 2018 +0200 @@ -0,0 +1,104 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ + +package org.dive4elements.river.artifacts.sinfo.flood_duration; + +import java.util.HashSet; +import java.util.Set; + +import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; +import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.river.artifacts.common.AbstractCalculationResult; +import org.dive4elements.river.artifacts.resources.Resources; +import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoProcessor; +import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; +import org.dive4elements.river.artifacts.sinfo.flood_duration.FloodDurationCalculationResult.ValueGetter; +import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; +import org.dive4elements.river.exports.DiagramGenerator; +import org.dive4elements.river.themes.ThemeDocument; + +/** + * Processor to generate the facet and data series of infrastructure flood durations + * + * @author Matthias Schäfer + * + */ +public final class FloodDurationProcessor extends AbstractSInfoProcessor { + + private static final String FACET_FLOOD_DURATION = "sinfo_facet_flood_duration"; + + private static final String FACET_FLOOD_DURATION_DESCRIPTION = "sinfo_facet_flood_duration.description"; + + private static final String FACET_MAIN_VALUE_DURATION = "mainvalue.duration"; + + private static final String FACET_MAIN_VALUE_DURATION_DESCRIPTION = "mainvalue.duration.description"; + + private static final String I18N_AXIS_LABEL = "sinfo.chart.flood_duration.section.yaxis.label"; + + private static final Set HANDLED_FACET_TYPES = new HashSet<>(); + + static { + HANDLED_FACET_TYPES.add(FACET_FLOOD_DURATION); + HANDLED_FACET_TYPES.add(FACET_MAIN_VALUE_DURATION); + + } + + public FloodDurationProcessor() { + super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); + } + + public static Facet createFloodDurationFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, + final int resultIndex) { + + return AbstractSInfoProcessor.createFacet(context, hash, id, result, resultIndex, I18N_AXIS_LABEL, FACET_FLOOD_DURATION, + FACET_FLOOD_DURATION_DESCRIPTION); + } + + public static Facet createMainValueDurationFacet(final CallContext context, final String hash, final String id, final FloodDurationCalculationResult result, + final int facetIndex, final int resultIndex, final int dataIndex) { + + final String description = Resources.getMsg(context.getMeta(), FACET_MAIN_VALUE_DURATION_DESCRIPTION, FACET_MAIN_VALUE_DURATION_DESCRIPTION, + result.getMainValueLabel(dataIndex)); + + return new FloodDurationFacet(facetIndex, resultIndex, dataIndex, FACET_MAIN_VALUE_DURATION, description, ComputeType.ADVANCE, I18N_AXIS_LABEL, hash, + id); + } + + @Override + protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { + final String facetName = bundle.getFacetName(); + + if (FACET_FLOOD_DURATION.contentEquals(facetName)) + return buildSeriesForType(generator, bundle, theme, visible, SInfoResultType.floodDuration, null); + + if (FACET_MAIN_VALUE_DURATION.contentEquals(facetName)) { + + final AbstractCalculationResult data = getResult(generator, bundle); + + final FloodDurationFacet facet = (FloodDurationFacet) bundle.getFacet(); + final int index = facet.getWaterlevelIndex(); + + if (data instanceof FloodDurationCalculationResult) { + final FloodDurationCalculationResult.ValueGetter valuegetter = new ValueGetter() { + @Override + public double getValue(final DurationWaterlevel waterlevel) { + return waterlevel.getFloodDurDaysPerYear(); + } + }; + final double[][] points = ((FloodDurationCalculationResult) data).getMainValueDurationPoints(generator, valuegetter, index); + return buildSeriesForType(points, generator, bundle, theme, visible, null); + } + } + + final String error = String.format("Unknown facet name: %s", facetName); + throw new UnsupportedOperationException(error); + } +} \ No newline at end of file diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationState.java Tue Jul 03 14:26:56 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationState.java Tue Jul 03 17:00:48 2018 +0200 @@ -21,8 +21,6 @@ import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.model.ReportFacet; import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; -import org.dive4elements.river.artifacts.sinfo.common.FloodDurationProcessor; -import org.dive4elements.river.artifacts.sinfo.common.FloodHeightProcessor; import org.dive4elements.river.artifacts.states.DefaultState; /** @@ -91,6 +89,7 @@ final String waterlevelLabel = result.getMainValueLabel(j); // FIXME: use label as label for theme + // final int facetIndex, final int resultIndex, final int dataIndex facets.add(FloodDurationProcessor.createMainValueDurationFacet(context, hash, this.id, result, themeCount, resultIndex, j)); facets.add(FloodHeightProcessor.createMainValueHeightFacet(context, hash, this.id, result, themeCount, resultIndex, j)); diff -r 091fd9676496 -r 0fc9c82e744e artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodHeightProcessor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodHeightProcessor.java Tue Jul 03 17:00:48 2018 +0200 @@ -0,0 +1,101 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ + +package org.dive4elements.river.artifacts.sinfo.flood_duration; + +import java.util.HashSet; +import java.util.Set; + +import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; +import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.river.artifacts.common.AbstractCalculationResult; +import org.dive4elements.river.artifacts.resources.Resources; +import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoProcessor; +import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; +import org.dive4elements.river.artifacts.sinfo.flood_duration.FloodDurationCalculationResult.ValueGetter; +import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; +import org.dive4elements.river.exports.DiagramGenerator; +import org.dive4elements.river.exports.LongitudinalSectionGenerator; +import org.dive4elements.river.themes.ThemeDocument; + +/** + * Processor to generate the facet and data series of infrastructure flood heights + * + * @author Matthias Schäfer + * + */ +public final class FloodHeightProcessor extends AbstractSInfoProcessor { + + private static final String FACET_FLOOD_HEIGHT = "sinfo_facet_flood_height"; + + private static final String FACET_FLOOD_HEIGHT_DESCRIPTION = "sinfo_facet_flood_height.description"; + + private static final String FACET_MAIN_VALUE_HEIGHT = "mainvalue.w"; + + private static final String FACET_MAIN_VALUE_HEIGHT_DESCRIPTION = "mainvalue.w.description"; + + private static final String I18N_AXIS_LABEL = LongitudinalSectionGenerator.I18N_YAXIS_LABEL; + + private static final Set HANDLED_FACET_TYPES = new HashSet<>(); + + static { + HANDLED_FACET_TYPES.add(FACET_FLOOD_HEIGHT); + HANDLED_FACET_TYPES.add(FACET_MAIN_VALUE_HEIGHT); + } + + public FloodHeightProcessor() { + super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); + } + + public static Facet createFloodHeightFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, + final int index) { + return AbstractSInfoProcessor.createFacet(context, hash, id, result, index, I18N_AXIS_LABEL, FACET_FLOOD_HEIGHT, FACET_FLOOD_HEIGHT_DESCRIPTION); + } + + public static Facet createMainValueHeightFacet(final CallContext context, final String hash, final String id, final FloodDurationCalculationResult result, + final int facetIndex, final int resultIndex, final int dataIndex) { + final String description = Resources.getMsg(context.getMeta(), FACET_MAIN_VALUE_HEIGHT_DESCRIPTION, FACET_MAIN_VALUE_HEIGHT_DESCRIPTION, + result.getMainValueLabel(dataIndex)); + + return new FloodDurationFacet(facetIndex, resultIndex, dataIndex, FACET_MAIN_VALUE_HEIGHT, description, ComputeType.ADVANCE, I18N_AXIS_LABEL, hash, id); + } + + @Override + protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { + + final String facetName = bundle.getFacetName(); + + if (FACET_FLOOD_HEIGHT.contentEquals(facetName)) + return buildSeriesForType(generator, bundle, theme, visible, SInfoResultType.infrastructureHeight, null); + + if (FACET_MAIN_VALUE_HEIGHT.contentEquals(facetName)) { + + final AbstractCalculationResult data = getResult(generator, bundle); + + final FloodDurationFacet facet = (FloodDurationFacet) bundle.getFacet(); + final int index = facet.getWaterlevelIndex(); + + if (data instanceof FloodDurationCalculationResult) { + final FloodDurationCalculationResult.ValueGetter valuegetter = new ValueGetter() { + @Override + public double getValue(final DurationWaterlevel waterlevel) { + return waterlevel.getWaterlevel(); + } + }; + final double[][] points = ((FloodDurationCalculationResult) data).getMainValueDurationPoints(generator, valuegetter, index); + return buildSeriesForType(points, generator, bundle, theme, visible, null); + } + } + + final String error = String.format("Unknown facet name: %s", facetName); + throw new UnsupportedOperationException(error); + } +} \ No newline at end of file