Skip to content

Commit

Permalink
streetClass from other.pairIndex (patch to #798)
Browse files Browse the repository at this point in the history
We were copying from the target pairIndex not the source pairIndex.
I also factored out the call to other.getEdgeStore() and made all the
variables used in these assignments final to avoid any mishaps.
  • Loading branch information
abyrd committed Apr 8, 2022
1 parent 6fac361 commit 43068e1
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/main/java/com/conveyal/r5/streets/EdgeStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -555,15 +555,16 @@ public int getLengthMm () {
* This is a hack and should be done some other way.
*/
public void copyPairFlagsAndSpeeds(Edge other) {
int foreEdge = pairIndex * 2;
int backEdge = foreEdge + 1;
int otherForeEdge = other.pairIndex * 2;
int otherBackEdge = otherForeEdge + 1;
flags.set(foreEdge, other.getEdgeStore().flags.get(otherForeEdge));
flags.set(backEdge, other.getEdgeStore().flags.get(otherBackEdge));
speeds.set(foreEdge, other.getEdgeStore().speeds.get(otherForeEdge));
speeds.set(backEdge, other.getEdgeStore().speeds.get(otherBackEdge));
streetClasses.set(pairIndex, other.getEdgeStore().streetClasses.get(pairIndex));
final int foreEdge = pairIndex * 2;
final int backEdge = foreEdge + 1;
final int otherForeEdge = other.pairIndex * 2;
final int otherBackEdge = otherForeEdge + 1;
final EdgeStore otherStore = other.getEdgeStore();
flags.set(foreEdge, otherStore.flags.get(otherForeEdge));
flags.set(backEdge, otherStore.flags.get(otherBackEdge));
speeds.set(foreEdge, otherStore.speeds.get(otherForeEdge));
speeds.set(backEdge, otherStore.speeds.get(otherBackEdge));
streetClasses.set(pairIndex, otherStore.streetClasses.get(other.pairIndex));
}

public void copyPairGeometry(Edge other) {
Expand Down

0 comments on commit 43068e1

Please sign in to comment.