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

org.opentripplanner.api.mapping.StopTimesInPatternMapper Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
package org.opentripplanner.api.mapping;

import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import org.opentripplanner.api.model.ApiStopTimesInPattern;
import org.opentripplanner.model.StopTimesInPattern;

public class StopTimesInPatternMapper {

  public static List mapToApi(Collection domain) {
    if (domain == null) {
      return null;
    }
    return domain.stream().map(StopTimesInPatternMapper::mapToApi).collect(Collectors.toList());
  }

  public static ApiStopTimesInPattern mapToApi(StopTimesInPattern domain) {
    if (domain == null) {
      return null;
    }

    ApiStopTimesInPattern api = new ApiStopTimesInPattern();

    api.pattern = TripPatternMapper.mapToApiShort(domain.pattern);
    api.times = TripTimeMapper.mapToApi(domain.times);

    return api;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy