Source:
<code><START> public QueryRunner<Result<TopNResultValue>> postMergeQueryDecoration(final QueryRunner<Result<TopNResultValue>> runner) <END> { final ThresholdAdjustingQueryRunner thresholdRunner = new ThresholdAdjustingQueryRunner( runner, config.getMinTopNThreshold() ); return new QueryRunner<Result<TopNResultValue>>() { @Override public Sequence<Result<TopNResultValue>> run( final Query<Result<TopNResultValue>> query, final Map<String, Object> responseContext ) { final Sequence<Result<TopNResultValue>> resultSequence = thresholdRunner.run(query, responseContext); if (!(query instanceof TopNQuery)) { return resultSequence; } TopNQuery topNQuery = (TopNQuery) query; if (!TopNQueryEngine.canApplyExtractionInPost(topNQuery)) { return resultSequence; } else { return Sequences.map( resultSequence, new Function<Result<TopNResultValue>, Result<TopNResultValue>>() { @Nullable @Override public Result<TopNResultValue> apply(@Nullable Result<TopNResultValue> input) { TopNResultValue resultValue = input.getValue(); return new Result<TopNResultValue>( input.getTimestamp(), new TopNResultValue( Lists.transform( resultValue.getValue(), new Function<DimensionAndMetricValueExtractor, DimensionAndMetricValueExtractor>() { @Nullable @Override public DimensionAndMetricValueExtractor apply( @Nullable DimensionAndMetricValueExtractor input ) { String dimOutputName = ((TopNQuery) query).getDimensionSpec().getOutputName(); String dimValue = input.getStringDimensionValue(dimOutputName); Map<String, Object> map = input.getBaseObject(); map.remove(dimOutputName); map.put( dimOutputName, ((TopNQuery) query).getDimensionSpec().getExtractionFn().apply(dimValue) ); return input; } } ) ) ); } } ); } } }; }</code><technical_language>this method. move meat mergeResults()? Or, if in this a separate method, give a more semantically meaningful name for is call mergeResults() instead</technical_language>

Target:
public QueryRunner<Result<TopNResultValue>> postMergeQueryDecoration(final QueryRunner<Result<TopNResultValue>> runner) { final ThresholdAdjustingQueryRunner thresholdRunner = new ThresholdAdjustingQueryRunner( runner, config.getMinTopNThreshold() ); return new QueryRunner<Result<TopNResultValue>>() { @Override public Sequence<Result<TopNResultValue>> run( final Query<Result<TopNResultValue>> query, final Map<String, Object> responseContext ) { final Sequence<Result<TopNResultValue>> resultSequence = thresholdRunner.run(query, responseContext); final TopNQuery topNQuery = (TopNQuery) query; if (!TopNQueryEngine.canApplyExtractionInPost(topNQuery)) { return resultSequence; } else { return Sequences.map( resultSequence, new Function<Result<TopNResultValue>, Result<TopNResultValue>>() { @Override public Result<TopNResultValue> apply(Result<TopNResultValue> input) { TopNResultValue resultValue = input.getValue(); return new Result<TopNResultValue>( input.getTimestamp(), new TopNResultValue( Lists.transform( resultValue.getValue(), new Function<DimensionAndMetricValueExtractor, DimensionAndMetricValueExtractor>() { @Override public DimensionAndMetricValueExtractor apply( DimensionAndMetricValueExtractor input ) { String dimOutputName = topNQuery.getDimensionSpec().getOutputName(); String dimValue = input.getStringDimensionValue(dimOutputName); Map<String, Object> map = input.getBaseObject(); map.put( dimOutputName, topNQuery.getDimensionSpec().getExtractionFn().apply(dimValue) ); return input; } } ) ) ); } } ); } } }; }