Search in sources :

Example 1 with EdgeWithCleanup

use of org.opentripplanner.routing.edgetype.EdgeWithCleanup in project OpenTripPlanner by opentripplanner.

the class Graph method removeEdge.

/**
 * Removes an edge from the graph. This method is not thread-safe.
 * @param e The edge to be removed
 */
public void removeEdge(Edge e) {
    if (e != null) {
        synchronized (alertPatches) {
            // This synchronization is somewhat silly because this
            // method isn't thread-safe anyway, but it is consistent
            alertPatches.remove(e);
        }
        turnRestrictions.remove(e);
        streetNotesService.removeStaticNotes(e);
        edgeById.remove(e.getId());
        if (e instanceof EdgeWithCleanup)
            ((EdgeWithCleanup) e).detach();
        if (e.fromv != null) {
            e.fromv.removeOutgoing(e);
            for (Edge otherEdge : e.fromv.getIncoming()) {
                for (TurnRestriction turnRestriction : getTurnRestrictions(otherEdge)) {
                    if (turnRestriction.to == e) {
                        removeTurnRestriction(otherEdge, turnRestriction);
                    }
                }
            }
            e.fromv = null;
        }
        if (e.tov != null) {
            e.tov.removeIncoming(e);
            e.tov = null;
        }
    }
}
Also used : EdgeWithCleanup(org.opentripplanner.routing.edgetype.EdgeWithCleanup) TurnRestriction(org.opentripplanner.common.TurnRestriction) StreetEdge(org.opentripplanner.routing.edgetype.StreetEdge)

Aggregations

TurnRestriction (org.opentripplanner.common.TurnRestriction)1 EdgeWithCleanup (org.opentripplanner.routing.edgetype.EdgeWithCleanup)1 StreetEdge (org.opentripplanner.routing.edgetype.StreetEdge)1