Commit 25a16fe6 authored by Michael Zilske's avatar Michael Zilske

Cleanup

parent 8cf9a6b0
......@@ -36,7 +36,6 @@ import java.util.List;
import java.util.Spliterators;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
......@@ -54,10 +53,9 @@ final class GraphExplorer {
private final ArrayListMultimap<Integer, VirtualEdgeIteratorState> extraEdgesByDestination = ArrayListMultimap.create();
private final Graph graph;
private final boolean walkOnly;
private final boolean profileQuery;
GraphExplorer(Graph graph, PtTravelTimeWeighting weighting, PtFlagEncoder flagEncoder, GtfsStorage gtfsStorage, RealtimeFeed realtimeFeed, boolean reverse, PointList extraNodes, List<VirtualEdgeIteratorState> extraEdges, boolean walkOnly, boolean profileQuery) {
GraphExplorer(Graph graph, PtTravelTimeWeighting weighting, PtFlagEncoder flagEncoder, GtfsStorage gtfsStorage, RealtimeFeed realtimeFeed, boolean reverse, PointList extraNodes, List<VirtualEdgeIteratorState> extraEdges, boolean walkOnly) {
this.graph = graph;
this.edgeExplorer = graph.createEdgeExplorer(new DefaultEdgeFilter(flagEncoder, reverse, !reverse));
this.flagEncoder = flagEncoder;
......@@ -75,7 +73,6 @@ final class GraphExplorer {
extraEdgesByDestination.put(extraEdge.getAdjNode(), new VirtualEdgeIteratorState(extraEdge.getOriginalTraversalKey(), extraEdge.getEdge(), extraEdge.getAdjNode(), extraEdge.getBaseNode(), extraEdge.getDistance(), extraEdge.getFlags(), extraEdge.getName(), extraEdge.fetchWayGeometry(3)));
}
this.walkOnly = walkOnly;
this.profileQuery = profileQuery;
}
Stream<EdgeIteratorState> exploreEdgesAround(Label label) {
......@@ -87,13 +84,13 @@ final class GraphExplorer {
}}).filter(new EdgeIteratorStatePredicate(label));
}
Stream<EdgeIteratorState> mainEdgesAround(Label label) {
private Stream<EdgeIteratorState> mainEdgesAround(Label label) {
return StreamSupport.stream(new Spliterators.AbstractSpliterator<EdgeIteratorState>(0, 0) {
EdgeIterator edgeIterator = edgeExplorer.setBaseNode(label.adjNode);
@Override
public boolean tryAdvance(Consumer<? super EdgeIteratorState> action) {
while (edgeIterator.next()) {
if (edgeIterator.next()) {
action.accept(edgeIterator);
return true;
}
......@@ -110,9 +107,6 @@ final class GraphExplorer {
case HIGHWAY:
return weighting.calcMillis(edge, false, -1);
case ENTER_TIME_EXPANDED_NETWORK:
if (edge.getBaseNode() == 2589) {
System.out.println("tröt");
}
if (reverse) {
return 0;
} else {
......@@ -155,7 +149,7 @@ final class GraphExplorer {
}
}
public EdgeIteratorState getEdgeIteratorState(int edgeId, int adjNode) {
EdgeIteratorState getEdgeIteratorState(int edgeId, int adjNode) {
if (edgeId == -1) {
throw new RuntimeException();
}
......@@ -164,7 +158,7 @@ final class GraphExplorer {
.findFirst().orElseGet(() -> graph.getEdgeIteratorState(edgeId, adjNode));
}
public NodeAccess getNodeAccess() {
NodeAccess getNodeAccess() {
return graph.getNodeAccess();
}
......@@ -176,7 +170,7 @@ final class GraphExplorer {
private final Label label;
boolean foundEnteredTimeExpandedNetworkEdge;
public EdgeIteratorStatePredicate(Label label) {
EdgeIteratorStatePredicate(Label label) {
this.label = label;
foundEnteredTimeExpandedNetworkEdge = false;
}
......
......@@ -164,7 +164,7 @@ public final class GraphHopperGtfs implements GraphHopperAPI {
}
private void substitutePointWithVirtualNode(int index, boolean reverse, GHPoint ghPoint, ArrayList<QueryResult> allQueryResults) {
final GraphExplorer graphExplorer = new GraphExplorer(queryGraph, weighting, flagEncoder, gtfsStorage, realtimeFeed, reverse, new PointList(), extraEdges, true, false);
final GraphExplorer graphExplorer = new GraphExplorer(queryGraph, weighting, flagEncoder, gtfsStorage, realtimeFeed, reverse, new PointList(), extraEdges, true);
extraNodes.add(ghPoint);
......@@ -253,7 +253,7 @@ public final class GraphHopperGtfs implements GraphHopperAPI {
private List<Label> findPaths(int startNode, int destNode) {
StopWatch stopWatch = new StopWatch().start();
graphExplorer = new GraphExplorer(queryGraph, weighting, flagEncoder, gtfsStorage, realtimeFeed, arriveBy, extraNodes, extraEdges, false, profileQuery);
graphExplorer = new GraphExplorer(queryGraph, weighting, flagEncoder, gtfsStorage, realtimeFeed, arriveBy, extraNodes, extraEdges, false);
MultiCriteriaLabelSetting router = new MultiCriteriaLabelSetting(graphExplorer, weighting, arriveBy, maxWalkDistancePerLeg, maxTransferDistancePerLeg, !ignoreTransfers, profileQuery, maxVisitedNodesForRequest);
final Stream<Label> labels = router.calcLabels(startNode, destNode, initialTime);
List<Label> solutions = labels
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment