org.opentripplanner.ext.legacygraphqlapi.datafetchers.LegacyGraphQLItineraryImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
package org.opentripplanner.ext.legacygraphqlapi.datafetchers;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.opentripplanner.ext.legacygraphqlapi.generated.LegacyGraphQLDataFetchers;
import org.opentripplanner.model.plan.Itinerary;
import org.opentripplanner.model.plan.Leg;
import org.opentripplanner.routing.core.Fare;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class LegacyGraphQLItineraryImpl
implements LegacyGraphQLDataFetchers.LegacyGraphQLItinerary {
@Override
public DataFetcher startTime() {
return environment -> getSource(environment).startTime().getTime().getTime();
}
@Override
public DataFetcher endTime() {
return environment -> getSource(environment).endTime().getTime().getTime();
}
@Override
public DataFetcher duration() {
return environment -> (long) getSource(environment).durationSeconds;
}
@Override
public DataFetcher waitingTime() {
return environment -> (long) getSource(environment).waitingTimeSeconds;
}
@Override
public DataFetcher walkTime() {
return environment -> (long) getSource(environment).nonTransitTimeSeconds;
}
@Override
public DataFetcher walkDistance() {
return environment -> getSource(environment).nonTransitDistanceMeters;
}
@Override
public DataFetcher> legs() {
return environment -> getSource(environment).legs;
}
@Override
public DataFetcher>> fares() {
return environment -> {
Fare fare = getSource(environment).fare;
if (fare == null) {
return null;
}
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy