All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opentripplanner.transit.raptor.rangeraptor.standard.heuristics.HeuristicSearch Maven / Gradle / Ivy

There is a newer version: 2.5.0
Show newest version
package org.opentripplanner.transit.raptor.rangeraptor.standard.heuristics;

import org.opentripplanner.transit.raptor.api.path.Path;
import org.opentripplanner.transit.raptor.api.transit.RaptorTripSchedule;
import org.opentripplanner.transit.raptor.api.view.Heuristics;
import org.opentripplanner.transit.raptor.api.view.Worker;

import java.util.Collection;

/**
 * Combine Heuristics and Worker into one class to be able to retrieve the
 * heuristics after the worker is invoked.
 *
 * @param  The TripSchedule type defined by the user of the raptor API.
 */
public class HeuristicSearch implements Worker {
    private final Worker worker;
    private final Heuristics heuristics;

    public HeuristicSearch(Worker worker, Heuristics heuristics) {
        this.worker = worker;
        this.heuristics = heuristics;
    }

    public Heuristics heuristics() {
        return heuristics;
    }

    @Override
    public Collection> route() {
        return worker.route();
    }

    public boolean destinationReached() {
        return heuristics.destinationReached();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy