Skip to content
Snippets Groups Projects
Commit 36e59323 authored by User expired's avatar User expired
Browse files

reworked link expanding (needs less lists now)

parent c574532a
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
......@@ -165,9 +164,12 @@ public abstract class Isochrone {
output.addNode(node);
node.close();
updateNodeQueue(expandLinks(node, adjacents));
final NodeConnection nConnection = prepareLinkExpand(node, adjacents);
updateNodeQueue(expandContinuousLinks(nConnection));
addLinks(output, adjacents);
updateNodeQueue(expandDiscreteLinks(nConnection));
if (qIsExpiring && node.isExpired()) {
removeNode(nodeId);
}
......@@ -215,10 +217,8 @@ public abstract class Isochrone {
}
}
private Collection<Node> expandLinks(final Node node, final Collection<Link> links) {
final Collection<Node> resultNodes = new LinkedList<>();
final NodeConnection nConnections = new NodeConnection(node);
private NodeConnection prepareLinkExpand(final Node node, final Collection<Link> links) {
final NodeConnection nConnection = new NodeConnection(node);
for (final Link link : links) {
final Node adjacentNode = getNode(link.getOppositeOf(node));
adjacentNode.visitNrAdjacentLinks((short) 1);
......@@ -242,14 +242,11 @@ public abstract class Isochrone {
removeNode(adjacentNode.getId());
}
} else {
nConnections.addTargetLink(adjacentNode, link);
nConnection.addTargetLink(adjacentNode, link);
}
}
resultNodes.addAll(expandContinuousLinks(nConnections));
resultNodes.addAll(expandDiscreteLinks(nConnections));
return resultNodes;
return nConnection;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment