Package org.onebusaway.transit_data_federation.services.blocks

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


    Map<BlockInstance, List<BlockLocation>> locationsByInstance = _blockStatusService.getBlocks(
        block.getId(), problem.getServiceDate(), record.getVehicleId(),
        problem.getTime());

    BlockInstance blockInstance = getBestBlockInstance(locationsByInstance.keySet());

    if (blockInstance != null) {

      List<BlockLocation> blockLocations = locationsByInstance.get(blockInstance);
View Full Code Here


    stopTime(0, stop, trip, time(8, 53), 0);
    BlockEntryImpl block = block("block");
    BlockConfigurationEntry blockConfig = blockConfiguration(block,
        serviceIds(lsids("a"), lsids()), trip);

    BlockInstance blockInstance = new BlockInstance(blockConfig,
        System.currentTimeMillis());
    List<ServiceAlert> alerts = _service.getServiceAlertsForStopCall(
        System.currentTimeMillis(), blockInstance,
        blockConfig.getStopTimes().get(0), new AgencyAndId("1", "1111"));
    assertEquals(4, alerts.size());
View Full Code Here

      Map<BlockInstance, List<List<BlockLocation>>> allLocations = _blockStatusService.getBlocksForIndex(
          index, timestamps);

      for (Map.Entry<BlockInstance, List<List<BlockLocation>>> entry : allLocations.entrySet()) {

        BlockInstance blockInstance = entry.getKey();
        List<List<BlockLocation>> realTimeLocations = entry.getValue();

        computeEstimatesForBlockInstance(records, recordsByTime, blockInstance,
            realTimeLocations, query.getMinProbability(), beans);
      }
View Full Code Here

    if (blockIdAsString == null || serviceDate == 0)
      return false;

    AgencyAndId blockId = AgencyAndIdLibrary.convertFromString(blockIdAsString);
    BlockInstance blockInstance = _blockCalendarService.getBlockInstance(
        blockId, serviceDate);

    if (blockInstance == null)
      return false;
View Full Code Here

    BlockConfigurationEntry blockConfigA = blockConfiguration(blockA,
        serviceIds("s1"), tripA, tripB);
    BlockConfigurationEntry blockConfigB = blockConfiguration(blockB,
        serviceIds("s1"), tripC, tripD);

    BlockInstance blockInstanceA = new BlockInstance(blockConfigA, 0L);
    BlockInstance blockInstanceB = new BlockInstance(blockConfigB, 0L);

    Mockito.when(
        _blockCalendarService.getActiveBlocks(Mockito.eq(blockA.getId()),
            Mockito.anyLong(), Mockito.anyLong())).thenReturn(
        Arrays.asList(blockInstanceA));
View Full Code Here

    List<TripDetailsBean> tripDetails = new ArrayList<TripDetailsBean>();

    for (Map.Entry<BlockInstance, List<BlockLocation>> entry : locationsByInstance.entrySet()) {

      BlockInstance blockInstance = entry.getKey();
      List<BlockLocation> locations = entry.getValue();

      BlockTripInstance blockTripInstance = BlockTripInstanceLibrary.getBlockTripInstance(
          blockInstance, tripId);
View Full Code Here

      BlockLocation blockLocation, long time) {

    TripStatusBean bean = new TripStatusBean();
    bean.setStatus("default");

    BlockInstance blockInstance = blockLocation.getBlockInstance();
    long serviceDate = blockInstance.getServiceDate();

    bean.setServiceDate(serviceDate);

    bean.setLastUpdateTime(blockLocation.getLastUpdateTime());
    bean.setLastLocationUpdateTime(blockLocation.getLastLocationUpdateTime());
View Full Code Here

    /****
     *
     ****/

    BlockInstance blockInstanceA = new BlockInstance(blockConfigA, serviceDate);
    long lastUpdateTime = dateAsLong("2010-10-05 16:15");

    BlockLocation blockLocationA = new BlockLocation();
    blockLocationA.setActiveTrip(bstAA.getTrip());
    blockLocationA.setBlockInstance(blockInstanceA);
    blockLocationA.setClosestStop(bstAA);
    blockLocationA.setDistanceAlongBlock(500);
    blockLocationA.setInService(true);
    blockLocationA.setLastUpdateTime(lastUpdateTime);
    blockLocationA.setNextStop(bstAA);
    blockLocationA.setPredicted(true);
    blockLocationA.setScheduledDistanceAlongBlock(600);
    blockLocationA.setScheduleDeviation(10 * 60);
    blockLocationA.setVehicleId(aid("vehicle"));

    /****
     *
     ****/

    BlockInstance blockInstanceB = new BlockInstance(blockConfigB, serviceDate);

    BlockLocation blockLocationB = new BlockLocation();
    blockLocationB.setActiveTrip(bstBA.getTrip());
    blockLocationB.setBlockInstance(blockInstanceA);
    blockLocationB.setClosestStop(bstBA);
    blockLocationB.setDistanceAlongBlock(400);
    blockLocationB.setInService(true);
    blockLocationB.setNextStop(bstAA);
    blockLocationB.setPredicted(false);
    blockLocationB.setScheduledDistanceAlongBlock(400);

    /****
     *
     ****/

    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

       * from the map. On the next loop, it should no longer be in the map.
       */
      if (!cacheEntry.addElement(record, scheduledBlockLocation, samples))
        continue;

      BlockInstance existingBlockInstance = cacheEntry.getBlockInstance();
      if (!blockInstance.equals(existingBlockInstance))
        ConcurrentCollectionsLibrary.removeFromMapValueSet(
            _vehicleIdsByBlockInstance, existingBlockInstance, vehicleId);

      // Ensure the block => vehicle mapping is set
View Full Code Here

    BlockEntryImpl block = block("blockA");
    TripEntryImpl trip = trip("tripA", "serviceId");
    stopTime(0, null, trip, time(9, 00), 0);
    BlockConfigurationEntry blockConfig = linkBlockTrips(block, trip);
    BlockInstance blockInstance = new BlockInstance(blockConfig,
        System.currentTimeMillis());

    SortedMap<Long, BlockLocationRecord> records = new TreeMap<Long, BlockLocationRecord>();

    CoordinatePoint p1 = new CoordinatePoint(47.0, -122.0);
View Full Code Here

TOP

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

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.