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

org.opentripplanner.routing.impl.NoopFareServiceFactory Maven / Gradle / Ivy

package org.opentripplanner.routing.impl;

import com.fasterxml.jackson.databind.JsonNode;
import org.opentripplanner.model.OtpTransitService;
import org.opentripplanner.routing.algorithm.raptor.transit.TransitLayer;
import org.opentripplanner.routing.algorithm.raptor.transit.TripSchedule;
import org.opentripplanner.routing.core.Fare;
import org.opentripplanner.routing.services.FareService;
import org.opentripplanner.routing.services.FareServiceFactory;
import org.opentripplanner.transit.raptor.api.path.Path;


/**
 * Create a FareServiceFactory witch create a noop fare service. That is a fare service
 * that does nothing.
 */
class NoopFareServiceFactory implements FareServiceFactory {
    @Override
    public FareService makeFareService() {
        return new NoopFareService();
    }

    @Override
    public void processGtfs(OtpTransitService transitService) { }

    @Override
    public void configure(JsonNode config) { }

    @Override
    public String toString() {
        return "NoopFareServiceFactory{}";
    }

    /**
     * A Noop {@link FareService} implementation. Must be serializable; Hence
     * have a default constructor.
     */
    private static class NoopFareService implements FareService {
        private static final Long serialVersionUID = 1L;
        @Override
        public Fare getCost(
                Path path, TransitLayer transitLayer
        ) {
            return null;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy