File tree Expand file tree Collapse file tree
core/src/main/java/org/eqasim/core/analysis/trips Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package org .eqasim .core .analysis .trips ;
22
3- import java .util .Collection ;
4- import java .util .LinkedList ;
5- import java .util .List ;
6- import java .util .Optional ;
3+ import java .util .*;
74
85import org .eqasim .core .analysis .PersonAnalysisFilter ;
96import org .matsim .api .core .v01 .Coord ;
@@ -100,7 +97,15 @@ public Collection<TripItem> readTrips(Population population) {
10097 double departureTime = originEndTime .orElse (Double .NaN );
10198 double duration = Double .NaN ;
10299
103- if (originEndTime .isDefined () && destinationStartTime .isDefined ()) {
100+ DoubleSummaryStatistics legTravelTimesStats = trip .getLegsOnly ().stream ()
101+ .map (Leg ::getTravelTime )
102+ .filter (OptionalTime ::isDefined )
103+ .mapToDouble (OptionalTime ::seconds )
104+ .summaryStatistics ();
105+
106+ if (legTravelTimesStats .getCount () > 0 ) {
107+ duration = legTravelTimesStats .getSum ();
108+ } else if (originEndTime .isDefined () && destinationStartTime .isDefined ()) {
104109 duration = destinationStartTime .seconds () - originEndTime .seconds ();
105110 }
106111
You can’t perform that action at this time.
0 commit comments