Examples of OBAState


Examples of org.onebusaway.transit_data_federation.impl.otp.OBAState

        dijkstra.setShortestPathTreeFactory(MultiShortestPathTree.FACTORY);
        dijkstra.setPriorityQueueFactory(PriorityQueueImpl.FACTORY);

        TPOfflineOriginVertex origin = new TPOfflineOriginVertex(context, stop,
            instances, nearbyStopsAndWalkTimes, nearbyStopTimeInstances);
        State state = new OBAState(tFrom, origin, options);

        MultiShortestPathTree spt = (MultiShortestPathTree) dijkstra.getShortestPathTree(state);

        processTree(spt, stop, pathCountsByStop);
      }
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.otp.OBAState

    applyConstraintsToOptions(constraints.getConstraints(), options);

    Coordinate c = new Coordinate(location.getLon(), location.getLat());
    Vertex origin = _streetVertexIndexService.getClosestVertex(c, options);

    State originState = new OBAState(time, origin, options);
    BasicShortestPathTree tree = _transitShedPathService.getTransitShed(origin,
        originState, options);

    Map<StopEntry, Long> results = new HashMap<StopEntry, Long>();

    for (State state : tree.getAllStates()) {

      OBAState obaState = (OBAState) state;
      Vertex v = state.getVertex();

      if (v instanceof AbstractStopVertex) {
        AbstractStopVertex stopVertex = (AbstractStopVertex) v;
        StopEntry stop = stopVertex.getStop();
        long initialWaitTime = obaState.getInitialWaitTime();
        long duration = Math.abs(state.getTime() - time) - initialWaitTime;
        if (!results.containsKey(stop) || results.get(stop) > duration)
          results.put(stop, duration);
      } else if (v instanceof AbstractBlockVertex) {
        AbstractBlockVertex blockVertex = (AbstractBlockVertex) v;
        ArrivalAndDepartureInstance instance = blockVertex.getInstance();
        StopEntry stop = instance.getStop();
        long initialWaitTime = obaState.getInitialWaitTime();
        long duration = Math.abs(state.getTime() - time) - initialWaitTime;
        if (!results.containsKey(stop) || results.get(stop) > duration)
          results.put(stop, duration);
      }
    }
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.otp.OBAState

      throw new OutOfServiceAreaServiceException();

    Vertex v = options.isArriveBy() ? toVertex : fromVertex;
    Vertex target = options.isArriveBy() ? fromVertex : toVertex;

    State state = new OBAState(targetTime, v, options);

    if (_transferPathService.isEnabled()) {
      return getTransferPatternItinerariesBetween(fromVertex, toVertex,
          new Date(targetTime), options);
    } else {
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.otp.OBAState

    TraverseModeSet modes = new TraverseModeSet(TraverseMode.WALK);
    options.setModes(modes);

    Vertex origin = options.isArriveBy() ? to : from;
    Vertex target = options.isArriveBy() ? from : to;
    State state = new OBAState(time.getTime(), origin, options);

    List<GraphPath> paths = _pathService.plan(state, target, 1);

    if (CollectionsLibrary.isEmpty(paths))
      return null;
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.otp.OBAState

    options.putExtension(TPQueryData.class, queryData);

    Graph graph = _graphService.getGraph();
    Vertex origin = options.isArriveBy() ? toVertex : fromVertex;
    Vertex target = options.isArriveBy() ? fromVertex : toVertex;
    State init = new OBAState(time.getTime(), origin, options);
    options.remainingWeightHeuristic = new TPRemainingWeightHeuristicImpl();
    GenericAStar search = new GenericAStar();
    search.setSkipTraverseResultStrategy(new SkipVertexImpl());
    search.setSearchTerminationStrategy(new SearchTerminationStrategyImpl());
    search.setShortestPathTreeFactory(TripSequenceShortestPathTree.FACTORY);
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.otp.OBAState

    ArrivalAndDepartureService service = _context.getArrivalAndDepartureService();

    State results = null;

    OBAState state = (OBAState) s0;

    int maxBlockSequence = state.getMaxBlockSequence();

    if (maxBlockSequence < 0) {
      ArrivalAndDepartureInstance nextTransferStop = service.getNextTransferStopArrivalAndDeparture(_from);
      if (nextTransferStop != null) {

        long departure = _from.getBestDepartureTime();
        long arrival = nextTransferStop.getBestArrivalTime();
        int runningTime = (int) ((arrival - departure) / 1000);

        Vertex fromVertex = new BlockDepartureVertex(_context, _from);
        Vertex toVertex = new BlockArrivalVertex(_context, nextTransferStop);
        EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);

        StateEditor edit = s0.edit(this, narrative);
        edit.incrementTimeInSeconds(runningTime);
        edit.incrementWeight(runningTime);

        State result = edit.makeState();
        results = result.addToExistingResultChain(results);

        maxBlockSequence = nextTransferStop.getBlockStopTime().getBlockSequence();
      } else {
        maxBlockSequence = Integer.MAX_VALUE;
      }
    }

    ArrivalAndDepartureInstance nextStop = service.getNextStopArrivalAndDeparture(_from);

    if (nextStop != null
        && nextStop.getBlockStopTime().getBlockSequence() < maxBlockSequence) {

      long departure = _from.getBestDepartureTime();
      long arrival = nextStop.getBestArrivalTime();
      int runningTime = (int) ((arrival - departure) / 1000);

      Vertex fromVertex = new BlockDepartureVertex(_context, _from);
      Vertex toVertex = new BlockArrivalVertex(_context, nextStop);
      EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);

      OBAStateEditor edit = (OBAStateEditor) s0.edit(this, narrative);
      edit.incrementTimeInSeconds(runningTime);
      edit.incrementWeight(runningTime);

      if (state.getMaxBlockSequence() < 0)
        edit.setMaxBlockSequence(maxBlockSequence);

      State tr = edit.makeState();
      results = tr.addToExistingResultChain(results);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.