MATSIM
ChangeLegMode.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * ChangeLegMode.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2008 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 
21 package org.matsim.core.replanning.modules;
22 
28 
50 
51  // (I made the above static final variables public so they can be used in scripts-in-java. kai, jun'15)
52 
53  private String[] availableModes;
54  private boolean ignoreCarAvailability;
56 
57 
58  public ChangeLegMode(final GlobalConfigGroup globalConfigGroup, ChangeModeConfigGroup changeLegModeConfigGroup) {
59  super(globalConfigGroup.getNumberOfThreads());
60  this.availableModes = changeLegModeConfigGroup.getModes();
61  this.ignoreCarAvailability = changeLegModeConfigGroup.getIgnoreCarAvailability();
62  if (changeLegModeConfigGroup.getBehavior().equals(ChangeModeConfigGroup.Behavior.fromSpecifiedModesToSpecifiedModes)) {
63  this.allowSwitchFromListedModesOnly = true;
64  } else this.allowSwitchFromListedModesOnly=false;
65  }
66 
67  public ChangeLegMode(final int nOfThreads, final String[] modes, final boolean ignoreCarAvailabilty, boolean allowSwitchFromListedModesOnly) {
68  super(nOfThreads);
69  this.availableModes = modes.clone();
70  this.ignoreCarAvailability = ignoreCarAvailabilty;
71  this.allowSwitchFromListedModesOnly = allowSwitchFromListedModesOnly;
72  }
73 
74  @Override
77  algo.setIgnoreCarAvailability(this.ignoreCarAvailability);
78  return algo;
79  }
80 
81 }
void setIgnoreCarAvailability(final boolean ignoreCarAvailability)
ChangeLegMode(final GlobalConfigGroup globalConfigGroup, ChangeModeConfigGroup changeLegModeConfigGroup)
ChangeLegMode(final int nOfThreads, final String[] modes, final boolean ignoreCarAvailabilty, boolean allowSwitchFromListedModesOnly)