6161import org .heigit .bigspatialdata .oshdb .util .tagtranslator .OSMTag ;
6262import org .heigit .bigspatialdata .oshdb .util .tagtranslator .TagTranslator ;
6363import org .heigit .bigspatialdata .oshdb .util .time .TimestampFormatter ;
64- import org .heigit .ohsome .filter .FilterExpression ;
6564import org .heigit .ohsome .ohsomeapi .Application ;
6665import org .heigit .ohsome .ohsomeapi .controller .rawdata .ElementsGeometry ;
6766import org .heigit .ohsome .ohsomeapi .exception .DatabaseAccessException ;
@@ -123,10 +122,10 @@ public MapReducer<OSMEntitySnapshot> snapshotFilter(MapReducer<OSMEntitySnapshot
123122 */
124123 public MapAggregator <OSHDBCombinedIndex <OSHDBTimestamp , Integer >, OSMEntitySnapshot >
125124 snapshotFilter (
126- MapAggregator <OSHDBCombinedIndex <OSHDBTimestamp , Integer >, OSMEntitySnapshot > mapRed ,
127- Set <OSMType > osmTypes1 , Set <OSMType > osmTypes2 , Set < SimpleFeatureType > simpleFeatureTypes1 ,
128- Set <SimpleFeatureType > simpleFeatureTypes2 , Integer [] keysInt1 , Integer [] keysInt2 ,
129- Integer [] valuesInt1 , Integer [] valuesInt2 ) {
125+ MapAggregator <OSHDBCombinedIndex <OSHDBTimestamp , Integer >, OSMEntitySnapshot > mapRed ,
126+ Set <OSMType > osmTypes1 , Set <OSMType > osmTypes2 ,
127+ Set <SimpleFeatureType > simpleFeatureTypes1 , Set < SimpleFeatureType > simpleFeatureTypes2 ,
128+ Integer [] keysInt1 , Integer [] keysInt2 , Integer [] valuesInt1 , Integer [] valuesInt2 ) {
130129 return mapRed .filter (
131130 snapshot -> snapshotMatches (snapshot , osmTypes1 , simpleFeatureTypes1 , keysInt1 , valuesInt1 )
132131 || snapshotMatches (snapshot , osmTypes2 , simpleFeatureTypes2 , keysInt2 , valuesInt2 ));
@@ -226,16 +225,15 @@ SortedMap<V, SortedMap<U, A>> nest(Map<OSHDBCombinedIndex<U, V>, A> result) {
226225 * {@link com.fasterxml.jackson.core.JsonGenerator#writeObject(Object) writeObject},
227226 * {@link javax.servlet.ServletResponse#getOutputStream() getOutputStream},
228227 * {@link java.io.OutputStream#write(byte[]) write},
229- * {@link org.heigit.ohsome.ohsomeapi.executor.ExecutionUtils
230- * #writeStreamResponse(ThreadLocal, Stream, ThreadLocal, ServletOutputStream)
228+ * {@link org.heigit.ohsome.ohsomeapi.executor.ExecutionUtils #writeStreamResponse(ThreadLocal, Stream, ThreadLocal, ServletOutputStream)
231229 * writeStreamResponse}, {@link javax.servlet.ServletOutputStream#print(String) print},
232230 * and {@link javax.servlet.ServletResponse#flushBuffer() flushBuffer}
233231 * @throws ExecutionException thrown by
234- * {@link org.heigit.ohsome.ohsomeapi.executor.ExecutionUtils#writeStreamResponse(
235- * ThreadLocal, Stream, ThreadLocal, ServletOutputStream) writeStreamResponse}
232+ * {@link org.heigit.ohsome.ohsomeapi.executor.ExecutionUtils#writeStreamResponse( ThreadLocal, Stream, ThreadLocal, ServletOutputStream)
233+ * writeStreamResponse}
236234 * @throws InterruptedException thrown by
237- * {@link org.heigit.ohsome.ohsomeapi.executor.ExecutionUtils#writeStreamResponse(
238- * ThreadLocal, Stream, ThreadLocal, ServletOutputStream) writeStreamResponse}
235+ * {@link org.heigit.ohsome.ohsomeapi.executor.ExecutionUtils#writeStreamResponse( ThreadLocal, Stream, ThreadLocal, ServletOutputStream)
236+ * writeStreamResponse}
239237 */
240238 public void streamResponse (HttpServletResponse servletResponse , DataResponse osmData ,
241239 Stream <org .wololo .geojson .Feature > resultStream ) throws Exception {
@@ -450,10 +448,10 @@ public org.wololo.geojson.Feature createOSMFeature(OSMEntity entity, Geometry ge
450448 */
451449 @ SuppressWarnings ({"unchecked" }) // intentionally suppressed as type format is valid
452450 public <K extends Comparable <K > & Serializable , V extends Number >
453- SortedMap <OSHDBCombinedIndex <OSHDBTimestamp , K >, V > computeResult (
454- RequestResource requestResource ,
455- MapAggregator <OSHDBCombinedIndex <OSHDBTimestamp , K >, OSMEntitySnapshot > preResult )
456- throws Exception {
451+ SortedMap <OSHDBCombinedIndex <OSHDBTimestamp , K >, V >
452+ computeResult ( RequestResource requestResource ,
453+ MapAggregator <OSHDBCombinedIndex <OSHDBTimestamp , K >, OSMEntitySnapshot > preResult )
454+ throws Exception {
457455 switch (requestResource ) {
458456 case COUNT :
459457 return (SortedMap <OSHDBCombinedIndex <OSHDBTimestamp , K >, V >) preResult .count ();
@@ -486,28 +484,27 @@ SortedMap<OSHDBCombinedIndex<OSHDBTimestamp, K>, V> computeResult(
486484 @ SuppressWarnings ({"unchecked" }) // intentionally suppressed as type format is valid
487485 public <K extends Comparable <K > & Serializable , V extends Number >
488486 SortedMap <OSHDBCombinedIndex <OSHDBCombinedIndex <Integer , K >, OSHDBTimestamp >, V >
489- computeNestedResult (
490- RequestResource requestResource ,
491- MapAggregator <OSHDBCombinedIndex <OSHDBCombinedIndex <Integer , K >, OSHDBTimestamp >, Geometry >
492- preResult ) throws Exception {
487+ computeNestedResult (RequestResource requestResource ,
488+ MapAggregator <OSHDBCombinedIndex <OSHDBCombinedIndex <Integer , K >, OSHDBTimestamp >, Geometry > preResult )
489+ throws Exception {
493490 switch (requestResource ) {
494491 case COUNT :
495- return (SortedMap <OSHDBCombinedIndex <OSHDBCombinedIndex <Integer , K >, OSHDBTimestamp >, V >)
496- preResult .count ();
492+ return (SortedMap <OSHDBCombinedIndex <OSHDBCombinedIndex <Integer , K >, OSHDBTimestamp >, V >) preResult
493+ .count ();
497494 case PERIMETER :
498- return (SortedMap <OSHDBCombinedIndex <OSHDBCombinedIndex <Integer , K >, OSHDBTimestamp >, V >)
499- preResult .sum (geom -> {
495+ return (SortedMap <OSHDBCombinedIndex <OSHDBCombinedIndex <Integer , K >, OSHDBTimestamp >, V >) preResult
496+ .sum (geom -> {
500497 if (!(geom instanceof Polygonal )) {
501498 return 0.0 ;
502499 }
503500 return cacheInUserData (geom , () -> Geo .lengthOf (geom .getBoundary ()));
504501 });
505502 case LENGTH :
506- return (SortedMap <OSHDBCombinedIndex <OSHDBCombinedIndex <Integer , K >, OSHDBTimestamp >, V >)
507- preResult .sum (geom -> cacheInUserData (geom , () -> Geo .lengthOf (geom )));
503+ return (SortedMap <OSHDBCombinedIndex <OSHDBCombinedIndex <Integer , K >, OSHDBTimestamp >, V >) preResult
504+ .sum (geom -> cacheInUserData (geom , () -> Geo .lengthOf (geom )));
508505 case AREA :
509- return (SortedMap <OSHDBCombinedIndex <OSHDBCombinedIndex <Integer , K >, OSHDBTimestamp >, V >)
510- preResult .sum (geom -> cacheInUserData (geom , () -> Geo .areaOf (geom )));
506+ return (SortedMap <OSHDBCombinedIndex <OSHDBCombinedIndex <Integer , K >, OSHDBTimestamp >, V >) preResult
507+ .sum (geom -> cacheInUserData (geom , () -> Geo .areaOf (geom )));
511508 default :
512509 return null ;
513510 }
@@ -587,8 +584,7 @@ public Double[] fillElementsRatioGroupByBoundaryResultValues(
587584 DecimalFormat df ) {
588585 Double [] resultValues = new Double [resultSet .size ()];
589586 int valueCount = 0 ;
590- for (Entry <OSHDBCombinedIndex <OSHDBTimestamp , Integer >, ? extends Number > innerEntry :
591- resultSet ) {
587+ for (Entry <OSHDBCombinedIndex <OSHDBTimestamp , Integer >, ? extends Number > innerEntry : resultSet ) {
592588 resultValues [valueCount ] = Double .parseDouble (df .format (innerEntry .getValue ().doubleValue ()));
593589 valueCount ++;
594590 }
@@ -746,8 +742,8 @@ public String combineFiltersWithOr(String firstFilter, String secondFilter) {
746742 * containing <code>ElementsResult</code> objects
747743 * @return <code>Pair</code> containing the column names (left) and the data rows (right)
748744 */
749- private ImmutablePair <List <String >, List <String []>> createCsvResponseForElementsGroupBy (
750- GroupByObject [] resultSet ) {
745+ private ImmutablePair <List <String >, List <String []>>
746+ createCsvResponseForElementsGroupBy ( GroupByObject [] resultSet ) {
751747 List <String > columnNames = new LinkedList <>();
752748 columnNames .add ("timestamp" );
753749 List <String []> rows = new LinkedList <>();
@@ -782,8 +778,8 @@ private ImmutablePair<List<String>, List<String[]>> createCsvResponseForElements
782778 * objects containing <code>RatioResult</code> objects
783779 * @return <code>Pair</code> containing the column names (left) and the data rows (right)
784780 */
785- private ImmutablePair <List <String >, List <String []>> createCsvResponseForElementsRatioGroupBy (
786- GroupByObject [] resultSet ) {
781+ private ImmutablePair <List <String >, List <String []>>
782+ createCsvResponseForElementsRatioGroupBy ( GroupByObject [] resultSet ) {
787783 List <String > columnNames = new LinkedList <>();
788784 columnNames .add ("timestamp" );
789785 List <String []> rows = new LinkedList <>();
@@ -792,8 +788,8 @@ private ImmutablePair<List<String>, List<String[]>> createCsvResponseForElements
792788 columnNames .add (ratioGroupByResult .getGroupByObject () + "_value" );
793789 columnNames .add (ratioGroupByResult .getGroupByObject () + "_value2" );
794790 columnNames .add (ratioGroupByResult .getGroupByObject () + "_ratio" );
795- for (int j = 0 ; j < ratioGroupByResult .getRatioResult ().length ; j ++) {
796- RatioResult ratioResult = ratioGroupByResult .getRatioResult ()[j ];
791+ for (int j = 0 ; j < ratioGroupByResult .getResult ().length ; j ++) {
792+ RatioResult ratioResult = ratioGroupByResult .getResult ()[j ];
797793 if (i == 0 ) {
798794 String [] row = new String [resultSet .length * 3 + 1 ];
799795 row [0 ] = ratioResult .getTimestamp ();
@@ -819,8 +815,8 @@ private ImmutablePair<List<String>, List<String[]>> createCsvResponseForElements
819815 * containing <code>UsersResult</code> objects
820816 * @return <code>Pair</code> containing the column names (left) and the data rows (right)
821817 */
822- private ImmutablePair <List <String >, List <String []>> createCsvResponseForUsersGroupBy (
823- GroupByObject [] resultSet ) {
818+ private ImmutablePair <List <String >, List <String []>>
819+ createCsvResponseForUsersGroupBy ( GroupByObject [] resultSet ) {
824820 List <String > columnNames = new LinkedList <>();
825821 columnNames .add ("fromTimestamp" );
826822 columnNames .add ("toTimestamp" );
0 commit comments