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

extracted method

parent c627357e
No related branches found
No related tags found
No related merge requests found
......@@ -166,25 +166,8 @@ public abstract class Isochrone {
qStartNodes.initialize(output);
Node node = null;
NodeConnection cConnections = null;
NodeConnection dConnections = null;
while ((node = nodeQueue.poll()) != null) {
final int nodeId = node.getId();
final Collection<Link> links = calcAdjLinks(nodeId);
output.addNode(node);
node.close();
cConnections = prepareContinuousLinks(node, links);
updateNodeQueue(expandContinuousLinks(cConnections));
dConnections = prepareDiscreteLinks(node, links);
updateNodeQueue(expandDiscreteLinks(dConnections));
output.addLinks(links.stream().filter(PREDICATE_LINK_CONT));
if (qIsExpiring && node.isExpired()) {
removeNode(nodeId);
}
expandNode(output, node);
}
output.addNodes(getNodes());
......@@ -298,6 +281,25 @@ public abstract class Isochrone {
return results;
}
private <T extends AbstractOutput> void expandNode(final T output, final Node node) {
final int nodeId = node.getId();
final Collection<Link> links = calcAdjLinks(nodeId);
output.addNode(node);
node.close();
final NodeConnection cConnections = prepareContinuousLinks(node, links);
updateNodeQueue(expandContinuousLinks(cConnections));
final NodeConnection dConnections = prepareDiscreteLinks(node, links);
updateNodeQueue(expandDiscreteLinks(dConnections));
output.addLinks(links.stream().filter(PREDICATE_LINK_CONT));
if (qIsExpiring && node.isExpired()) {
removeNode(nodeId);
}
}
/**
* Gets date codes for a given time.
*
......
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