Examples of OBAStateEditor


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

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

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

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

      int dwellTime = computeWaitTime(s0, pair);
      edit.incrementTimeInSeconds(-dwellTime);

      double w = ItineraryWeightingLibrary.computeWeightForWait(s0, dwellTime);
      edit.incrementWeight(w);

      if (arrival.getBlockSequence() != null)
        edit.appendTripSequence(arrival.getBlockSequence());
      else
        edit.appendTripSequence(arrival.getBlockTrip());

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

    return results;
  }
View Full Code Here

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

      int dwellTime = computeWaitTime(s0, pair);

      double w = ItineraryWeightingLibrary.computeWeightForWait(s0, dwellTime);

      EdgeNarrative narrative = narrative(s0, fromV, toV);
      OBAStateEditor edit = (OBAStateEditor) s0.edit(this, narrative);
      edit.setTime(departure.getBestDepartureTime());
      edit.incrementWeight(w);

      /**
       * If the departure time is less than the starting state time, it must
       * mean the departure was included as determined by the lookahead
       * parameter. Thus, we indicate that we have a lookahead itinerary.
       */
      if (departure.getBestDepartureTime() < s0.getTime())
        edit.setLookaheadItinerary();

      if (departure.getBlockSequence() != null)
        edit.appendTripSequence(departure.getBlockSequence());
      else
        edit.appendTripSequence(departure.getBlockTrip());

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

    return results;
  }
View Full Code Here

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

      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

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

      Vertex fromVertex = new BlockArrivalVertex(_context, instance);
      Vertex toVertex = new ArrivalVertex(_context, _stop, s0.getTime());
      EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);

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

      int dwellTime = (int) ((time - arrivalTime) / 1000);

      edit.setTime(arrivalTime);
      edit.incrementNumBoardings();
      edit.setEverBoarded(true);

      if (s0.getNumBoardings() == 0)
        edit.incrementInitialWaitTime(dwellTime * 1000);

      double w = ItineraryWeightingLibrary.computeWeightForWait(s0, dwellTime);
      edit.incrementWeight(w);

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

    // In addition to all the departures, we can just remain waiting at the stop
    int dwellTime = (int) ((time - timeFrom) / 1000);
    double w = ItineraryWeightingLibrary.computeWeightForWait(s0, dwellTime);

    Vertex fromVertex = new ArrivalVertex(_context, _stop, timeFrom);
    Vertex toVertex = new ArrivalVertex(_context, _stop, s0.getTime());
    EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);

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

    edit.incrementWeight(w);
    edit.setTime(time);

    if (s0.getNumBoardings() == 0)
      edit.incrementInitialWaitTime(dwellTime * 1000);

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

    return results;
  }
View Full Code Here

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

    DepartureVertex fromVertex = new DepartureVertex(_context, _stop,
        s0.getTime());
    DepartureVertex toVertex = new DepartureVertex(_context, _stop, toTime);
    EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);

    OBAStateEditor edit = (OBAStateEditor) s0.edit(this, narrative);
    edit.setTime(toTime);

    int dwellTime = (int) ((toTime - time) / 1000);
    double w = ItineraryWeightingLibrary.computeWeightForWait(s0, dwellTime);
    edit.incrementWeight(w);

    if (s0.getNumBoardings() == 0)
      edit.incrementInitialWaitTime(dwellTime * 1000);

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

    return results;
  }
View Full Code Here

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

    DepartureVertex fromVertex = new DepartureVertex(_context, _stop, time);
    BlockDepartureVertex toVertex = new BlockDepartureVertex(_context, instance);
    EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);

    OBAStateEditor edit = (OBAStateEditor) s0.edit(this, narrative);
    edit.setTime(departureTime);
    edit.incrementNumBoardings();
    edit.setEverBoarded(true);

    int dwellTime = (int) ((departureTime - time) / 1000);
    double w = ItineraryWeightingLibrary.computeWeightForWait(s0, dwellTime);

    if (s0.getNumBoardings() == 0)
      edit.incrementInitialWaitTime(dwellTime * 1000);

    edit.appendTripSequence(instance.getBlockTrip());
    edit.incrementWeight(w);

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

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

    TPOfflineTransferVertex toVertex = new TPOfflineTransferVertex(_context,
        instance);
    EdgeNarrative narrative = narrative(s0, _fromVertex, toVertex);

    OBAStateEditor edit = (OBAStateEditor) s0.edit(this, narrative);
    edit.setTime(departureTime);

    int dwellTime = (int) ((departureTime - time) / 1000);
    double w = transferWeight
        + ItineraryWeightingLibrary.computeWeightForWait(s0, dwellTime);
    edit.incrementWeight(w);

    if (s0.getNumBoardings() == 0)
      edit.incrementInitialWaitTime(dwellTime * 1000);

    edit.appendTripSequence(instance.getStopTime().getTrip());

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