Package org.opentripplanner.routing.core

Examples of org.opentripplanner.routing.core.EdgeNarrative


  }

  @Override
  public double computeForwardWeight(State s, Vertex target) {

    EdgeNarrative narrative = s.getBackEdgeNarrative();
    Vertex v = narrative.getToVertex();

    return computeWeight(s, target, v);
  }
View Full Code Here


  }

  @Override
  public double computeReverseWeight(State s, Vertex target) {

    EdgeNarrative narrative = s.getBackEdgeNarrative();
    Vertex v = narrative.getFromVertex();

    return computeWeight(s, target, v);
  }
View Full Code Here

      for (Edge edge : outgoing) {

        for (State wr = edge.traverse(state); wr != null; wr = wr.getNextResult()) {

          EdgeNarrative er = wr.getBackEdgeNarrative();
          Vertex toVertex = er.getToVertex();

          if (!closed.contains(toVertex)) {

            if (spt.add(wr))
              queue.insert(wr, wr.getWeight());
View Full Code Here

    else
      return traverseForward(s0);
  }

  private State traverseForward(State s0) {
    EdgeNarrative narrative = createNarrative(s0);
    return s0.edit(this, narrative).makeState();
  }
View Full Code Here

    TransferPatternService tpService = _context.getTransferPatternService();
    if (tpService.isEnabled())
      return traverseBackTransferPatterns(s0, options);

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

  private State traverseBackTransferPatterns(State s0, TraverseOptions options) {

    if (!_isReverseEdge) {
      Vertex fromVertex = null;
      Vertex toVertex = new WalkFromStopVertex(_context, _stop);
      EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);
      return s0.edit(this, narrative).makeState();
    }

    TransferPatternService tpService = _context.getTransferPatternService();

    TPQueryData queryData = options.getExtension(TPQueryData.class);

    List<StopEntry> sourceStops = queryData.getSourceStops();

    State results = null;

    Collection<TransferNode> trees = tpService.getReverseTransferPatternsForStops(
        queryData.getTransferPatternData(), sourceStops, _stop);

    for (TransferNode tree : trees) {

      TPState pathState = TPState.end(queryData, tree);

      Vertex fromVertex = new TPArrivalVertex(_context, pathState);
      Vertex toVertex = new WalkFromStopVertex(_context, _stop);

      EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);
      State r = s0.edit(this, narrative).makeState();
      results = r.addToExistingResultChain(results);
    }

    return results;
View Full Code Here

        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);
View Full Code Here

    if (nextStop == null)
      return null;

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

    StateEditor edit = s0.edit(this, narrative);

    long departure = _from.getBestDepartureTime();
    long arrival = nextStop.getBestArrivalTime();
View Full Code Here

  private State traverseReverse(State s0) {

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

    StateEditor edit = s0.edit(this, narrative);
    int runningTime = (int) ((s0.getTime() - _from.getBestDepartureTime()) / 1000);
    edit.setTime(_from.getBestDepartureTime());
    edit.incrementWeight(runningTime);
View Full Code Here

  }

  @Override
  public double computeForwardWeight(State s, Vertex target) {

    EdgeNarrative narrative = s.getBackEdgeNarrative();
    Vertex v = narrative.getToVertex();

    return computeWeight(s, target, v);
  }
View Full Code Here

TOP

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

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.