Ejemplo n.º 1
0
        static IEnumerable <Route> ServeRequest(Request request)
        {
            (IGraphDatabase cars, IGraphDatabase trains) = MockData.InitDatabases();

            /*
             *
             * Add request handling here and return calculated route
             *
             */

            IRequestHandler requestHandler = Use.RequestValidator();

            requestHandler
            .Then(Use.Resolver(new CostResolver()))
            .Then(Use.Resolver(new TimeResolver()))
            .Then(Catch.UnresolvedProblem())

            .Then(Use.Database(cars, VehicleType.Car))
            .Then(Use.Database(trains, VehicleType.Train))
            .Then(Catch.NullDatabase())

            .Then(Use.Filter(new PopulationFilter()))
            .Then(Use.Filter(new RestaurantFilter()))

            .Then(Use.Solver(new DijkstraSolver(), "Dijkstra"))
            .Then(Use.Solver(new DFSSolver(), "DFS"))
            .Then(Use.Solver(new BFSSolver(), "BFS"));

            return(requestHandler.Handle(request));
        }