Add weoght parameter in TripStatisticsUpdater.addLocation() method.

This commit is contained in:
youtaol
2013-09-02 19:31:53 +08:00
parent c42abaac6b
commit ad03336916
7 changed files with 36 additions and 20 deletions
@@ -223,8 +223,9 @@ public class TripStatisticsUpdaterTest extends TestCase {
// Each time slice is 10 seconds.
Location location = getLocation(i + locationOffset, (i + locationOffset) * .001, MOVING_SPEED,
startTime + (timeOffset + i) * TEN_SECONDS);
tripStatisticsUpdater.addLocation(
location, PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT);
tripStatisticsUpdater.addLocation(location,
PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT,
PreferencesUtils.STATS_WEIGHT_DEFAULT);
tripStatistics = tripStatisticsUpdater.getTripStatistics();
assertEquals((timeOffset + i) * TEN_SECONDS, tripStatistics.getTotalTime());
@@ -269,8 +270,9 @@ public class TripStatisticsUpdaterTest extends TestCase {
for (int i = 0; i < points; i++) {
Location location = getLocation(
locationOffset, locationOffset * .001, 0, startTime + (i + timeOffset) * TEN_SECONDS);
tripStatisticsUpdater.addLocation(
location, PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT);
tripStatisticsUpdater.addLocation(location,
PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT,
PreferencesUtils.STATS_WEIGHT_DEFAULT);
tripStatistics = tripStatisticsUpdater.getTripStatistics();
assertEquals((i + timeOffset) * TEN_SECONDS, tripStatistics.getTotalTime());
@@ -306,8 +308,9 @@ public class TripStatisticsUpdaterTest extends TestCase {
// 99999 means a speed should bigger than given speed.
Location location = getLocation(i + locationOffset, (i + locationOffset) * .001, 99999,
startTime + (timeOffset + i) * TEN_SECONDS);
tripStatisticsUpdater.addLocation(
location, PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT);
tripStatisticsUpdater.addLocation(location,
PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT,
PreferencesUtils.STATS_WEIGHT_DEFAULT);
tripStatistics = tripStatisticsUpdater.getTripStatistics();
assertTrue(tripStatistics.getMovingTime() <= tripStatistics.getTotalTime());