Skip to content

Commit

Permalink
fixing some code warnings
Browse files Browse the repository at this point in the history
that were shown by CPD, PMD, Checkstyle, etc.
  • Loading branch information
FabiKo117 committed Feb 19, 2020
1 parent 266b88f commit 171ebd5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ public boolean snapshotMatches(OSMEntitySnapshot snapshot, Set<OSMType> osmTypes
}
if (!simpleFeatureTypes.isEmpty()) {
boolean[] simpleFeatures = setRequestedSimpleFeatures(simpleFeatureTypes);
return matchesTags && ((simpleFeatures[0] && snapshot.getGeometry() instanceof Puntal)
|| (simpleFeatures[1] && snapshot.getGeometry() instanceof Lineal)
|| (simpleFeatures[2] && snapshot.getGeometry() instanceof Polygonal)
|| (simpleFeatures[3]
&& "GeometryCollection".equalsIgnoreCase(snapshot.getGeometry().getGeometryType())));
return matchesTags && simpleFeatures[0] && snapshot.getGeometry() instanceof Puntal
|| simpleFeatures[1] && snapshot.getGeometry() instanceof Lineal
|| simpleFeatures[2] && snapshot.getGeometry() instanceof Polygonal
|| simpleFeatures[3]
&& "GeometryCollection".equalsIgnoreCase(snapshot.getGeometry().getGeometryType());
}
return matchesTags;
}
Expand Down Expand Up @@ -277,7 +277,7 @@ public void writeCsvResponse(GroupByObject[] resultSet, HttpServletResponse serv
}
} else {
rows = createCsvResponseForElementsRatioGroupBy(resultSet);
}
}
writer.writeNext(rows.getLeft().toArray(new String[rows.getLeft().size()]), false);
writer.writeAll(rows.getRight(), false);
writer.close();
Expand Down Expand Up @@ -620,11 +620,11 @@ public ElementsResult[] fillElementsResult(SortedMap<OSHDBTimestamp, ? extends N
if (isDensity) {
results[count] = new ElementsResult(
TimestampFormatter.getInstance().isoDateTime(entry.getKey()), Double.parseDouble(
df.format((entry.getValue().doubleValue() / (Geo.areaOf(geom) * 0.000001)))));
df.format(entry.getValue().doubleValue() / (Geo.areaOf(geom) * 0.000001))));
} else {
results[count] =
new ElementsResult(TimestampFormatter.getInstance().isoDateTime(entry.getKey()),
Double.parseDouble(df.format((entry.getValue().doubleValue()))));
Double.parseDouble(df.format(entry.getValue().doubleValue())));
}
count++;
}
Expand All @@ -642,7 +642,7 @@ public UsersResult[] fillUsersResult(SortedMap<OSHDBTimestamp, ? extends Number>
results[count] =
new UsersResult(TimestampFormatter.getInstance().isoDateTime(entry.getKey()),
toTimestamps[count + 1], Double.parseDouble(
df.format((entry.getValue().doubleValue() / (Geo.areaOf(geom) / 1000000)))));
df.format(entry.getValue().doubleValue() / (Geo.areaOf(geom) / 1000000))));
} else {
results[count] = new UsersResult(
TimestampFormatter.getInstance().isoDateTime(entry.getKey()), toTimestamps[count + 1],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public String findEpsg(double lon, double lat) {
zoneNumber = 37;
}
}
String isNorth = (lat > 0) ? "6" : "7";
String zone = (zoneNumber < 10) ? "0" + zoneNumber : "" + zoneNumber;
String isNorth = lat > 0 ? "6" : "7";
String zone = zoneNumber < 10 ? "0" + zoneNumber : "" + zoneNumber;
return "EPSG:32" + isNorth + zone;
}

Expand Down Expand Up @@ -369,11 +369,11 @@ public <T extends OSHDBMapReducible> MapReducer<T> filterOnPlanarRelations(MapRe
*/
public boolean checkGeometryOnSimpleFeatures(Geometry geom,
Set<SimpleFeatureType> simpleFeatureTypes) {
return (simpleFeatureTypes.contains(SimpleFeatureType.POLYGON) && geom instanceof Polygonal)
|| (simpleFeatureTypes.contains(SimpleFeatureType.POINT) && geom instanceof Puntal)
|| (simpleFeatureTypes.contains(SimpleFeatureType.LINE) && geom instanceof Lineal)
|| (simpleFeatureTypes.contains(SimpleFeatureType.OTHER)
&& GEOMCOLLTYPE.equalsIgnoreCase(geom.getGeometryType()));
return simpleFeatureTypes.contains(SimpleFeatureType.POLYGON) && geom instanceof Polygonal
|| simpleFeatureTypes.contains(SimpleFeatureType.POINT) && geom instanceof Puntal
|| simpleFeatureTypes.contains(SimpleFeatureType.LINE) && geom instanceof Lineal
|| simpleFeatureTypes.contains(SimpleFeatureType.OTHER)
&& GEOMCOLLTYPE.equalsIgnoreCase(geom.getGeometryType());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public void checkKeysValues(String[] keys, String[] values) throws BadRequestExc
*/
public boolean compareKeysValues(String[] keys, String[] keys2, String[] values,
String[] values2) {
return (Arrays.equals(keys, keys2) && Arrays.equals(values, values2));
return Arrays.equals(keys, keys2) && Arrays.equals(values, values2);
}

/** Used in /ratio requests. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public static boolean cacheNotAllowed(String url, String[] timeParameter) {
* @return whether it is a data-extraction request, or not
*/
public static boolean isDataExtraction(String url) {
return (url.contains("elementsFullHistory") || url.contains("elements/geometry")
|| url.contains("elements/centroid") || url.contains("elements/bbox"));
return url.contains("elementsFullHistory") || url.contains("elements/geometry")
|| url.contains("elements/centroid") || url.contains("elements/bbox");
}

/**
Expand Down Expand Up @@ -134,7 +134,7 @@ private static boolean usesDefaultToTimestamp(String[] timeParameter) {
if (length != 1) {
return false;
}
return (timeParameter[0].contains("//") || timeParameter[0].endsWith("/"));
return timeParameter[0].contains("//") || timeParameter[0].endsWith("/");
}

/**
Expand Down

0 comments on commit 171ebd5

Please sign in to comment.