MATSIM
PlansConfigGroup.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * PlansConfigGroup.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2007 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.config.groups;
22 
23 import org.apache.logging.log4j.LogManager;
28 
29 import java.net.URL;
30 import java.util.Map;
31 
32 public final class PlansConfigGroup extends ReflectiveConfigGroup {
33 
34  public static final String GROUP_NAME = "plans";
35 
36  public abstract static class NetworkRouteType {
37  public static final String LinkNetworkRoute = "LinkNetworkRoute";
38  @Deprecated public static final String CompressedNetworkRoute = "CompressedNetworkRoute";
39  public static final String MediumCompressedNetworkRoute = "MediumCompressedNetworkRoute";
40  public static final String HeavyCompressedNetworkRoute = "HeavyCompressedNetworkRoute";
41  }
42 
43  public enum ActivityDurationInterpretation { minOfDurationAndEndTime, tryEndTimeThenDuration, @Deprecated endTimeOnly }
44 
48  public enum TripDurationHandling {
50  ignoreDelays
51  ,
53  shiftActivityEndTimes
54  }
55 
56  private static final String INPUT_FILE = "inputPlansFile";
57  private static final String INPUT_PERSON_ATTRIBUTES_FILE = "inputPersonAttributesFile";
58  private static final String NETWORK_ROUTE_TYPE = "networkRouteType";
59 // private static final String SUBPOPULATION_ATTRIBUTE = "subpopulationAttributeName";
60  private static final String INPUT_CRS = "inputCRS";
61 
62  private String inputFile = null;
64  private String inputPersonAttributeFile = null;
65 // private String subpopulationAttributeName = "subpopulation";
66  private String inputCRS = null;
67 
68  //--
69 
70  private static final String ACTIVITY_DURATION_INTERPRETATION="activityDurationInterpretation" ;
71  private static final String TRIP_DURATION_HANDLING="tripDurationHandling";
72 
75 
76  //--
77 
78  public PlansConfigGroup() {
79  super(GROUP_NAME);
80  }
81 
82  @Override
83  public Map<String, String> getComments() {
84  Map<String, String> comments = super.getComments();
85  comments.put(
86  NETWORK_ROUTE_TYPE,
87  "Defines how routes are stored in memory. Currently supported: " +
91 // comments.put(
92 // INPUT_PERSON_ATTRIBUTES_FILE,
93 // "Path to a file containing person attributes (required file format: ObjectAttributes).");
94 // comments.put(
95 // SUBPOPULATION_ATTRIBUTE,
96 // "Name of the (Object)Attribute defining the subpopulation to which pertains a Person"+
97 // " (as freight, through traffic, etc.). The attribute must be of String type. Change away from default only in desperate situations." );
98 
99  StringBuilder str = new StringBuilder() ;
101  str.append(" ").append(itp.toString());
102  }
103  comments.put(ACTIVITY_DURATION_INTERPRETATION, "String:" + str + ". Anything besides "
104  + PlansConfigGroup.ActivityDurationInterpretation.minOfDurationAndEndTime + " will internally use a different " +
105  "(simpler) version of the TimeAllocationMutator.") ;
106  comments.put(TRIP_DURATION_HANDLING, "Defines how departure times are interpreted in rerouting applications. If set to '" + TripDurationHandling.ignoreDelays + "', " +
107  "the departure time of a trip when routing along a plan will always be the nominal (plan-based) activity end time. If set to '" + TripDurationHandling.shiftActivityEndTimes + "', " +
108  "routing along a plan will accumulate travel times and shift activity end times if necessary");
109 
110  comments.put(REMOVING_UNNECESSARY_PLAN_ATTRIBUTES, "(not tested) will remove plan attributes that are presumably not used, such as " +
111  "activityStartTime. default=false. Use with Caution!");
112 
113  comments.put( INPUT_CRS , "The Coordinates Reference System in which the coordinates are expressed in the input file." +
114  " At import, the coordinates will be converted to the coordinate system defined in \"global\", and will" +
115  "be converted back at export. If not specified, no conversion happens." );
116 
117  return comments;
118  }
119 
120  @StringGetter( INPUT_FILE )
121  public String getInputFile() {
122  return this.inputFile;
123  }
124 
126  public void setInputFile(final String inputFile) {
127  this.inputFile = inputFile;
128  }
129 
130  public URL getInputFileURL(URL context) {
131  return ConfigGroup.getInputFileURL(context, this.inputFile);
132  }
133  // ---
135  private static final String INSISTING_ON_USING_DEPRECATED_PERSON_ATTRIBUTE_FILE = "insistingOnUsingDeprecatedPersonAttributeFile" ;
137  public final void setInsistingOnUsingDeprecatedPersonAttributeFile( boolean val ) {
139  }
143  }
144 
145  public static enum HandlingOfPlansWithoutRoutingMode { reject, useMainModeIdentifier }
147  private static final String HANDLING_OF_PLANS_WITHOUT_ROUTING_MODE = "handlingOfPlansWithoutRoutingMode" ;
150  this.handlingOfPlansWithoutRoutingMode = val ;
151  }
155  }
156 
158  @Deprecated // this should be phased out; use Attributes inside each person. kai, mar'19
159  public String getInputPersonAttributeFile() {
160  return this.inputPersonAttributeFile;
161  }
162  public static final String PERSON_ATTRIBUTES_DEPRECATION_MESSAGE = "using the separate person attribute file is deprecated. Add the information directly into each person, using " +
163  "the Attributable feature. If you insist on continuing to use the separate person attribute file, set " +
164  "insistingOnUsingDeprecatedPersonAttributeFile to true. The file will then be read, but the values " +
165  "will be entered into each person using Attributable, and written as such to output_plans. kai, may'19";
167  @Deprecated // this should be phased out; use Attributes inside each person. kai, mar'19
169  this.inputPersonAttributeFile = inputPersonAttributeFile;
170  }
171 
172  @Deprecated // this should be phased out; use Attributes inside each person. kai, mar'19
173  public URL getInputPersonAttributeFileURL(URL context) {
175  }
176  // ---
178  public String getNetworkRouteType() {
179  return this.networkRouteType;
180  }
181 
183  public void setNetworkRouteType(final String routeType) {
184  this.networkRouteType = routeType;
185  }
186  // ---
187 // /**
188 // * @deprecated -- use {@link org.matsim.core.population.PopulationUtils#getSubpopulation(Person, Config)}
189 // */
190 // @Deprecated
191 // @StringGetter( SUBPOPULATION_ATTRIBUTE )
192 // public String getSubpopulationAttributeName() {
193 // return subpopulationAttributeName;
194 // }
195 // /**
196 // * @deprecated -- do not set away from default
197 // */
198 // @Deprecated
199 // @StringSetter( SUBPOPULATION_ATTRIBUTE )
200 // public void setSubpopulationAttributeName(String subpopulationAttributeName) {
201 // this.subpopulationAttributeName = subpopulationAttributeName;
202 // }
203  // ---
206  return this.activityDurationInterpretation ;
207  }
208 // public void setActivityDurationInterpretation(final String str) {
209 // ActivityDurationInterpretation actDurInterpret = ActivityDurationInterpretation.valueOf(str) ;
210 // this.setActivityDurationInterpretation(actDurInterpret);
211 // }
214  if ( PlansConfigGroup.ActivityDurationInterpretation.endTimeOnly.equals(actDurInterpret) ){
215  /*
216  * I don't think this is the correct place for consistency checks but this bug is so hard to find that the user should be warned in any case. dg 08-2012
217  */
218  LogManager.getLogger(this.getClass()).warn("You are using " + actDurInterpret + " as activityDurationInterpretation. " +
219  "This is not working in conjunction with the pt module as pt interaction activities then will never end!");
220  LogManager.getLogger(this.getClass()).warn("ActivityDurationInterpreation " + actDurInterpret + " is deprecated; use "
222  }
223  this.activityDurationInterpretation = actDurInterpret;
224  }
225 
228  return this.tripDurationHandling ;
229  }
230 
233  this.tripDurationHandling = value;
234  }
235 
236  // ---
237 
238  private static final String REMOVING_UNNECESSARY_PLAN_ATTRIBUTES = "removingUnnecessaryPlanAttributes";
239  private boolean removingUnneccessaryPlanAttributes = false;
243  }
247  }
248 
249 
251  public String getInputCRS() {
252  return inputCRS;
253  }
254 
256  public void setInputCRS(String inputCRS) {
257  this.inputCRS = inputCRS;
258  }
259 
263  @Deprecated
266  }
267 
268 
269 }
static final String INSISTING_ON_USING_DEPRECATED_PERSON_ATTRIBUTE_FILE
void setRemovingUnneccessaryPlanAttributes(final boolean removingUnneccessaryPlanAttributes)
PlansConfigGroup.TripDurationHandling getTripDurationHandling()
final void setInsistingOnUsingDeprecatedPersonAttributeFile(boolean val)
void setTripDurationHandling(final PlansConfigGroup.TripDurationHandling value)
void setActivityDurationInterpretation(final PlansConfigGroup.ActivityDurationInterpretation actDurInterpret)
static URL getInputFileURL(URL context, String filename)
final HandlingOfPlansWithoutRoutingMode getHandlingOfPlansWithoutRoutingMode()
final void setHandlingOfPlansWithoutRoutingMode(HandlingOfPlansWithoutRoutingMode val)
void setInputPersonAttributeFile(final String inputPersonAttributeFile)
HandlingOfPlansWithoutRoutingMode handlingOfPlansWithoutRoutingMode
ActivityDurationInterpretation activityDurationInterpretation
PlansConfigGroup.ActivityDurationInterpretation getActivityDurationInterpretation()