UNPKG

connection-scan-algorithm

Version:
27 lines (26 loc) 1.1 kB
import { Connection, TimetableConnection } from "../journey/Connection"; import { TransfersByOrigin } from "../gtfs/GtfsLoader"; import { DayOfWeek, StopID, Time } from "../gtfs/Gtfs"; import { ScanResultsFactory } from "./ScanResultsFactory"; /** * Implementation of the connection scan algorithm. */ export declare class ConnectionScanAlgorithm { private readonly connections; private readonly transfers; private readonly resultsFactory; constructor(connections: TimetableConnection[], transfers: TransfersByOrigin, resultsFactory: ScanResultsFactory); /** * Return an index of connections that achieve the earliest arrival time at each stop. */ scan(origins: OriginDepartureTimes, destinations: StopID[], date: number, dow: DayOfWeek): ConnectionIndex; private scanTransfers; } /** * Index of connections that achieve the earliest arrivalTime time at each stop. */ export declare type ConnectionIndex = Record<StopID, Connection>; /** * Index of departure stations and their departure time */ export declare type OriginDepartureTimes = Record<StopID, Time>;