Skip to content

Commit 551121e

Browse files
Merge pull request opentripplanner#6803 from Aubin-MaaS/free-edge
add comment and documentation on FreeEdge
2 parents dd45b9a + dceb562 commit 551121e

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

application/src/main/java/org/opentripplanner/street/model/edge/FreeEdge.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package org.opentripplanner.street.model.edge;
22

3-
import org.locationtech.jts.geom.LineString;
43
import org.opentripplanner.framework.i18n.I18NString;
54
import org.opentripplanner.street.model.vertex.Vertex;
65
import org.opentripplanner.street.search.state.State;
76
import org.opentripplanner.street.search.state.StateEditor;
87

98
/**
10-
* An edge that costs nothing to traverse. Used for connecting intersection vertices to the main
11-
* edge-based graph.
9+
* An edge that has a trivial cost to traverse.
1210
*
1311
* @author novalis
1412
*/
@@ -25,6 +23,9 @@ public static FreeEdge createFreeEdge(Vertex from, Vertex to) {
2523
@Override
2624
public State[] traverse(State s0) {
2725
StateEditor s1 = s0.edit(this);
26+
// This edge is used to connect vertices not on the street network, such as origin, destination
27+
// and station centroids, onto the street network. By adding a small cost, we prevent a normal
28+
// street search from going via these vertices.
2829
s1.incrementWeight(1);
2930
s1.setBackMode(null);
3031
return s1.makeStateArray();

application/src/main/java/org/opentripplanner/street/model/edge/TemporaryFreeEdge.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import org.opentripplanner.street.search.state.State;
66
import org.opentripplanner.street.search.state.StateEditor;
77

8+
/**
9+
* A temporary edge which links the origin / destination of a street search to the street graph.
10+
*/
811
public class TemporaryFreeEdge extends FreeEdge implements TemporaryEdge {
912

1013
private TemporaryFreeEdge(TemporaryVertex from, Vertex to) {
@@ -26,6 +29,7 @@ public static TemporaryFreeEdge createTemporaryFreeEdge(Vertex from, TemporaryVe
2629
@Override
2730
public State[] traverse(State s0) {
2831
StateEditor s1 = s0.edit(this);
32+
// a small cost is added to prevent other searches going through this temporary edge
2933
s1.incrementWeight(1);
3034
s1.setBackMode(null);
3135

0 commit comments

Comments
 (0)