/** * Checks if edge is a master edge, by verifying that its identifier is a master edge * identifier. * * @return True if the edge's identifier is a master edge identifier */ public boolean isMasterEdge() { return isMasterEdgeIdentifier(this.getIdentifier()); }
@Override public boolean validCheckForObject(final AtlasObject object) { return object instanceof Edge // Check to see that the Edge is a master Edge && Edge.isMasterEdgeIdentifier(object.getIdentifier()) // Check to see that the edge has not already been seen && !this.isFlagged(object.getIdentifier()) // Check to see that the edge is car navigable && HighwayTag.isCarNavigableHighway(object) // The edge is not part of an area && !object.getTag(AreaTag.KEY).isPresent(); }
if (Edge.isMasterEdgeIdentifier(edgeIdentifier))
/** * Validates given {@link AtlasObject} (assumed to be an {@link Edge}) whether it is a valid * crossing edge or not * * @param object * {@link AtlasObject} to test * @return {@code true} if given {@link AtlasObject} object is a valid crossing edge */ private boolean isValidCrossingEdge(final AtlasObject object) { if (Edge.isMasterEdgeIdentifier(object.getIdentifier()) && !TagPredicates.IS_AREA.test(object) && !this.isFlagged(object.getIdentifier())) { final Optional<HighwayTag> highway = HighwayTag.highwayTag(object); if (highway.isPresent()) { final HighwayTag highwayTag = highway.get(); return HighwayTag.isCarNavigableHighway(highwayTag) && !HighwayTag.CROSSING.equals(highwayTag) && highwayTag.isMoreImportantThanOrEqualTo(this.minimumHighwayType); } } return false; }
/** * This function will validate if the supplied atlas object is valid for the check. Objects * passed to this function have already been filtered by the tags.filter parameter in the * configuration file. * * @param object * the atlas object supplied by the Atlas-Checks framework for evaluation * @return {@code true} if this object should be checked */ @Override public boolean validCheckForObject(final AtlasObject object) { return AccessTag.isNo(object) && ((object instanceof Edge) || (object instanceof Line)) && Edge.isMasterEdgeIdentifier(object.getIdentifier()) && !this.isFlagged(object.getOsmIdentifier()) && isMinimumHighway(object); }
@Test public void testRoutingWithFilter() { final Atlas atlas = this.rule.getBiDirectionalCyclicRouteAtlas(); final Predicate<Edge> onlyMasterEdges = edge -> Edge .isMasterEdgeIdentifier(edge.getIdentifier()); final Set<Route> routes = AllPathsRouter.allRoutes(atlas.edge(315932590), atlas.edge(317932590), onlyMasterEdges, Route.ROUTE_COMPARATOR); final Set<Route> expectedRoutes = new TreeSet<>(Route.ROUTE_COMPARATOR); expectedRoutes.add(Route.forEdges(atlas.edge(315932590), atlas.edge(316932590), atlas.edge(317932590))); Assert.assertEquals( "Expect a single distinct route between start and end, since we've filtered out all routes that have a non-master edge", 1, routes.size()); Assert.assertEquals("Expect deterministic results from the router", expectedRoutes, routes); }