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

org.opentripplanner.ext.legacygraphqlapi.datafetchers.LegacyGraphQLdebugOutputImpl Maven / Gradle / Ivy

package org.opentripplanner.ext.legacygraphqlapi.datafetchers;

import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.opentripplanner.api.resource.DebugOutput;
import org.opentripplanner.ext.legacygraphqlapi.generated.LegacyGraphQLDataFetchers;

public class LegacyGraphQLdebugOutputImpl
    implements LegacyGraphQLDataFetchers.LegacyGraphQLDebugOutput {

  private static final long nanosToMillis = 1000000;

  @Override
  public DataFetcher totalTime() {
    return environment -> getSource(environment).totalTime / nanosToMillis;
  }

  @Override
  public DataFetcher pathCalculationTime() {
    return environment -> getSource(environment).transitRouterTime / nanosToMillis;
  }

  @Override
  public DataFetcher precalculationTime() {
    return environment -> getSource(environment).precalculationTime / nanosToMillis;
  }

  @Override
  public DataFetcher renderingTime() {
    return environment -> getSource(environment).renderingTime / nanosToMillis;
  }

  @Override
  public DataFetcher timedOut() {
    return environment -> false;
  }

  private DebugOutput getSource(DataFetchingEnvironment environment) {
    return environment.getSource();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy