当前位置: 首页>>代码示例>>Java>>正文


Java TransitPath类代码示例

本文整理汇总了Java中net.java.pathfinder.api.TransitPath的典型用法代码示例。如果您正苦于以下问题:Java TransitPath类的具体用法?Java TransitPath怎么用?Java TransitPath使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TransitPath类属于net.java.pathfinder.api包,在下文中一共展示了TransitPath类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fetchRoutesForSpecification

import net.java.pathfinder.api.TransitPath; //导入依赖的package包/类
@Override
    public List<Itinerary> fetchRoutesForSpecification(
            RouteSpecification routeSpecification) {
        // The RouteSpecification is picked apart and adapted to the external API.
        String origin = routeSpecification.getOrigin().getUnLocode().getIdString();
        String destination = routeSpecification.getDestination().getUnLocode()
                .getIdString();

        List<TransitPath> transitPaths = graphTraversalResource.findShortestPath(origin, destination, null);
//                .queryParam("origin", origin)
//                .queryParam("destination", destination)
//                .request(MediaType.APPLICATION_JSON_TYPE)
//                .get(new GenericType<List<TransitPath>>() {
//                });

        // The returned result is then translated back into our domain model.
        List<Itinerary> itineraries = new ArrayList<>();

        for (TransitPath transitPath : transitPaths) {
            Itinerary itinerary = toItinerary(transitPath);
            // Use the specification to safe-guard against invalid itineraries
            if (routeSpecification.isSatisfiedBy(itinerary)) {
                itineraries.add(itinerary);
            } else {
                log.log(Level.FINE,
                        "Received itinerary that did not satisfy the route specification");
            }
        }

        return itineraries;
    }
 
开发者ID:RETIT,项目名称:continuous-performance-evaluation,代码行数:32,代码来源:ExternalRoutingService.java

示例2: toItinerary

import net.java.pathfinder.api.TransitPath; //导入依赖的package包/类
private Itinerary toItinerary(TransitPath transitPath) {
    List<Leg> legs = new ArrayList<>(transitPath.getTransitEdges().size());
    for (TransitEdge edge : transitPath.getTransitEdges()) {
        legs.add(toLeg(edge));
    }
    return new Itinerary(legs);
}
 
开发者ID:RETIT,项目名称:continuous-performance-evaluation,代码行数:8,代码来源:ExternalRoutingService.java

示例3: fetchRoutesForSpecification

import net.java.pathfinder.api.TransitPath; //导入依赖的package包/类
@Override
public List<Itinerary> fetchRoutesForSpecification(
        RouteSpecification routeSpecification) {
    // The RouteSpecification is picked apart and adapted to the external API.
    String origin = routeSpecification.getOrigin().getUnLocode().getIdString();
    String destination = routeSpecification.getDestination().getUnLocode()
            .getIdString();

    List<TransitPath> transitPaths = graphTraversalResource
            .queryParam("origin", origin)
            .queryParam("destination", destination)
            .request(MediaType.APPLICATION_JSON_TYPE)
            .get(new GenericType<List<TransitPath>>() {
            });

    // The returned result is then translated back into our domain model.
    List<Itinerary> itineraries = new ArrayList<>();

    for (TransitPath transitPath : transitPaths) {
        Itinerary itinerary = toItinerary(transitPath);
        // Use the specification to safe-guard against invalid itineraries
        if (routeSpecification.isSatisfiedBy(itinerary)) {
            itineraries.add(itinerary);
        } else {
            log.log(Level.FINE,
                    "Received itinerary that did not satisfy the route specification");
        }
    }

    return itineraries;
}
 
开发者ID:HackathonDevOps,项目名称:cargotracker,代码行数:32,代码来源:ExternalRoutingService.java


注:本文中的net.java.pathfinder.api.TransitPath类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。