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

org.opentripplanner.api.parameter.ApiRequestMode Maven / Gradle / Ivy

package org.opentripplanner.api.parameter;

import static org.opentripplanner.model.modes.AllowedTransitMode.fromMainModeEnum;

import java.util.Set;
import org.opentripplanner.model.modes.AllowedTransitMode;
import org.opentripplanner.model.TransitMode;

import java.util.Collection;
import java.util.Collections;

public enum ApiRequestMode {
    WALK(),
    BICYCLE(),
    SCOOTER(),
    CAR(),
    TRAM(fromMainModeEnum(TransitMode.TRAM)),
    SUBWAY(fromMainModeEnum(TransitMode.SUBWAY)),
    RAIL(fromMainModeEnum(TransitMode.RAIL)),
    BUS(Set.of(
            fromMainModeEnum(TransitMode.BUS),
            fromMainModeEnum(TransitMode.COACH)
    )),
    FERRY(fromMainModeEnum(TransitMode.FERRY)),
    CABLE_CAR(fromMainModeEnum(TransitMode.CABLE_CAR)),
    GONDOLA(fromMainModeEnum(TransitMode.GONDOLA)),
    FUNICULAR(fromMainModeEnum(TransitMode.FUNICULAR)),
    TRANSIT(AllowedTransitMode.getAllTransitModes()),
    AIRPLANE(fromMainModeEnum(TransitMode.AIRPLANE)),
    TROLLEYBUS(fromMainModeEnum(TransitMode.TROLLEYBUS)),
    MONORAIL(fromMainModeEnum(TransitMode.MONORAIL)),
    FLEX();

    private final Set transitModes;

    ApiRequestMode(Set transitModes) {
        this.transitModes = transitModes;
    }

    ApiRequestMode(AllowedTransitMode transitMode) {
        this.transitModes = Set.of(transitMode);
    }

    ApiRequestMode() {
        this.transitModes = Collections.emptySet();
    }

    public Collection getTransitModes() {
        return transitModes;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy