@@ -308,36 +308,36 @@ public Length distance(final Point start, final Point end) {
308
308
}
309
309
310
310
/**
311
- * Calculating the speed of point {@code p1 } with the given predecessor point
312
- * {@code p0 }. {@link Optional#empty()} is returned if the time property of
311
+ * Calculating the speed of point {@code b } with the given predecessor point
312
+ * {@code a }. {@link Optional#empty()} is returned if the time property of
313
313
* one of the given points is <em>empty</em>.
314
314
*
315
315
* @since !__version__!
316
316
*
317
- * @param p0 the start point
318
- * @param p1 the destination
317
+ * @param a the start point
318
+ * @param b the destination
319
319
* @return the calculated (average) speed between the two given points
320
320
* @throws NullPointerException if one of the points is {@code null}
321
321
*/
322
- public Optional <Speed > speed (final Point p0 , final Point p1 ) {
323
- return duration (p0 , p1 )
322
+ public Optional <Speed > speed (final Point a , final Point b ) {
323
+ return duration (a , b )
324
324
.map (sec -> Speed .of (
325
- distance (p0 , p1 ).doubleValue ()/sec ,
325
+ distance (a , b ).doubleValue ()/sec ,
326
326
Speed .Unit .METERS_PER_SECOND )
327
327
);
328
328
}
329
329
330
- private static Optional <Double > duration (final Point p0 , final Point p1 ) {
331
- return p0 .getTime ().flatMap (t0 ->
332
- p1 .getTime ().map (t1 ->
330
+ private static Optional <Double > duration (final Point a , final Point b ) {
331
+ return a .getTime ().flatMap (t0 ->
332
+ b .getTime ().map (t1 ->
333
333
minus (t0 , t1 )/1_000.0
334
334
)
335
335
);
336
336
}
337
337
338
- private static long minus (final ZonedDateTime t1 , final ZonedDateTime t2 ) {
339
- final long i1 = t1 .toInstant ().toEpochMilli ();
340
- final long i2 = t2 .toInstant ().toEpochMilli ();
338
+ private static long minus (final ZonedDateTime a , final ZonedDateTime b ) {
339
+ final long i1 = a .toInstant ().toEpochMilli ();
340
+ final long i2 = b .toInstant ().toEpochMilli ();
341
341
return i2 - i1 ;
342
342
}
343
343
0 commit comments