mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-15 17:10:30 +00:00
Implement methods for duration of a trip.
This commit is contained in:
parent
d00e107fdf
commit
e86fdede13
1 changed files with 19 additions and 0 deletions
|
@ -113,6 +113,25 @@ public final class Trip implements Serializable
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Duration of whole trip in milliseconds, including leading and trailing individual legs. */
|
||||||
|
public long getDuration()
|
||||||
|
{
|
||||||
|
final Date first = getFirstDepartureTime();
|
||||||
|
final Date last = getLastArrivalTime();
|
||||||
|
return last.getTime() - first.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Duration of the public leg part in milliseconds. This includes individual legs between public legs, but excludes
|
||||||
|
* individual legs that lead or trail the trip.
|
||||||
|
*/
|
||||||
|
public long getPublicDuration()
|
||||||
|
{
|
||||||
|
final Date first = getFirstPublicLegDepartureTime();
|
||||||
|
final Date last = getLastPublicLegArrivalTime();
|
||||||
|
return last.getTime() - first.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
/** Minimum time occuring in this trip. */
|
/** Minimum time occuring in this trip. */
|
||||||
public Date getMinTime()
|
public Date getMinTime()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue