UNPKG

raptor-journey-planner

Version:

Implementation of the Round bAsed Public Transit Optimized Router (Raptor) journey planning algorithm.

23 lines (22 loc) 759 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ScanResultsFactory = void 0; const ScanResults_1 = require("./ScanResults"); class ScanResultsFactory { stops; constructor(stops) { this.stops = stops; } create(origins) { const bestArrivals = {}; const kArrivals = [{}]; const kConnections = {}; for (const stop of this.stops) { bestArrivals[stop] = origins[stop] || Number.MAX_SAFE_INTEGER; kArrivals[0][stop] = origins[stop] || Number.MAX_SAFE_INTEGER; kConnections[stop] = {}; } return new ScanResults_1.ScanResults(bestArrivals, kArrivals, kConnections); } } exports.ScanResultsFactory = ScanResultsFactory;