UNPKG

minotor

Version:

A lightweight client-side transit routing library.

29 lines (28 loc) 1.45 kB
import { SourceStopId, StopId } from '../stops/stops.js'; import { StopsIndex } from '../stops/stopsIndex.js'; import { Query } from './query.js'; import { Route } from './route.js'; import { ReachingTime, TripLeg } from './router.js'; export declare class Result { private readonly query; readonly earliestArrivals: Map<StopId, ReachingTime>; readonly earliestArrivalsPerRound: Map<StopId, TripLeg>[]; private readonly stopsIndex; constructor(query: Query, earliestArrivals: Map<StopId, ReachingTime>, earliestArrivalsPerRound: Map<StopId, TripLeg>[], stopsIndex: StopsIndex); /** * Reconstructs the best route to a stop. * (to any stop reachable in less time / transfers than the destination(s) of the query) * * @param to The destination stop. Defaults to the destination of the original query. * @returns a route to the destination stop if it exists. */ bestRoute(to?: SourceStopId | SourceStopId[]): Route | undefined; /** * Returns the arrival time at any stop reachable in less time / transfers than the destination(s) of the query) * * @param stop The target stop for which to return the arrival time. * @param maxTransfers The optional maximum number of transfers allowed. * @returns The arrival time if the target stop is reachable, otherwise undefined. */ arrivalAt(stop: SourceStopId, maxTransfers?: number): ReachingTime | undefined; }