24
24
import java .util .Arrays ;
25
25
import java .util .Locale ;
26
26
27
- import static com .graphhopper .util .GHUtility .getEdgeFromEdgeKey ;
28
27
import static com .graphhopper .util .Helper .nf ;
29
28
30
29
/**
@@ -129,7 +128,7 @@ public double runSearch(int targetNode, int targetEdgeKey, double acceptedWeight
129
128
final int edgeKey = GHUtility .reverseEdgeKey (inIter .getOrigEdgeKeyLast ());
130
129
if (weights [edgeKey ] == Double .POSITIVE_INFINITY )
131
130
continue ;
132
- double weight = weights [edgeKey ] + calcTurnWeight (getEdgeFromEdgeKey ( edgeKey ) , targetNode , getEdgeFromEdgeKey ( targetEdgeKey ) );
131
+ double weight = weights [edgeKey ] + calcTurnWeight (edgeKey , targetNode , targetEdgeKey );
133
132
if (weight < acceptedWeight || (weight == acceptedWeight && (parents [edgeKey ] < 0 || !isPathToCenter (parents [edgeKey ]))))
134
133
return weight ;
135
134
}
@@ -152,7 +151,7 @@ public double runSearch(int targetNode, int targetEdgeKey, double acceptedWeight
152
151
// being recognized as witnesses when there are double zero weight loops at the source node
153
152
if (currNode == sourceNode && iter .getAdjNode () == sourceNode && iter .getWeight () < MAX_ZERO_WEIGHT_LOOP )
154
153
continue ;
155
- final double weight = weights [currKey ] + calcTurnWeight (getEdgeFromEdgeKey ( currKey ) , currNode , getEdgeFromEdgeKey ( iter .getOrigEdgeKeyFirst () )) + iter .getWeight ();
154
+ final double weight = weights [currKey ] + calcTurnWeight (currKey , currNode , iter .getOrigEdgeKeyFirst ()) + iter .getWeight ();
156
155
if (Double .isInfinite (weight ))
157
156
continue ;
158
157
final int key = iter .getOrigEdgeKeyLast ();
@@ -164,7 +163,7 @@ public double runSearch(int targetNode, int targetEdgeKey, double acceptedWeight
164
163
changedEdges .add (key );
165
164
dijkstraHeap .insert (weight , key );
166
165
if (iter .getAdjNode () == targetNode && (!isPathToCenter (currKey ) || parents [currKey ] < 0 ))
167
- foundWeight = Math .min (foundWeight , weight + calcTurnWeight (getEdgeFromEdgeKey ( key ) , targetNode , getEdgeFromEdgeKey ( targetEdgeKey ) ));
166
+ foundWeight = Math .min (foundWeight , weight + calcTurnWeight (key , targetNode , targetEdgeKey ));
168
167
} else if (weight < weights [key ]
169
168
// if weights are equal make sure we prefer witness paths over bridge paths
170
169
|| (weight == weights [key ] && !isPathToCenter (currKey ))) {
@@ -174,7 +173,7 @@ public double runSearch(int targetNode, int targetEdgeKey, double acceptedWeight
174
173
setAdjNodeAndPathToCenter (key , iter .getAdjNode (), isPathToCenter );
175
174
dijkstraHeap .update (weight , key );
176
175
if (iter .getAdjNode () == targetNode && (!isPathToCenter (currKey ) || parents [currKey ] < 0 ))
177
- foundWeight = Math .min (foundWeight , weight + calcTurnWeight (getEdgeFromEdgeKey ( key ) , targetNode , getEdgeFromEdgeKey ( targetEdgeKey ) ));
176
+ foundWeight = Math .min (foundWeight , weight + calcTurnWeight (key , targetNode , targetEdgeKey ));
178
177
}
179
178
}
180
179
if (foundWeight <= acceptedWeight )
@@ -258,8 +257,8 @@ private void resetEntry(int key) {
258
257
setAdjNodeAndPathToCenter (key , NO_NODE , false );
259
258
}
260
259
261
- private double calcTurnWeight (int inEdge , int viaNode , int outEdge ) {
262
- return prepareGraph .getTurnWeight (inEdge , viaNode , outEdge );
260
+ private double calcTurnWeight (int inEdgeKey , int viaNode , int outEdgeKey ) {
261
+ return prepareGraph .getTurnWeight (inEdgeKey , viaNode , outEdgeKey );
263
262
}
264
263
265
264
static class Stats {
0 commit comments