@Override public void foundShortcut(int fromNode, int toNode, double existingDirectWeight, double existingDistSum, int outgoingEdge, int outOrigEdgeCount, int incomingEdge, int inOrigEdgeCount) { // FOUND shortcut // but be sure that it is the only shortcut in the collection // and also in the graph for u->w. If existing AND identical weight => update setProperties. // Hint: shortcuts are always one-way due to distinct level of every node but we don't // know yet the levels so we need to determine the correct direction or if both directions Shortcut sc = new Shortcut(fromNode, toNode, existingDirectWeight, existingDistSum); if (shortcuts.containsKey(sc)) return; Shortcut tmpSc = new Shortcut(toNode, fromNode, existingDirectWeight, existingDistSum); Shortcut tmpRetSc = shortcuts.get(tmpSc); // overwrite flags only if skipped edges are identical if (tmpRetSc != null && tmpRetSc.skippedEdge2 == incomingEdge && tmpRetSc.skippedEdge1 == outgoingEdge) { tmpRetSc.flags = PrepareEncoder.getScDirMask(); return; } Shortcut old = shortcuts.put(sc, sc); if (old != null) throw new IllegalStateException("Shortcut did not exist (" + sc + ") but was overwriting another one? " + old); sc.skippedEdge1 = incomingEdge; sc.skippedEdge2 = outgoingEdge; sc.originalEdges = inOrigEdgeCount + outOrigEdgeCount; } }
@Override public void foundShortcut(int fromNode, int toNode, double existingDirectWeight, double existingDistSum, int outgoingEdge, int outOrigEdgeCount, int incomingEdge, int inOrigEdgeCount) { // FOUND shortcut // but be sure that it is the only shortcut in the collection // and also in the graph for u->w. If existing AND identical weight => update setProperties. // Hint: shortcuts are always one-way due to distinct level of every node but we don't // know yet the levels so we need to determine the correct direction or if both directions Shortcut sc = new Shortcut(fromNode, toNode, existingDirectWeight, existingDistSum); if (shortcuts.containsKey(sc)) return; Shortcut tmpSc = new Shortcut(toNode, fromNode, existingDirectWeight, existingDistSum); Shortcut tmpRetSc = shortcuts.get(tmpSc); // overwrite flags only if skipped edges are identical if (tmpRetSc != null && tmpRetSc.skippedEdge2 == incomingEdge && tmpRetSc.skippedEdge1 == outgoingEdge) { tmpRetSc.flags = PrepareEncoder.getScDirMask(); return; } Shortcut old = shortcuts.put(sc, sc); if (old != null) throw new IllegalStateException("Shortcut did not exist (" + sc + ") but was overwriting another one? " + old); sc.skippedEdge1 = incomingEdge; sc.skippedEdge2 = outgoingEdge; sc.originalEdges = inOrigEdgeCount + outOrigEdgeCount; } }