Package org.onebusaway.transit_data.model.realtime.CurrentVehicleEstimateQueryBean

Examples of org.onebusaway.transit_data.model.realtime.CurrentVehicleEstimateQueryBean.Record


      List<CurrentVehicleEstimateBean> beans) {

    if (query.getVehicleId() == null)
      return false;

    Record record = records.get(records.size() - 1);

    AgencyAndId vehicleId = AgencyAndIdLibrary.convertFromString(query.getVehicleId());
    BlockLocation location = _blockLocationService.getLocationForVehicleAndTime(
        vehicleId, new TargetTime(record.getTimestamp()));

    if (location == null)
      return false;

    double d = SphericalGeometryLibrary.distance(record.getLocation(),
        location.getLocation());
    double p = _realTimeLocationDeviationModel.probability(d);

    if (p < _shortCutProbability)
      return false;
View Full Code Here


    DoubleArrayList ps = new DoubleArrayList();

    for (BlockLocation location : locations) {

      Date t = new Date(location.getTime());
      Record record = recordsByTime.get(t);

      CoordinatePoint userLocation = record.getLocation();
      CoordinatePoint vehicleLocation = location.getLocation();

      double d = SphericalGeometryLibrary.distance(userLocation,
          vehicleLocation);
View Full Code Here

      List<CurrentVehicleEstimateBean> beans) {

    DoubleArrayList ps = new DoubleArrayList();
    List<ScheduledBlockLocation> blockLocations = new ArrayList<ScheduledBlockLocation>();

    Record firstRecord = records.get(0);
    ScheduledBlockLocation firstLocation = _blockGeospatialService.getBestScheduledBlockLocationForLocation(
        blockInstance, firstRecord.getLocation(), firstRecord.getTimestamp(),
        0, Double.POSITIVE_INFINITY);
    blockLocations.add(firstLocation);

    ps.add(updateScheduledBlockLocationProbability(blockInstance, firstRecord,
        firstLocation));

    Record lastRecord = records.get(records.size() - 1);
    ScheduledBlockLocation lastLocation = _blockGeospatialService.getBestScheduledBlockLocationForLocation(
        blockInstance, lastRecord.getLocation(), lastRecord.getTimestamp(), 0,
        Double.POSITIVE_INFINITY);

    ps.add(updateScheduledBlockLocationProbability(blockInstance, lastRecord,
        lastLocation));

    if (Descriptive.mean(ps) < minProbabilityForConsideration)
      return;

    /**
     * If the vehicle is traveling backwards in time, we kill the prediction
     */
    int maxTravelBackwardsTime = computeMaxTravelBackwardsTime(lastRecord.getTimestamp()
        - firstRecord.getTimestamp());

    if (lastLocation.getScheduledTime() < firstLocation.getScheduledTime()
        - maxTravelBackwardsTime)
      return;

    double minDistanceAlongBlock = Math.min(
        firstLocation.getDistanceAlongBlock(),
        lastLocation.getDistanceAlongBlock()) - 500;
    double maxDistanceAlongBlock = Math.max(
        firstLocation.getDistanceAlongBlock(),
        lastLocation.getDistanceAlongBlock()) + 500;

    for (int i = 1; i < records.size() - 1; i++) {

      Record record = records.get(i);
      ScheduledBlockLocation location = _blockGeospatialService.getBestScheduledBlockLocationForLocation(
          blockInstance, record.getLocation(), record.getTimestamp(),
          minDistanceAlongBlock, maxDistanceAlongBlock);
      blockLocations.add(location);

      ps.add(updateScheduledBlockLocationProbability(blockInstance, record,
          location));
View Full Code Here

    if (records.size() != ps.size())
      throw new IllegalStateException();

    for (int i = 1; i < records.size(); i++) {

      Record prevRecord = records.get(i - 1);
      Record nextRecord = records.get(i);
      long recordDeltaT = (nextRecord.getTimestamp() - prevRecord.getTimestamp());

      if (recordDeltaT <= 0)
        continue;

      int maxTravelBackwardsTime = computeMaxTravelBackwardsTime(recordDeltaT);
View Full Code Here

      if (location != null) {

        CoordinatePoint p = applyNoiseToLocation(location.getLocation(), noise);

        Record r = new Record();
        r.setLocation(location.getLocation());
        r.setTimestamp(tt.getTargetTime());
        r.setLocation(p);
        r.setAccuracy(noise);
        records.add(r);
      }
    }
   
    bean.setRecords(records);
View Full Code Here

      if (location != null) {

        CoordinatePoint p = applyNoiseToLocation(location.getLocation(), noise);

        Record r = new Record();
        r.setLocation(location.getLocation());
        r.setTimestamp(time - i * 1000);
        r.setLocation(p);
        r.setAccuracy(noise);
        records.add(r);
      }
    }

    bean.setRecords(records);
View Full Code Here

        long t = Long.parseLong(tokens[0]);
        double lat = Double.parseDouble(tokens[1]);
        double lon = Double.parseDouble(tokens[2]);
        double accuracy = Double.parseDouble(tokens[3]);

        Record r = new Record();
        r.setTimestamp(t);
        r.setLocation(new CoordinatePoint(lat, lon));
        r.setAccuracy(accuracy);
        records.add(r);
       
        max.add(t, r);

      } catch (NumberFormatException ex) {
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data.model.realtime.CurrentVehicleEstimateQueryBean.Record

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.