MATSIM
DefaultRaptorIntermodalAccessEgress.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.* *
3  *
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2023 by the members listed in the COPYING, *
8  * LICENSE and WARRANTY file. *
9  * email : info at matsim dot org *
10  * *
11  * *********************************************************************** *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * See also COPYING, LICENSE and WARRANTY file *
18  * *
19  * *********************************************************************** */
20 package ch.sbb.matsim.routing.pt.raptor;
21 
22 import java.util.List;
23 
29 
31 
39 
40  @Override
41  public RIntermodalAccessEgress calcIntermodalAccessEgress(final List<? extends PlanElement> legs, RaptorParameters params, Person person, Direction direction) {
42  double disutility = 0.0;
43  double tTime = 0.0;
44  for (PlanElement pe : legs) {
45  if (pe instanceof Leg) {
46  String mode = ((Leg) pe).getMode();
47  OptionalTime travelTime = ((Leg) pe).getTravelTime();
48  if (travelTime.isDefined()) {
49  tTime += travelTime.seconds();
50  disutility += travelTime.seconds() * -params.getMarginalUtilityOfTravelTime_utl_s(mode);
51  }
52  }
53  else if (pe instanceof Activity) {
54  if (((Activity) pe).getMaximumDuration().isDefined()) {
55  tTime += ((Activity) pe).getMaximumDuration().seconds();
56  }
57  }
58  }
59  return new RIntermodalAccessEgress(legs, disutility, tTime, direction);
60  }
61 }
RIntermodalAccessEgress calcIntermodalAccessEgress(final List<? extends PlanElement > legs, RaptorParameters params, Person person, Direction direction)