Skip to content

Commit

Permalink
renaming of methods
Browse files Browse the repository at this point in the history
  • Loading branch information
kowatsch committed May 11, 2018
1 parent 6894ef2 commit cbdb292
Showing 1 changed file with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ public Geometry getGeometry(BoundaryType boundary, GeometryBuilder geomBuilder)
* @return <code>SortedMap</code> result object.
* @throws Exception
*/
public SortedMap<OSHDBTimestampAndIndex<Integer>, ? extends Number> computeCountLengthPerimeterAreaGBBResult(
RequestResource requestResource, BoundaryType bType, MapReducer<? extends OSHDBMapReducible> mapRed,
GeometryBuilder geomBuilder, boolean isSnapshot) throws Exception {
public SortedMap<OSHDBTimestampAndIndex<Integer>, ? extends Number> computeCountLengthPerimeterAreaGBB(
RequestResource requestResource, BoundaryType bType,
MapReducer<? extends OSHDBMapReducible> mapRed, GeometryBuilder geomBuilder,
boolean isSnapshot) throws Exception {

if (bType == BoundaryType.NOBOUNDARY)
throw new BadRequestException(
Expand All @@ -119,13 +120,13 @@ public Geometry getGeometry(BoundaryType boundary, GeometryBuilder geomBuilder)
zeroFill.add(j);
preResult = mapRed.flatMap(f -> {
List<Pair<Integer, Geometry>> res = new LinkedList<>();
Geometry entityGeom;
if (isSnapshot)
Geometry entityGeom;
if (isSnapshot) {
entityGeom = getSnapshotGeom(f);
else
if (requestResource.equals(RequestResource.PERIMETER))
entityGeom = entityGeom.getBoundary();
} else {
entityGeom = getContributionGeom(f);
if (requestResource.equals(RequestResource.PERIMETER)) {
entityGeom = entityGeom.getBoundary();
}
for (int i = 0; i < geoms.size(); i++) {
if (entityGeom.intersects(geoms.get(i))) {
Expand Down Expand Up @@ -167,7 +168,7 @@ public Geometry getGeometry(BoundaryType boundary, GeometryBuilder geomBuilder)
* @throws UnsupportedOperationException
* @throws Exception
*/
public SortedMap<OSHDBTimestampAndIndex<Pair<Integer, Boolean>>, Integer> computeCountShareGBBResult(
public SortedMap<OSHDBTimestampAndIndex<Pair<Integer, Boolean>>, Integer> computeCountShareGBB(
BoundaryType bType, MapReducer<OSMEntitySnapshot> mapRed, Integer[] keysInt2,
Integer[] valuesInt2, GeometryBuilder geomBuilder)
throws UnsupportedOperationException, Exception {
Expand Down Expand Up @@ -230,7 +231,7 @@ public SortedMap<OSHDBTimestampAndIndex<Pair<Integer, Boolean>>, Integer> comput
* @throws UnsupportedOperationException
* @throws Exception
*/
public SortedMap<OSHDBTimestampAndIndex<Pair<Integer, Boolean>>, ? extends Number> computeCountLengthPerimeterAreaShareGBBResult(
public SortedMap<OSHDBTimestampAndIndex<Pair<Integer, Boolean>>, ? extends Number> computeCountLengthPerimeterAreaShareGBB(
RequestResource requestResource, BoundaryType bType, MapReducer<OSMEntitySnapshot> mapRed,
Integer[] keysInt2, Integer[] valuesInt2, GeometryBuilder geomBuilder)
throws UnsupportedOperationException, Exception {
Expand Down Expand Up @@ -311,12 +312,15 @@ public SortedMap<OSHDBTimestampAndIndex<Pair<Integer, Boolean>>, Integer> comput
private Geometry getSnapshotGeom(OSHDBMapReducible f) {
return ((OSMEntitySnapshot) f).getGeometry();
}

/**
* Internal helper method to get the geometry from an OSMContribution object.
*/
private Geometry getContributionGeom(OSHDBMapReducible f) {
return ((OSMContribution) f).getGeometryAfter();
Geometry geom = ((OSMContribution) f).getGeometryAfter();
if (geom == null)
geom = ((OSMContribution) f).getGeometryBefore();
return geom;
}

}

0 comments on commit cbdb292

Please sign in to comment.