private boolean checkDistanceAndTime ( double distanceMeters , double travelTimeSeconds , StopTime stopTime ) { boolean good = true ; // TODO Use Epsilon for very tiny travel e.g. < 5 meters if ( distanceMeters == 0 ) { registerError ( stopTime , TRAVEL_DISTANCE_ZERO ) ; good = false ; } if ( travelTimeSeconds < 0 ) { registerError ( stopTime , TRAVEL_TIME_NEGATIVE , travelTimeSeconds ) ; good = false ; } else if ( travelTimeSeconds == 0 ) { // Only register the travel time zero error if not all travel times are rounded. Otherwise, hold onto the // error in the travelTimeZeroErrors collection until the completion of this validator. if ( ! allTravelTimesAreRounded ) registerError ( stopTime , TRAVEL_TIME_ZERO ) ; else travelTimeZeroErrors . add ( createUnregisteredError ( stopTime , TRAVEL_TIME_ZERO ) ) ; good = false ; } return good ; }
This just pulls some of the range checking logic out of the main trip checking loop so it s more readable .