@Override public Edge end() { return this.downstream.end(); }
public Edge lastEdge() { return getRoute().end(); }
/** * Note: The start and end {@link Node}s of the {@link Route} are part of the hash code to * reduce the probability of a collision. There are other candidates to add here, like distance * between start/end, but start/end by themselves are the least computationally intensive to * derive. */ @Override public int hashCode() { return new HashCodeBuilder().append(this.start().start().getLocation()) .append(this.end().end().getLocation()).append(Iterables.asList(this)).hashCode(); }
private boolean canAddEdgeToBoundary(final Edge edge, final Route boundary) { return edge.getIdentifier() != -boundary.end().getIdentifier() && edge.getOsmIdentifier() == boundary.end().getOsmIdentifier() && boundary.end().end().getLocation().equals(edge.start().getLocation()) && !boundary.includes(edge); } }
public Route append(final Route route) { if (route == null) { throw new CoreException( "Cannot append a route that is null to a route {} that ends at {}", this, this.end()); } if (!end().end().equals(route.start().start())) { throw new CoreException( "Cannot append a disconnected route:\nOne: {}\nAt: {}\nTo\nTwo: {}\nAt: {}", this, this.end(), route, route.start()); } return new MultiRoute(this, route); }
candidateJunctionRoute.end().outEdges().stream().filter(this::isCandidateJunctionEdge) .filter(edge -> edge.getMasterEdgeIdentifier() != candidateJunctionRoute.end() .getMasterEdgeIdentifier()) .filter(edge -> this.edgeDirectionComparator .isSameDirection(candidateJunctionRoute.end(), edge, false)) .forEach(expandableEdges::add);
&& edgeNameFuzzyMatch(candidateRoute.end(), edge, false))
@Override public boolean equals(final Object other) { if (other instanceof Route) { final Route that = (Route) other; if (this.size() == that.size()) { return new EqualsBuilder() .append(this.start().start().getLocation(), that.start().start().getLocation()) .append(this.end().end().getLocation(), that.end().end().getLocation()) .append(Iterables.asList(this), Iterables.asList(that)).isEquals(); } } return false; }
/** * @return All the {@link Edge}s connected to the start/end {@link Node}s of this {@link Route}, * excluding {@link Edge}s in {@link Route}. If this {@link Edge} is a {@link Route} * with two-way road, then the reversed {@link Edge}s will be included in the set. This * does not include {@link Edge} connected to the interior {@link Node}s of the * {@link Route}. */ public Set<Edge> connectedEdges() { final Set<Edge> result = new HashSet<>(); for (final Edge edge : this.end().end().connectedEdges()) { if (!this.includes(edge)) { result.add(edge); } } for (final Edge edge : this.start().start().connectedEdges()) { if (!this.includes(edge)) { result.add(edge); } } return result; }
private Optional<Route> buildHighwayAreaBoundary(final Route boundary) { for (final Edge edge : boundary.end().end().connectedEdges()) { if (canAddEdgeToBoundary(edge, boundary)) { final Route extendedBoundary = boundary.append(edge); if (extendedBoundary.end().end().getLocation() .equals(extendedBoundary.start().start().getLocation())) { return Optional.of(extendedBoundary); } else { return buildHighwayAreaBoundary(extendedBoundary); } } } return Optional.empty(); }
public Route prepend(final Route route) { if (!start().start().equals(route.end().end())) { throw new CoreException("Cannot prepend a disconnected route."); } return new MultiRoute(route, this); }
.anyMatch(roundaboutEdge -> !HighwayTag.isCarNavigableHighway(roundaboutEdge) || !roundaboutEdge.isMasterEdge()) || !roundaboutEdges.start().inEdges().contains(roundaboutEdges.end()))
fromMember.end().end(), toMember.start().start());
if (edge.start().equals(route.end().end()))
for (final Edge outEdge : candidateRoute.end().outEdges())