Skip to content

Commit

Permalink
perform trivial interpolation before stoptime filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
abyrd committed Mar 30, 2012
1 parent a3f2454 commit aeab973
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -481,13 +481,22 @@ private void filterStopTimes(List<StopTime> stopTimes, Graph graph) {
if (stopTimes.size() < 2)
return;
StopTime st0 = stopTimes.get(0);
if (!st0.isDepartureTimeSet() && st0.isArrivalTimeSet()) {
/* set depature time if it is missing */
st0.setDepartureTime(st0.getArrivalTime());
}
for (int i = 1; i < stopTimes.size(); i++) {
boolean st1bogus = false;
StopTime st1 = stopTimes.get(i);
// do not process non-timepoint stoptimes:
// they will be identical to other adjacent non-timepoint stoptimes
if ( ! (st1.isArrivalTimeSet() && st1.isDepartureTimeSet()))
if (!st1.isDepartureTimeSet() && st1.isArrivalTimeSet()) {
/* set depature time if it is missing */
st1.setDepartureTime(st1.getArrivalTime());
}
/* do not process non-timepoint stoptimes,
* which are of course identical to other adjacent non-timepoint stoptimes */
if ( ! (st1.isArrivalTimeSet() && st1.isDepartureTimeSet())) {
continue;
}
int runningTime = st1.getArrivalTime() - st0.getDepartureTime();
double hopDistance = DistanceLibrary.fastDistance(
st0.getStop().getLon(), st0.getStop().getLat(),
Expand Down Expand Up @@ -681,14 +690,6 @@ private void interpolateStopTimes(List<StopTime> stopTimes) {
departureTime = st0.getDepartureTime();

/* Interpolate, if necessary, the times of non-timepoint stops */

/* trivial cases */
if (!st0.isDepartureTimeSet() && st0.isArrivalTimeSet()) {
st0.setDepartureTime(st0.getArrivalTime());
}
if (!st1.isDepartureTimeSet() && st1.isArrivalTimeSet()) {
st1.setDepartureTime(st1.getArrivalTime());
}
/* genuine interpolation needed */
if (!(st0.isDepartureTimeSet() && st0.isArrivalTimeSet())) {
// figure out how many such stops there are in a row.
Expand Down

0 comments on commit aeab973

Please sign in to comment.