Mercurial > dive4elements > river
changeset 7550:13876b523e33
Minor refactoring for future readability and refactoring.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 11 Nov 2013 11:33:53 +0100 |
parents | 783b295c35d3 |
children | 4f1ba4b5fc1f |
files | artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java |
diffstat | 1 files changed, 18 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java Tue Nov 12 16:54:18 2013 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java Mon Nov 11 11:33:53 2013 +0100 @@ -43,16 +43,18 @@ boolean visible) { CallContext context = generator.getCallContext(); Object data = bundle.getData(context); - if (data instanceof BedDiffYearResult) { - BedDiffYearResult bData = (BedDiffYearResult) data; - XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme); - StyledSeriesBuilder.addPoints(series, bData.getHeightPerYearData(), false, GAP_TOLERANCE); - generator.addAxisSeries(series, axisName, visible); + if (!(data instanceof BedDiffYearResult)) { + // Should not happen if canHandle is correct + logger.error("Can't process " + data.getClass().getName() + " objects"); return; } - // Should not happen if canHandle is correct - logger.error("Can't process " + data.getClass().getName() + " objects"); + + BedDiffYearResult bData = (BedDiffYearResult) data; + XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme); + StyledSeriesBuilder.addPoints(series, bData.getHeightPerYearData(), false, GAP_TOLERANCE); + + generator.addAxisSeries(series, axisName, visible); } @Override @@ -65,16 +67,18 @@ ) { CallContext context = generator.getCallContext(); Object data = bundle.getData(context); - if (data instanceof BedDiffYearResult) { - BedDiffYearResult bData = (BedDiffYearResult) data; - XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme); - StyledSeriesBuilder.addPoints(series, bData.getHeightPerYearData(), false, GAP_TOLERANCE); - generator.addAxisSeries(series, index, visible); + if (!(data instanceof BedDiffYearResult)) { + // Should not happen if canHandle is correct + logger.error("Can't process " + data.getClass().getName() + " objects"); return; } - // Should not happen if canHandle is correct - logger.error("Can't process " + data.getClass().getName() + " objects"); + + BedDiffYearResult bData = (BedDiffYearResult) data; + XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme); + StyledSeriesBuilder.addPoints(series, bData.getHeightPerYearData(), false, GAP_TOLERANCE); + + generator.addAxisSeries(series, index, visible); } @Override