20 package org.matsim.core.population;
32 import com.google.inject.Inject;
39 class VspPlansCleaner
implements BeforeMobsimListener {
42 private PlansConfigGroup plansConfigGroup;
44 private Population population;
47 public void notifyBeforeMobsim(BeforeMobsimEvent event) {
48 PlansConfigGroup.ActivityDurationInterpretation actDurInterp = (plansConfigGroup.getActivityDurationInterpretation() ) ;
49 for ( Person person : population.getPersons().values() ) {
51 Plan plan = person.getSelectedPlan() ;
54 for ( PlanElement pe : plan.getPlanElements() ) {
55 if ( pe instanceof Activity ) {
56 Activity act = (Activity) pe ;
58 if ( actDurInterp == PlansConfigGroup.ActivityDurationInterpretation.minOfDurationAndEndTime ) {
63 }
else if ( actDurInterp == PlansConfigGroup.ActivityDurationInterpretation.endTimeOnly ) {
66 act.setMaximumDurationUndefined() ;
68 }
else if ( actDurInterp == PlansConfigGroup.ActivityDurationInterpretation.tryEndTimeThenDuration) {
71 if (act.getEndTime().isDefined()) {
72 act.setMaximumDurationUndefined();
76 throw new IllegalStateException(
"should not happen") ;
79 if (plansConfigGroup.isRemovingUnneccessaryPlanAttributes()) {
80 act.setStartTimeUndefined() ;
83 }
else if ( pe instanceof Leg ) {
85 if (plansConfigGroup.isRemovingUnneccessaryPlanAttributes()) {
88 if ( leg.getRoute()!=null ) {
89 leg.setTravelTimeUndefined();