MATSIM
ModeAndRouteConsistencyChecker.java
Go to the documentation of this file.
1 
2 /* *********************************************************************** *
3  * project: org.matsim.*
4  * ModeAndRouteConsistencyChecker.java
5  * *
6  * *********************************************************************** *
7  * *
8  * copyright : (C) 2019 by the members listed in the COPYING, *
9  * LICENSE and WARRANTY file. *
10  * email : info at matsim dot org *
11  * *
12  * *********************************************************************** *
13  * *
14  * This program is free software; you can redistribute it and/or modify *
15  * it under the terms of the GNU General Public License as published by *
16  * the Free Software Foundation; either version 2 of the License, or *
17  * (at your option) any later version. *
18  * See also COPYING, LICENSE and WARRANTY file *
19  * *
20  * *********************************************************************** */
21 
22  package org.matsim.core.replanning.modules;
23 
24 import org.apache.logging.log4j.LogManager;
32 
34  @Override public void prepareReplanning(ReplanningContext replanningContext) { }
35 
36  @Override public void handlePlan(Plan plan) {
37  for (Leg leg : TripStructureUtils.getLegs(plan)) {
38  if (leg.getRoute() instanceof NetworkRoute) {
39  switch ( leg.getMode() ) {
40  case TransportMode.car:
41  case TransportMode.bike:
42  case TransportMode.walk:
43  break;
44  default:
45  LogManager.getLogger(this.getClass()).warn( "route is of type=" + leg.getRoute().getClass() ) ;
46  LogManager.getLogger(this.getClass()).warn( "mode=" + leg.getMode() ) ;
47  throw new RuntimeException("inconsistent");
48  }
49  }
50  }
51  }
52 
53  @Override public void finishReplanning() { }
54 }
static List< Leg > getLegs(final Plan plan)