Package org.onebusaway.transit_data_federation.services.blocks

Examples of org.onebusaway.transit_data_federation.services.blocks.InstanceState


    int index = stopTime.getBlockSequence() - 1;
    if (index < 0)
      return null;

    BlockStopTimeEntry prevStopTime = stopTimes.get(index);
    InstanceState state = instance.getStopTimeInstance().getState();
    ArrivalAndDepartureTime scheduledTime = ArrivalAndDepartureTime.getScheduledTime(
        state, prevStopTime);

    if (instance.getFrequency() != null) {
View Full Code Here


    int index = stopTime.getBlockSequence() + 1;
    if (index >= stopTimes.size())
      return null;

    BlockStopTimeEntry nextStopTime = stopTimes.get(index);
    InstanceState state = instance.getStopTimeInstance().getState();

    ArrivalAndDepartureTime scheduledTime = ArrivalAndDepartureTime.getScheduledTime(
        state, nextStopTime);

    if (state.getFrequency() != null) {

      StopTimeEntry nStopTime = nextStopTime.getStopTime();

      int betweenStopDelta = nStopTime.getArrivalTime()
          - stopTime.getStopTime().getDepartureTime();
View Full Code Here

      StopEntry nextStop = nextStopTime.getStop();

      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(
            nextStopTimeInstance, nextScheduledTime);

        if (state.getFrequency() != null) {

          int betweenStopDelta = nextStopTime.getArrivalTime()
              - blockStopTime.getStopTime().getDepartureTime();
          int atStopDelta = nextStopTime.getDepartureTime()
              - nextStopTime.getArrivalTime();
View Full Code Here

    /**
     * Why don't we use the ArrivalAndDepartureTime scheduled arrival and
     * departures here? Because they may have been artificially shifted for a
     * frequency-based method
     */
    InstanceState state = instance.getStopTimeInstance().getState();
    ArrivalAndDepartureTime schedule = ArrivalAndDepartureTime.getScheduledTime(
        state, instance.getBlockStopTime());

    long arrivalTime = schedule.getArrivalTime() + arrivalDeviation * 1000;
    setPredictedArrivalTimeForInstance(instance, arrivalTime);
View Full Code Here

    BlockEntryImpl block = block("block");
    BlockConfigurationEntry blockConfig = blockConfiguration(block,
        serviceIds(lsids("a"), lsids()), trip);

    BlockTripInstance blockTripInstance = new BlockTripInstance(
        blockConfig.getTrips().get(0), new InstanceState(
            System.currentTimeMillis()));

    List<ServiceAlert> alerts = _service.getServiceAlertsForVehicleJourney(
        System.currentTimeMillis(), blockTripInstance, new AgencyAndId("1",
            "1111"));
View Full Code Here

        int fromIndex = GenericBinarySearch.search(index, index.size(),
            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,
View Full Code Here

         * have to decrement to find the first good stop index
         */
        if (!findDepartures)
          sourceIndex--;

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

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

          BlockStopTimeEntry stopTimeSource = sourceStopIndex.getBlockStopTimeForIndex(sourceIndex);
          StopTimeInstance stiSource = new StopTimeInstance(stopTimeSource,
View Full Code Here

        if (0 <= sourceIndex && sourceIndex < sourceStopIndex.size()) {

          FrequencyBlockStopTimeEntry sourceEntry = sourceStopTimes.get(sourceIndex);
          BlockStopTimeEntry sourceBst = sourceEntry.getStopTime();
          FrequencyEntry frequency = sourceEntry.getFrequency();
          InstanceState state = new InstanceState(serviceDate.getTime(),
              frequency);
          int stopTimeOffset = sourceEntry.getStopTimeOffset();

          int frequencyOffset = computeFrequencyOffset(relativeTime, sourceBst,
              frequency, stopTimeOffset, findDepartures);
View Full Code Here

    int fromIndex = GenericBinarySearch.search(index, blockStopTimes.size(),
        relativeFrom, IndexAdapters.BLOCK_STOP_TIME_DEPARTURE_INSTANCE);
    int toIndex = GenericBinarySearch.search(index, blockStopTimes.size(),
        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));
    }
View Full Code Here

      FrequencyBlockStopTimeEntry entry = frequencyStopTimes.get(in);
      BlockStopTimeEntry bst = entry.getStopTime();
      FrequencyEntry frequency = entry.getFrequency();

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

      switch (frequencyBehavior) {

        case INCLUDE_UNSPECIFIED: {
          stopTimeInstances.add(new StopTimeInstance(bst, state));
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data_federation.services.blocks.InstanceState

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.