import { InterchangeTime } from "./InterchangeRepository"; import { Stop } from "../../journey/Journey"; import { TransferPattern } from "../TransferPattern"; import { LocalDate } from "js-joda"; import { InMemoryFixedLegRepository } from "../../journey/repository/FixedLegRepository"; import { InMemoryTimetableLegRepository } from "../../journey/repository/TimetableLegRepository"; /** * Load the transfer patterns from the database and populate them with legs */ export declare class TransferPatternRepository { private readonly db; private readonly timetableLegs; private readonly fixedLegs; private readonly interchangeTime; private readonly maxPatterns; constructor(db: any, timetableLegs: InMemoryTimetableLegRepository, fixedLegs: InMemoryFixedLegRepository, interchangeTime: InterchangeTime, maxPatterns?: number); /** * Load the transfer patterns strings, split them into segment and find legs for each segment, filter out any transfer * patterns that return a segment with no legs. */ getTransferPatterns(origins: Stop[], destinations: Stop[], date: LocalDate): Promise; /** * Load the transfer patterns for the given journey. If there are multiple origins or destinations for the overall * query then any transfer pattern involving a fixed link at the start/end will be removed, as well as any transfer * pattern that involves one of the other origin/destinations (they are assumed to come back in their own pattern). */ private getPatterns; /** * Returns true if * - there is only one stop in the overall query (it's not a group station query) OR * - the pattern starts/ends with the given stop (there is no fixed link at the beginning/end) AND * - the pattern does not pass through any other stop in the group (it's assumed that pattern would come back in it's * own origin+destination pair) */ private isPatternValid; /** * Split the transfer pattern string into to segment origin/destination pairs and load the timetable leg * or fixed leg for each pair. */ private getPatternSegments; /** * Split a transfer pattern string into tuples of origins and destinations, e.g. * * BHMMYBLBGSEVTON => [[BHM,MYB], [LBG, SEV], [SEV, TON]] * * If the transfer pattern is reversed then it would be: * * TONSEVLBGMYBBHM => [[TON,SEV], [SEV, LBG], [MYB, BHM]] */ private getSegmentStops; }