Search in sources :

Example 1 with MatcherAndStreetNote

use of org.opentripplanner.routing.services.notes.MatcherAndStreetNote in project OpenTripPlanner by opentripplanner.

the class WFSNotePollingGraphUpdater method buildMatcherAndStreetNote.

/**
 * Create a MatcherAndStreetNote, interning it if the note and matcher pair is already created.
 * Note: we use the default Object.equals() for matchers, as they are mostly already singleton
 * instances.
 */
private MatcherAndStreetNote buildMatcherAndStreetNote(NoteMatcher noteMatcher, StreetNote note) {
    T2<NoteMatcher, StreetNote> key = new T2<>(noteMatcher, note);
    MatcherAndStreetNote interned = uniqueMatchers.get(key);
    if (interned != null) {
        return interned;
    }
    MatcherAndStreetNote ret = new MatcherAndStreetNote(noteMatcher, note);
    uniqueMatchers.put(key, ret);
    return ret;
}
Also used : NoteMatcher(org.opentripplanner.routing.services.notes.NoteMatcher) MatcherAndStreetNote(org.opentripplanner.routing.services.notes.MatcherAndStreetNote) MatcherAndStreetNote(org.opentripplanner.routing.services.notes.MatcherAndStreetNote) StreetNote(org.opentripplanner.model.StreetNote) T2(org.opentripplanner.common.model.T2)

Aggregations

T2 (org.opentripplanner.common.model.T2)1 StreetNote (org.opentripplanner.model.StreetNote)1 MatcherAndStreetNote (org.opentripplanner.routing.services.notes.MatcherAndStreetNote)1 NoteMatcher (org.opentripplanner.routing.services.notes.NoteMatcher)1