From 2b2af3f97f052ceba19ed35fc14c519fbab8f029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Racha=C5=84ski?= Date: Sun, 3 Jan 2021 21:39:29 +0100 Subject: [PATCH] Checkstyle ordering. --- .../BoundaryIntersectionCheck.java | 414 +++++++++--------- .../intersections/BoundaryPart.java | 14 +- .../intersections/RelationBoundary.java | 18 +- 3 files changed, 222 insertions(+), 224 deletions(-) diff --git a/src/main/java/org/openstreetmap/atlas/checks/validation/intersections/BoundaryIntersectionCheck.java b/src/main/java/org/openstreetmap/atlas/checks/validation/intersections/BoundaryIntersectionCheck.java index 5c54ffa04..032205d8f 100644 --- a/src/main/java/org/openstreetmap/atlas/checks/validation/intersections/BoundaryIntersectionCheck.java +++ b/src/main/java/org/openstreetmap/atlas/checks/validation/intersections/BoundaryIntersectionCheck.java @@ -42,28 +42,27 @@ public class BoundaryIntersectionCheck extends BaseCheck { - public static final String DELIMITER = ", "; - public static final int INDEX = 0; - public static final String TYPE = "type"; - public static final String BOUNDARY = "boundary"; + private static final String DELIMITER = ", "; + private static final int INDEX = 0; + private static final String TYPE = "type"; + private static final String BOUNDARY = "boundary"; private static final String INVALID_BOUNDARY_FORMAT = "Boundary {0} with way {1} is crossing invalidly with boundary {2} with way {3} at coordinates {4}."; private static final String INSTRUCTION_FORMAT = INVALID_BOUNDARY_FORMAT + " Two boundaries should not intersect each other."; private static final List FALLBACK_INSTRUCTIONS = Arrays.asList(INSTRUCTION_FORMAT, INVALID_BOUNDARY_FORMAT); - - public BoundaryIntersectionCheck(final Configuration configuration) - { - super(configuration); - } - private static boolean isRelationTypeBoundaryWithBoundaryTag(final AtlasObject object) { return Validators.isOfType(object, RelationTypeTag.class, RelationTypeTag.BOUNDARY) && Validators.hasValuesFor(object, BoundaryTag.class); } + public BoundaryIntersectionCheck(final Configuration configuration) + { + super(configuration); + } + @Override public boolean validCheckForObject(final AtlasObject object) { @@ -76,117 +75,10 @@ protected Optional flag(final AtlasObject object) return this.processRelation(object); } - private Optional processRelation(final AtlasObject object) - { - final Map tagToRelation = this.getRelationMap(object); - final RelationBoundary relationBoundary = new RelationBoundary(tagToRelation, this.getBoundaryParts((Relation) object)); - final Set instructions = new HashSet<>(); - final Set objectsToFlag = new HashSet<>(); - final Set matchedTags = new HashSet<>(); - for(final BoundaryPart currentBoundaryPart : relationBoundary.getBoundaryParts()) - { - final Iterable lineItemsIntersecting = object.getAtlas().lineItemsIntersecting(currentBoundaryPart.getBounds(), - this.getPredicateForLineItemsSelection(currentBoundaryPart, relationBoundary.getTagToRelation().keySet())); - final Iterable areasIntersecting = object.getAtlas().areasIntersecting(currentBoundaryPart.getBounds(), - this.getPredicateForAreaSelection(currentBoundaryPart, relationBoundary.getTagToRelation().keySet())); - final Set currentMatchedTags = new HashSet<>(); - this.processLineItems(relationBoundary, instructions, objectsToFlag, matchedTags, currentBoundaryPart, lineItemsIntersecting, currentMatchedTags); - this.processAreas(relationBoundary, instructions, objectsToFlag, matchedTags, currentBoundaryPart, areasIntersecting, currentMatchedTags); - - objectsToFlag.addAll(relationBoundary.getRelationsByBoundaryTags(matchedTags)); - objectsToFlag.add(currentBoundaryPart.getAtlasEntity()); - } - if(instructions.isEmpty()) - { - return Optional.empty(); - } - else - { - final CheckFlag checkFlag = new CheckFlag(this.getTaskIdentifier(object)); - instructions.forEach(checkFlag::addInstruction); - checkFlag.addObjects(objectsToFlag); - return Optional.of(checkFlag); - } - } - - private void processAreas(final RelationBoundary relationBoundary, - final Set instructions, - final Set objectsToFlag, - final Set matchedTags, - final BoundaryPart currentBoundaryPart, - final Iterable areasIntersecting, - final Set currentMatchedTags) - { - areasIntersecting.forEach(area -> - { - final Set matchingBoundaries = this.getBoundaries(area) - .stream() - .filter(boundary -> relationBoundary.getTagToRelation().containsKey(boundary.getTag(BOUNDARY).orElse(StringUtils.EMPTY))) - .filter(boundary -> !relationBoundary.containsRelationId(boundary.getOsmIdentifier())) - .collect(Collectors.toSet()); - if(!matchingBoundaries.isEmpty()) - { - currentMatchedTags.addAll(matchingBoundaries - .stream() - .map(relation -> relation.getTag(BOUNDARY)) - .filter(Optional::isPresent) - .map(Optional::get) - .collect(Collectors.toSet())); - objectsToFlag.addAll(matchingBoundaries); - final Coordinate[] intersectingPoints = this.getIntersectionPoints(currentBoundaryPart.getWktGeometry(), - area.toWkt()); - final String firstBoundaries = this.objectsToString(relationBoundary.getRelationsByBoundaryTags(currentMatchedTags)); - final String secondBoundaries = this.objectsToString(matchingBoundaries); - if(intersectingPoints.length != 0 && firstBoundaries.hashCode() < secondBoundaries.hashCode()) - { - this.addInstruction(instructions, currentBoundaryPart, area.getOsmIdentifier(), intersectingPoints, firstBoundaries, secondBoundaries); - } - } - matchedTags.addAll(currentMatchedTags); - }); - } - - private void processLineItems(final RelationBoundary relationBoundary, - final Set instructions, - final Set objectsToFlag, - final Set matchedTags, - final BoundaryPart currentBoundaryPart, - final Iterable lineItemsIntersecting, - final Set currentMatchedTags) + @Override + protected List getFallbackInstructions() { - lineItemsIntersecting.forEach(lineItem -> - { - final Set matchingBoundaries = this.getBoundaries(lineItem) - .stream() - .filter(boundary -> relationBoundary.getTagToRelation().containsKey(boundary.getTag(BOUNDARY).get())) - .filter(boundary -> !relationBoundary.containsRelationId(boundary.getOsmIdentifier())) - .collect(Collectors.toSet()); - if(!matchingBoundaries.isEmpty()) - { - currentMatchedTags.addAll(matchingBoundaries - .stream() - .map(relation -> relation.getTag(BOUNDARY)) - .filter(Optional::isPresent) - .map(Optional::get) - .collect(Collectors.toSet())); - objectsToFlag.addAll(matchingBoundaries); - - final List lineItems = this.getLineItems(lineItem); - lineItems.forEach(line -> - { - objectsToFlag.add(line); - final Coordinate[] intersectingPoints = this.getIntersectionPoints(currentBoundaryPart.getWktGeometry(), - line.toWkt()); - final String firstBoundaries = this.objectsToString(relationBoundary.getRelationsByBoundaryTags(currentMatchedTags)); - final String secondBoundaries = this.objectsToString(matchingBoundaries); - if(intersectingPoints.length != 0 && firstBoundaries.hashCode() < secondBoundaries.hashCode()) - { - this.addInstruction(instructions, currentBoundaryPart, line.getOsmIdentifier(), intersectingPoints, firstBoundaries, secondBoundaries); - } - }); - } - matchedTags.addAll(currentMatchedTags); - }); + return FALLBACK_INSTRUCTIONS; } private void addInstruction(final Set instructions, @@ -205,56 +97,31 @@ private void addInstruction(final Set instructions, instructions.add(instruction); } - private Map getRelationMap(final AtlasObject object) - { - final Map tagToRelation = new HashMap<>(); - if(object instanceof MultiRelation) - { - ((MultiRelation) object).relations() - .stream() - .filter(BoundaryIntersectionCheck::isRelationTypeBoundaryWithBoundaryTag) - .forEach(relation -> tagToRelation.put(relation.getTag(BOUNDARY).get(), relation)); - } - tagToRelation.put(object.getTag(BOUNDARY).get(), (Relation) object); - return tagToRelation; - } - - private List getLineItems(final LineItem lineItem) + private boolean checkAreaAsBoundary(final Area area, final Set boundaryTags) { - if(lineItem instanceof MultiLine) - { - final List lines = new ArrayList<>(); - ((MultiLine) lineItem).getSubLines() - .forEach(lines::add); - return lines; - } - return Collections.singletonList(lineItem); + return area + .relations().stream() + .anyMatch(relationToCheck -> BoundaryIntersectionCheck + .isRelationTypeBoundaryWithBoundaryTag(relationToCheck) + && boundaryTags.contains(relationToCheck.getTag(BOUNDARY).get())) + || boundaryTags.contains(area.getTag(BOUNDARY).orElse("")); } - private Set getBoundaryParts(final Relation relation) + private boolean checkLineItemAsBoundary(final LineItem lineItem, final Set boundaryTags) { - final RelationMemberList relationMemberLineItems = relation.membersOfType(ItemType.EDGE, ItemType.LINE, ItemType.AREA); - return relationMemberLineItems - .stream().map(RelationMember::getEntity) - .map(entity -> - { - final String tag = entity.getTags().get(BOUNDARY); - final Set boundaryTags = entity.relations() - .stream() - .filter(currentRelation -> BOUNDARY.equals(currentRelation.getTag(TYPE).get())) - .map(currentRelation -> currentRelation.getTag(BOUNDARY).orElse(StringUtils.EMPTY)) - .collect(Collectors.toSet()); - boundaryTags.add(tag); - boundaryTags.remove(StringUtils.EMPTY); - return new BoundaryPart(entity, boundaryTags); - }) - .collect(Collectors.toSet()); + return lineItem + .relations().stream() + .anyMatch(relationToCheck -> BoundaryIntersectionCheck + .isRelationTypeBoundaryWithBoundaryTag(relationToCheck) + && boundaryTags.contains(relationToCheck.getTag(BOUNDARY).get())) + || boundaryTags.contains(lineItem.getTag(BOUNDARY).orElse("")); } - @Override - protected List getFallbackInstructions() + private String coordinatesToList(final Coordinate[] locations) { - return FALLBACK_INSTRUCTIONS; + return Stream.of(locations) + .map(coordinate -> String.format("(%s, %s)", coordinate.getX(), coordinate.getY())) + .collect(Collectors.joining(DELIMITER)); } private Set getBoundaries(final LineItem currentLineItem) @@ -281,6 +148,38 @@ private Set getBoundaries(final Area area) .collect(Collectors.toSet()); } + private Set getBoundaryParts(final Relation relation) + { + final RelationMemberList relationMemberLineItems = relation.membersOfType(ItemType.EDGE, ItemType.LINE, ItemType.AREA); + return relationMemberLineItems + .stream().map(RelationMember::getEntity) + .map(entity -> + { + final String tag = entity.getTags().get(BOUNDARY); + final Set boundaryTags = entity.relations() + .stream() + .filter(currentRelation -> BOUNDARY.equals(currentRelation.getTag(TYPE).get())) + .map(currentRelation -> currentRelation.getTag(BOUNDARY).orElse(StringUtils.EMPTY)) + .collect(Collectors.toSet()); + boundaryTags.add(tag); + boundaryTags.remove(StringUtils.EMPTY); + return new BoundaryPart(entity, boundaryTags); + }) + .collect(Collectors.toSet()); + } + + private Geometry getGeometryForIntersection(final String wktFirst) throws ParseException + { + + final WKTReader wktReader = new WKTReader(); + Geometry geometry1 = wktReader.read(wktFirst); + if (geometry1.getGeometryType().equals(Geometry.TYPENAME_POLYGON)) + { + geometry1 = geometry1.getBoundary(); + } + return geometry1; + } + private Coordinate[] getIntersectionPoints(final String wktFirst, final String wktSecond) { @@ -296,64 +195,62 @@ private Coordinate[] getIntersectionPoints(final String wktFirst, } } - private Geometry getGeometryForIntersection(final String wktFirst) throws ParseException + private List getLineItems(final LineItem lineItem) { - - final WKTReader wktReader = new WKTReader(); - Geometry geometry1 = wktReader.read(wktFirst); - if (geometry1.getGeometryType().equals(Geometry.TYPENAME_POLYGON)) + if(lineItem instanceof MultiLine) { - geometry1 = geometry1.getBoundary(); + final List lines = new ArrayList<>(); + ((MultiLine) lineItem).getSubLines() + .forEach(lines::add); + return lines; } - return geometry1; + return Collections.singletonList(lineItem); } - private Predicate getPredicateForLineItemsSelection(final BoundaryPart boundaryPart, final Set boundaryTags) + private Predicate getPredicateForAreaSelection(final BoundaryPart boundaryPart, final Set boundaryTags) { - return lineItemToCheck -> + return areaToCheck -> { - if (this.checkLineItemAsBoundary(lineItemToCheck, boundaryTags)) + if (this.checkAreaAsBoundary(areaToCheck, boundaryTags)) { - return this.isCrossingNotTouching(boundaryPart.getWktGeometry(), lineItemToCheck.toWkt()); + return this.isCrossingNotTouching(boundaryPart.getWktGeometry(), areaToCheck.toWkt()); } return false; }; } - private Predicate getPredicateForAreaSelection(final BoundaryPart boundaryPart, final Set boundaryTags) + private Predicate getPredicateForLineItemsSelection(final BoundaryPart boundaryPart, final Set boundaryTags) { - return areaToCheck -> + return lineItemToCheck -> { - if (this.checkAreaAsBoundary(areaToCheck, boundaryTags)) + if (this.checkLineItemAsBoundary(lineItemToCheck, boundaryTags)) { - return this.isCrossingNotTouching(boundaryPart.getWktGeometry(), areaToCheck.toWkt()); + return this.isCrossingNotTouching(boundaryPart.getWktGeometry(), lineItemToCheck.toWkt()); } return false; }; } - private boolean checkLineItemAsBoundary(final LineItem lineItem, final Set boundaryTags) + private Map getRelationMap(final AtlasObject object) { - return lineItem - .relations().stream() - .anyMatch(relationToCheck -> BoundaryIntersectionCheck - .isRelationTypeBoundaryWithBoundaryTag(relationToCheck) - && boundaryTags.contains(relationToCheck.getTag(BOUNDARY).get())) - || boundaryTags.contains(lineItem.getTag(BOUNDARY).orElse("")); + final Map tagToRelation = new HashMap<>(); + if(object instanceof MultiRelation) + { + ((MultiRelation) object).relations() + .stream() + .filter(BoundaryIntersectionCheck::isRelationTypeBoundaryWithBoundaryTag) + .forEach(relation -> tagToRelation.put(relation.getTag(BOUNDARY).get(), relation)); + } + tagToRelation.put(object.getTag(BOUNDARY).get(), (Relation) object); + return tagToRelation; } - private boolean checkAreaAsBoundary(final Area area, final Set boundaryTags) + private boolean isAnyGeometryInvalid(final Geometry geometry1, final Geometry geometry2) { - return area - .relations().stream() - .anyMatch(relationToCheck -> BoundaryIntersectionCheck - .isRelationTypeBoundaryWithBoundaryTag(relationToCheck) - && boundaryTags.contains(relationToCheck.getTag(BOUNDARY).get())) - || boundaryTags.contains(area.getTag(BOUNDARY).orElse("")); + return !geometry1.isValid() || !geometry1.isSimple() || !geometry2.isValid() || !geometry2.isSimple(); } - public boolean isCrossingNotTouching(final String wktFirst, - final String wktSecond) + private boolean isCrossingNotTouching(final String wktFirst, final String wktSecond) { final WKTReader wktReader = new WKTReader(); try @@ -364,7 +261,7 @@ public boolean isCrossingNotTouching(final String wktFirst, { return false; } - if(this.anyGeometryInvalid(geometry1, geometry2)) + if(this.isAnyGeometryInvalid(geometry1, geometry2)) { return false; } @@ -376,9 +273,9 @@ public boolean isCrossingNotTouching(final String wktFirst, } } - private boolean anyGeometryInvalid(final Geometry geometry1, final Geometry geometry2) + private boolean isGeometryPairOfLineType(final Geometry lineString, final Geometry lineString2) { - return !geometry1.isValid() || !geometry1.isSimple() || !geometry2.isValid() || !geometry2.isSimple(); + return lineString.getGeometryType().equals(Geometry.TYPENAME_LINESTRING) && lineString2.getGeometryType().equals(Geometry.TYPENAME_LINESTRING); } private boolean isIntersectingNotTouching(final Geometry geometry1, final Geometry geometry2) @@ -387,24 +284,125 @@ private boolean isIntersectingNotTouching(final Geometry geometry1, final Geomet (geometry1.crosses(geometry2) || (geometry1.overlaps(geometry2) && !this.isGeometryPairOfLineType(geometry1, geometry2))); } - private boolean isGeometryPairOfLineType(final Geometry lineString, final Geometry lineString2) + private String objectsToString(final Set objects) { - return lineString.getGeometryType().equals(Geometry.TYPENAME_LINESTRING) && lineString2.getGeometryType().equals(Geometry.TYPENAME_LINESTRING); + return objects + .stream() + .map(object -> Long.toString(object.getOsmIdentifier())) + .collect(Collectors.joining(DELIMITER)); } - private String coordinatesToList(final Coordinate[] locations) + private void processAreas(final RelationBoundary relationBoundary, + final Set instructions, + final Set objectsToFlag, + final Set matchedTags, + final BoundaryPart currentBoundaryPart, + final Iterable areasIntersecting, + final Set currentMatchedTags) { - return Stream.of(locations) - .map(coordinate -> String.format("(%s, %s)", coordinate.getX(), coordinate.getY())) - .collect(Collectors.joining(DELIMITER)); + areasIntersecting.forEach(area -> + { + final Set matchingBoundaries = this.getBoundaries(area) + .stream() + .filter(boundary -> relationBoundary.getTagToRelation().containsKey(boundary.getTag(BOUNDARY).orElse(StringUtils.EMPTY))) + .filter(boundary -> !relationBoundary.containsRelationId(boundary.getOsmIdentifier())) + .collect(Collectors.toSet()); + if(!matchingBoundaries.isEmpty()) + { + currentMatchedTags.addAll(matchingBoundaries + .stream() + .map(relation -> relation.getTag(BOUNDARY)) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(Collectors.toSet())); + objectsToFlag.addAll(matchingBoundaries); + final Coordinate[] intersectingPoints = this.getIntersectionPoints(currentBoundaryPart.getWktGeometry(), + area.toWkt()); + final String firstBoundaries = this.objectsToString(relationBoundary.getRelationsByBoundaryTags(currentMatchedTags)); + final String secondBoundaries = this.objectsToString(matchingBoundaries); + if(intersectingPoints.length != 0 && firstBoundaries.hashCode() < secondBoundaries.hashCode()) + { + this.addInstruction(instructions, currentBoundaryPart, area.getOsmIdentifier(), intersectingPoints, firstBoundaries, secondBoundaries); + } + } + matchedTags.addAll(currentMatchedTags); + }); } - private String objectsToString(final Set objects) + private void processLineItems(final RelationBoundary relationBoundary, + final Set instructions, + final Set objectsToFlag, + final Set matchedTags, + final BoundaryPart currentBoundaryPart, + final Iterable lineItemsIntersecting, + final Set currentMatchedTags) { - return objects - .stream() - .map(object -> Long.toString(object.getOsmIdentifier())) - .collect(Collectors.joining(DELIMITER)); + lineItemsIntersecting.forEach(lineItem -> + { + final Set matchingBoundaries = this.getBoundaries(lineItem) + .stream() + .filter(boundary -> relationBoundary.getTagToRelation().containsKey(boundary.getTag(BOUNDARY).get())) + .filter(boundary -> !relationBoundary.containsRelationId(boundary.getOsmIdentifier())) + .collect(Collectors.toSet()); + if(!matchingBoundaries.isEmpty()) + { + currentMatchedTags.addAll(matchingBoundaries + .stream() + .map(relation -> relation.getTag(BOUNDARY)) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(Collectors.toSet())); + objectsToFlag.addAll(matchingBoundaries); + + final List lineItems = this.getLineItems(lineItem); + lineItems.forEach(line -> + { + objectsToFlag.add(line); + final Coordinate[] intersectingPoints = this.getIntersectionPoints(currentBoundaryPart.getWktGeometry(), + line.toWkt()); + final String firstBoundaries = this.objectsToString(relationBoundary.getRelationsByBoundaryTags(currentMatchedTags)); + final String secondBoundaries = this.objectsToString(matchingBoundaries); + if(intersectingPoints.length != 0 && firstBoundaries.hashCode() < secondBoundaries.hashCode()) + { + this.addInstruction(instructions, currentBoundaryPart, line.getOsmIdentifier(), intersectingPoints, firstBoundaries, secondBoundaries); + } + }); + } + matchedTags.addAll(currentMatchedTags); + }); + } + + private Optional processRelation(final AtlasObject object) + { + final Map tagToRelation = this.getRelationMap(object); + final RelationBoundary relationBoundary = new RelationBoundary(tagToRelation, this.getBoundaryParts((Relation) object)); + final Set instructions = new HashSet<>(); + final Set objectsToFlag = new HashSet<>(); + final Set matchedTags = new HashSet<>(); + for(final BoundaryPart currentBoundaryPart : relationBoundary.getBoundaryParts()) + { + final Iterable lineItemsIntersecting = object.getAtlas().lineItemsIntersecting(currentBoundaryPart.getBounds(), + this.getPredicateForLineItemsSelection(currentBoundaryPart, relationBoundary.getTagToRelation().keySet())); + final Iterable areasIntersecting = object.getAtlas().areasIntersecting(currentBoundaryPart.getBounds(), + this.getPredicateForAreaSelection(currentBoundaryPart, relationBoundary.getTagToRelation().keySet())); + final Set currentMatchedTags = new HashSet<>(); + this.processLineItems(relationBoundary, instructions, objectsToFlag, matchedTags, currentBoundaryPart, lineItemsIntersecting, currentMatchedTags); + this.processAreas(relationBoundary, instructions, objectsToFlag, matchedTags, currentBoundaryPart, areasIntersecting, currentMatchedTags); + + objectsToFlag.addAll(relationBoundary.getRelationsByBoundaryTags(matchedTags)); + objectsToFlag.add(currentBoundaryPart.getAtlasEntity()); + } + if(instructions.isEmpty()) + { + return Optional.empty(); + } + else + { + final CheckFlag checkFlag = new CheckFlag(this.getTaskIdentifier(object)); + instructions.forEach(checkFlag::addInstruction); + checkFlag.addObjects(objectsToFlag); + return Optional.of(checkFlag); + } } } diff --git a/src/main/java/org/openstreetmap/atlas/checks/validation/intersections/BoundaryPart.java b/src/main/java/org/openstreetmap/atlas/checks/validation/intersections/BoundaryPart.java index c5ee5565d..b5f1ed115 100644 --- a/src/main/java/org/openstreetmap/atlas/checks/validation/intersections/BoundaryPart.java +++ b/src/main/java/org/openstreetmap/atlas/checks/validation/intersections/BoundaryPart.java @@ -26,23 +26,23 @@ public AtlasEntity getAtlasEntity() return this.atlasEntity; } + public Set getBoundaryTags() + { + return this.boundaryTags; + } + public Rectangle getBounds() { return this.atlasEntity.bounds(); } - + public long getOsmIdentifier() { return this.atlasEntity.getOsmIdentifier(); } - + public String getWktGeometry() { return this.atlasEntity.toWkt(); } - - public Set getBoundaryTags() - { - return this.boundaryTags; - } } diff --git a/src/main/java/org/openstreetmap/atlas/checks/validation/intersections/RelationBoundary.java b/src/main/java/org/openstreetmap/atlas/checks/validation/intersections/RelationBoundary.java index 73fb9f97a..cb878802a 100644 --- a/src/main/java/org/openstreetmap/atlas/checks/validation/intersections/RelationBoundary.java +++ b/src/main/java/org/openstreetmap/atlas/checks/validation/intersections/RelationBoundary.java @@ -20,12 +20,15 @@ public RelationBoundary(final Map tagToRelation, final Set getTagToRelation() + + public boolean containsRelationId(final long osmIdentifier) { - return this.tagToRelation; + return this.tagToRelation.values() + .stream() + .map(Relation::getOsmIdentifier) + .anyMatch(id -> id == osmIdentifier); } - + public Set getBoundaryParts() { return this.boundaryParts; @@ -40,11 +43,8 @@ public Set getRelationsByBoundaryTags(final Set tags) .collect(Collectors.toSet()); } - public boolean containsRelationId(final long osmIdentifier) + public Map getTagToRelation() { - return this.tagToRelation.values() - .stream() - .map(Relation::getOsmIdentifier) - .anyMatch(id -> id == osmIdentifier); + return this.tagToRelation; } }