kopia lustrzana https://github.com/JOSM/MapWithAI
Avoid calling the same function multiple times
Signed-off-by: Taylor Smock <taylor.smock@kaart.com>pull/1/head
rodzic
ed884ef8da
commit
a3a2daa4e4
|
@ -144,24 +144,22 @@ public class RoutingIslandsTest extends Test {
|
|||
*/
|
||||
private static void findConnectedWays(String currentTransportMode, Collection<Way> potentialWays,
|
||||
Collection<Way> incomingWays, Collection<Way> outgoingWays) {
|
||||
for (Way way : potentialWays) {
|
||||
if (way.isUsable() && way.isOutsideDownloadArea()) {
|
||||
potentialWays.stream().filter(Way::isUsable).filter(Way::isOutsideDownloadArea).forEach(way -> {
|
||||
Node firstNode = firstNode(way, currentTransportMode);
|
||||
Node lastNode = lastNode(way, currentTransportMode);
|
||||
if (isOneway(way, currentTransportMode) != 0 && firstNode != null
|
||||
&& firstNode.isOutsideDownloadArea()) {
|
||||
Integer isOneway = isOneway(way, currentTransportMode);
|
||||
if (firstNode != null && firstNode.isOutsideDownloadArea()) {
|
||||
incomingWays.add(way);
|
||||
}
|
||||
if (isOneway(way, currentTransportMode) != 0 && lastNode != null && lastNode.isOutsideDownloadArea()) {
|
||||
if (lastNode != null && lastNode.isOutsideDownloadArea()) {
|
||||
outgoingWays.add(way);
|
||||
}
|
||||
if (isOneway(way, currentTransportMode) == 0 && firstNode != null // Don't need to test lastNode
|
||||
&& (way.firstNode().isOutsideDownloadArea() || way.lastNode().isOutsideDownloadArea())) {
|
||||
if (isOneway == 0 && firstNode != null && lastNode != null
|
||||
&& (firstNode.isOutsideDownloadArea() || lastNode.isOutsideDownloadArea())) {
|
||||
incomingWays.add(way);
|
||||
outgoingWays.add(way);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Ładowanie…
Reference in New Issue