Package org.onebusaway.transit_data_federation.services.tripplanner

Examples of org.onebusaway.transit_data_federation.services.tripplanner.StopTimeInstance


      scheduledTime.setArrivalTime(scheduledArrivalTime);
      scheduledTime.setDepartureTime(scheduledDepartureTime);
    }

    StopTimeInstance nextStopTimeInstance = new StopTimeInstance(stopTime,
        state);
    ArrivalAndDepartureInstance nextInstance = new ArrivalAndDepartureInstance(
        nextStopTimeInstance, scheduledTime);

    if (instance.isPredictedDepartureTimeSet()) {
View Full Code Here


      List<StopTransfer> transfers = _stopTransferService.getTransfersFromStop(nextStop);

      if (!transfers.isEmpty()) {
        InstanceState state = instance.getStopTimeInstance().getState();
        StopTimeInstance nextStopTimeInstance = new StopTimeInstance(
            nextBlockStopTime, state);
        ArrivalAndDepartureTime nextScheduledTime = ArrivalAndDepartureTime.getScheduledTime(
            state, nextBlockStopTime);

        ArrivalAndDepartureInstance nextInstance = new ArrivalAndDepartureInstance(
View Full Code Here

    Map<BlockInstance, List<BlockLocation>> blockLocationsByBlockInstance = getBlockLocationInformationForPairs(
        pairs, targetTime, applyRealTime);

    for (Pair<StopTimeInstance> pair : pairs) {

      StopTimeInstance stiFrom = pair.getFirst();
      StopTimeInstance stiTo = pair.getSecond();

      BlockInstance blockInstance = stiFrom.getBlockInstance();
      List<BlockLocation> locations = blockLocationsByBlockInstance.get(blockInstance);

      applyRealTimeToStopTimeInstancePair(stiFrom, stiTo, targetTime, tFrom,
View Full Code Here

    if (blockTripInstance == null)
      return null;

    BlockStopTimeEntry blockStopTime = getBlockStopTime(blockTripInstance,
        stopId, stopSequence, timeOfServiceDate);
    StopTimeInstance stopTimeInstance = new StopTimeInstance(blockStopTime,
        blockTripInstance.getState());

    return createArrivalAndDeparture(stopTimeInstance, prevFrequencyTime,
        StopTimeInstance.UNSPECIFIED_FREQUENCY_OFFSET);
  }
View Full Code Here

     ****/

    long stopTimeFrom = t - minutesBefore * 60 * 1000;
    long stopTimeTo = t + minutesAfter * 60 * 1000;

    StopTimeInstance sti1 = new StopTimeInstance(bstAB,blockInstanceA.getState());
    ArrivalAndDepartureInstance in1 = new ArrivalAndDepartureInstance(sti1);
    in1.setBlockLocation(blockLocationA);
    in1.setPredictedArrivalTime((long) (in1.getScheduledArrivalTime() + 5 * 60 * 1000));
    in1.setPredictedDepartureTime((long) (in1.getScheduledDepartureTime()));

    StopTimeInstance sti2 = new StopTimeInstance(bstBB, blockInstanceB.getState());
    ArrivalAndDepartureInstance in2 = new ArrivalAndDepartureInstance(sti2);
    in2.setBlockLocation(blockLocationB);

    TargetTime target = new TargetTime(t, t);

View Full Code Here

            relativeFrom, IndexAdapters.BLOCK_STOP_TIME_DEPARTURE_INSTANCE);

        if (fromIndex < index.size()) {
          BlockStopTimeEntry blockStopTime = index.getBlockStopTimeForIndex(fromIndex);
          InstanceState state = new InstanceState(serviceDate.getTime());
          StopTimeInstance sti = new StopTimeInstance(blockStopTime, state);
          stopTimeInstances.add(sti);
        }
      }
    }

    List<FrequencyBlockStopTimeIndex> frequencyIndices = _blockIndexService.getFrequencyStopTimeIndicesForStop(stopEntry);

    for (FrequencyBlockStopTimeIndex index : frequencyIndices) {

      List<Date> serviceDates = _calendarService.getNextServiceDatesForDepartureInterval(
          index.getServiceIds(), index.getServiceInterval(), time);

      for (Date serviceDate : serviceDates) {

        int relativeFrom = effectiveTime(serviceDate.getTime(), time);

        int fromIndex = GenericBinarySearch.search(index, index.size(),
            relativeFrom, IndexAdapters.FREQUENCY_END_TIME_INSTANCE);

        List<FrequencyBlockStopTimeEntry> frequencyStopTimes = index.getFrequencyStopTimes();
        if (fromIndex < index.size()) {
          FrequencyBlockStopTimeEntry entry = frequencyStopTimes.get(fromIndex);
          BlockStopTimeEntry bst = entry.getStopTime();
          FrequencyEntry frequency = entry.getFrequency();
          InstanceState state = new InstanceState(serviceDate.getTime(),
              frequency);
          int stopTimeOffset = entry.getStopTimeOffset();
          int frequencyOffset = computeFrequencyOffset(relativeFrom, bst,
              frequency, stopTimeOffset, true);
          StopTimeInstance sti = new StopTimeInstance(bst, state,
              frequencyOffset);
          stopTimeInstances.add(sti);
        }
      }
View Full Code Here

        InstanceState state = new InstanceState(serviceDate.getTime());

        while (0 <= sourceIndex && sourceIndex < sourceStopIndexSize) {

          BlockStopTimeEntry stopTimeSource = sourceStopIndex.getBlockStopTimeForIndex(sourceIndex);
          StopTimeInstance stiSource = new StopTimeInstance(stopTimeSource,
              state);
          stiSource.setBlockSequence(sourceStopIndex.getBlockSequenceForIndex(sourceIndex));

          BlockStopTimeEntry stopTimeDest = destStopTimes.get(sourceIndex);
          StopTimeInstance stiDest = new StopTimeInstance(stopTimeDest, state);
          stiDest.setBlockSequence(destStopIndex.getBlockSequenceForIndex(sourceIndex));

          if (stopTimeIsBeyondRangeOfQueue(nBestQueue, stiDest, resultCount,
              findDepartures, slack)) {
            break;
          }

          Pair<StopTimeInstance> stiPair = findDepartures ? Tuples.pair(
              stiSource, stiDest) : Tuples.pair(stiDest, stiSource);

          /**
           * We only add to the n-best queue if the arrival-departure is beyond
           * the target time, as opposed to time adjusted by slack
           */
          if (isStopTimeInstanceBeyondTargetTime(stiSource, targetTime,
              findDepartures)) {
            nBestQueue.add(stiPair);
          }

          while (nBestQueue.size() > resultCount)
            nBestQueue.poll();

          /**
           * We always add to the result queue
           */
          resultQueue.add(stiPair);

          while (!resultQueue.isEmpty()) {
            Pair<StopTimeInstance> r = resultQueue.peek();
            StopTimeInstance sti = findDepartures ? r.getSecond()
                : r.getFirst();
            if (stopTimeIsBeyondRangeOfQueue(nBestQueue, sti, resultCount,
                findDepartures, slack))
              resultQueue.poll();
            else
View Full Code Here

    super(sti,false);
  }

  @Override
  public String toString() {
    StopTimeInstance sti = getStopTimeInstance();
    return "continuation(ts=" + getCurrentTimeString() + " stop="
        + sti.getStop().getId() + ")";
  }
View Full Code Here

          int stopTimeOffset = sourceEntry.getStopTimeOffset();

          int frequencyOffset = computeFrequencyOffset(relativeTime, sourceBst,
              frequency, stopTimeOffset, findDepartures);

          StopTimeInstance stiSource = new StopTimeInstance(sourceBst, state,
              frequencyOffset);

          FrequencyBlockStopTimeEntry toEntry = destStopTimes.get(sourceIndex);
          BlockStopTimeEntry stopTimeTo = toEntry.getStopTime();
          StopTimeInstance stiDest = new StopTimeInstance(stopTimeTo, state,
              frequencyOffset);

          /**
           * There's a chance the frequency-based departure+arrival pair could
           * extend out the front of the frequency range, at which point we
           * discard it.
           */
          if (!findDepartures
              && stiDest.getDepartureTime() < serviceDate.getTime()
                  + frequency.getStartTime() * 1000) {
            break;
          }

          if (stopTimeIsBeyondRangeOfQueue(nBestQueue, stiDest, resultCount,
              findDepartures, slack))
            break;

          Pair<StopTimeInstance> stiPair = findDepartures ? Tuples.pair(
              stiSource, stiDest) : Tuples.pair(stiDest, stiSource);

          /**
           * We only add to the n-best queue if the arrival-departure is beyond
           * the target time, as opposed to time adjusted by slack
           */
          if (isStopTimeInstanceBeyondTargetTime(stiSource, targetTime,
              findDepartures)) {
            nBestQueue.add(stiPair);
          }

          while (nBestQueue.size() > resultCount)
            nBestQueue.poll();

          /**
           * We always add to the result queue
           */
          resultQueue.add(stiPair);

          while (!resultQueue.isEmpty()) {
            Pair<StopTimeInstance> r = resultQueue.peek();
            StopTimeInstance sti = findDepartures ? r.getSecond()
                : r.getFirst();
            if (stopTimeIsBeyondRangeOfQueue(nBestQueue, sti, resultCount,
                findDepartures, slack))
              resultQueue.poll();
            else
View Full Code Here

        relativeTo, IndexAdapters.BLOCK_STOP_TIME_ARRIVAL_INSTANCE);

    InstanceState state = new InstanceState(serviceDate.getTime());
    for (int in = fromIndex; in < toIndex; in++) {
      BlockStopTimeEntry blockStopTime = blockStopTimes.get(in);
      instances.add(new StopTimeInstance(blockStopTime, state));
    }

    return fromIndex;
  }
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data_federation.services.tripplanner.StopTimeInstance

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.