Package org.opentripplanner.routing.core

Examples of org.opentripplanner.routing.core.StateEditor


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

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


        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);
    }

    return results;
  }
View Full Code Here

    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();
    int runningTime = (int) ((arrival - departure) / 1000);
    edit.incrementTimeInSeconds(runningTime);
    edit.incrementWeight(runningTime);

    return edit.makeState();
  }
View Full Code Here

    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);
    return edit.makeState();
  }
View Full Code Here

  }

  private State traverseForward(State s0) {

    EdgeNarrative narrative = createNarrative(s0, s0.getTime());
    StateEditor edit = s0.edit(this, narrative);

    TraverseOptions options = s0.getOptions();
    int transferTime = computeTransferTime(options);
    edit.setTime(_instance.getBestArrivalTime());

    double weight = computeWeightForTransferTime(options, transferTime);
    edit.incrementWeight(weight);

    return edit.makeState();
  }
View Full Code Here

  private State traverseReverse(State s0) {

    TraverseOptions options = s0.getOptions();

    EdgeNarrative narrative = createNarrative(s0);
    StateEditor edit = s0.edit(this, narrative);
    edit.incrementTimeInSeconds(options.minTransferTime);
    double w = options.minTransferTime * options.waitAtBeginningFactor;
    edit.incrementWeight(w);
    return edit.makeState();
  }
View Full Code Here

      Vertex fromVertex = new WalkToStopVertex(_context, _stop);
      Vertex toVertex = new TPDepartureVertex(_context, pathState);
      EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);

      StateEditor edit = s0.edit(this, narrative);
      edit.incrementTimeInSeconds(options.minTransferTime);

      double w = options.minTransferTime * options.waitAtBeginningFactor;
      edit.incrementWeight(w);

      State r = edit.makeState();
      results = r.addToExistingResultChain(results);
    }

    return results;
  }
View Full Code Here

      return null;

    int transferTime = computeTransferTime(options);
    long t = s0.getTime() - ((transferTime + options.minTransferTime) * 1000);
    EdgeNarrative narrative = createNarrative(s0, t);
    StateEditor edit = s0.edit(this, narrative);
    edit.setTime(t);

    double weight = computeWeightForTransferTime(options, transferTime);
    edit.incrementWeight(weight);

    return edit.makeState();
  }
View Full Code Here

  @Override
  public State traverse(State s0) {

    EdgeNarrative narrative = createNarrative(s0);

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

    return edit.makeState();
  }
View Full Code Here

    BlockStopTimeEntry bst = _instance.getBlockStopTime();
    StopTimeEntry stopTime = bst.getStopTime();
    int dwellTime = stopTime.getSlackTime();

    EdgeNarrative narrative = createNarrative(s0);
    StateEditor edit = s0.edit(this, narrative);
    edit.incrementTimeInSeconds(dwellTime);
    edit.incrementWeight(dwellTime);

    return edit.makeState();
  }
View Full Code Here

TOP

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

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.