Package org.opentripplanner.routing.core

Examples of org.opentripplanner.routing.core.Vertex


  private EdgeNarrative computeNarrative(State s0) {

    if (_reverse) {

      Vertex fromV = new TPArrivalVertex(_context, _fromState);
      Vertex toV = new TPBlockDepartureVertex(_context, _toState, _departure,
          _arrival);
      return narrative(s0, fromV, toV);

    } else {

      Vertex fromV = new TPBlockArrivalVertex(_context, _fromState, _departure,
          _arrival);
      Vertex toV = new TPDepartureVertex(_context, _toState);
      return narrative(s0, fromV, toV);
    }
  }
View Full Code Here


    OBATraverseOptions obaOpts = (OBATraverseOptions) s0.getOptions();

    ArrivalAndDepartureService adService = _context.getArrivalAndDepartureService();

    Vertex toV = new TPArrivalVertex(_context, _pathState);

    Pair<StopEntry> stopPair = _pathState.getStops();

    TargetTime targetTime = new TargetTime(s0.getTime(), obaOpts.currentTime);

    ArrivalAndDeparturePairQuery query = new ArrivalAndDeparturePairQuery();
    query.setResultCount(obaOpts.numItineraries);
    query.setApplyRealTime(obaOpts.useRealtime);
    query.setIncludePrivateService(false);

    /**
     * Recall that the stopPair is in reverse order (toStop => fromStop)
     */
    List<Pair<ArrivalAndDepartureInstance>> instances = adService.getPreviousArrivalsForStopPair(
        stopPair.getSecond(), stopPair.getFirst(), targetTime, query);

    State results = null;

    for (Pair<ArrivalAndDepartureInstance> pair : instances) {

      /**
       * For now, we skip real-time arrival that might have been included that
       * are beyond our range (ex. vehicle running late)
       */
      ArrivalAndDepartureInstance arrival = pair.getSecond();
      if (arrival.getBestArrivalTime() > s0.getTime())
        break;

      Vertex fromV = new TPBlockArrivalVertex(_context, _pathState,
          pair.getFirst(), pair.getSecond());

      EdgeNarrative narrative = narrative(s0, fromV, toV);

      OBAStateEditor edit = (OBAStateEditor) s0.edit(this, narrative);
View Full Code Here

    long arrival = _arrival.getBestArrivalTime();
    return (int) ((arrival - departure) / 1000);
  }

  private EdgeNarrative createNarrative(State s0) {
    Vertex fromV = new TPBlockDepartureVertex(_context, _pathState, _departure,
        _arrival);
    Vertex toV = new TPBlockArrivalVertex(_context, _pathState, _departure,
        _arrival);
    return narrative(s0, fromV, toV);
  }
View Full Code Here

    OBATraverseOptions obaOpts = (OBATraverseOptions) s0.getOptions();

    ArrivalAndDepartureService adService = _context.getArrivalAndDepartureService();

    Vertex fromV = new TPDepartureVertex(_context, _pathState);

    Pair<StopEntry> stopPair = _pathState.getStops();

    TargetTime targetTime = new TargetTime(s0.getTime(), obaOpts.currentTime);

    ArrivalAndDeparturePairQuery query = new ArrivalAndDeparturePairQuery();
    query.setResultCount(obaOpts.numItineraries);
    query.setApplyRealTime(obaOpts.useRealtime);
    query.setIncludePrivateService(false);
    if (s0.getNumBoardings() == 0)
      query.setLookaheadTime(obaOpts.lookaheadTime);

    List<Pair<ArrivalAndDepartureInstance>> instances = adService.getNextDeparturesForStopPair(
        stopPair.getFirst(), stopPair.getSecond(), targetTime, query);

    State results = null;

    for (Pair<ArrivalAndDepartureInstance> pair : instances) {

      ArrivalAndDepartureInstance departure = pair.getFirst();
      if (departure.getBestDepartureTime() < s0.getTime()
          - query.getLookaheadTime() * 1000)
        continue;

      Vertex toV = new TPBlockDepartureVertex(_context, _pathState, departure,
          pair.getSecond());

      int dwellTime = computeWaitTime(s0, pair);

      double w = ItineraryWeightingLibrary.computeWeightForWait(s0, dwellTime);
View Full Code Here

  }

  private State traverseReverse(State s0) {

    TPDepartureVertex fromVertex = new TPDepartureVertex(_context, _pathState);
    Vertex toVertex = null;
    EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);

    return s0.edit(this, narrative).makeState();
  }
View Full Code Here

      TraverseOptions options = s0.getOptions();

      if (options.isArriveBy())
        return null;

      Vertex toVertex = new TPOfflineBlockDepartureVertex(_context, _instance);
      EdgeNarrative narrative = narrative(s0, TPOfflineTransferVertex.this,
          toVertex);

      StateEditor edit = s0.edit(this, narrative);
      edit.setEverBoarded(true);
View Full Code Here

  /****
   * Private Methods
   ****/

  private EdgeNarrative createNarrative(State s0) {
    Vertex fromVertex = new TPOfflineBlockArrivalVertex(_context, _instance);
    Vertex toVertex = new TPOfflineArrivalVertex(_context, _instance.getStop());
    return narrative(s0, fromVertex, toVertex);
  }
View Full Code Here

  private StopEntry getActualOriginStop(State state,
      Map<State, StopEntry> actualOriginStops) {

    StopEntry actual = actualOriginStops.get(state);
    if (actual == null) {
      Vertex v = state.getVertex();
      if (v instanceof TPOfflineNearbyStopsVertex) {
        TPOfflineNearbyStopsVertex nsv = (TPOfflineNearbyStopsVertex) v;
        actual = nsv.getStop();
      } else if (v instanceof TPOfflineOriginVertex) {
        TPOfflineOriginVertex originVertex = (TPOfflineOriginVertex) v;
View Full Code Here

    List<StopEntry> parent = parentsByState2.get(state);

    if (parent != null)
      return parent;

    Vertex v = state.getVertex();

    if (v instanceof TPOfflineNearbyStopsVertex) {
      TPOfflineNearbyStopsVertex nsv = (TPOfflineNearbyStopsVertex) v;
      return Arrays.asList(nsv.getStop());
    } else if (v instanceof TPOfflineOriginVertex) {
View Full Code Here

    public boolean shouldSkipTraversalResult(Vertex origin, Vertex target,
        State parent, State current, ShortestPathTree spt,
        TraverseOptions traverseOptions) {

      EdgeNarrative narrative = current.getBackEdgeNarrative();
      Vertex vertex = narrative.getToVertex();

      /**
       * We prune any arrivals that loop back to the origin stop
       */
      if (vertex instanceof TPOfflineBlockArrivalVertex) {
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.core.Vertex

Copyright © 2018 www.massapicom. 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.