MATSIM
ExperimentalTransitRoute.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * ExperimentalTransitRoute.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2009 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.pt.routes;
22 
23 import org.matsim.api.core.v01.Id;
30 
31 @Deprecated
33 
34  private final static String SEPARATOR = "===";
35  private final static String IDENTIFIER_1 = "PT1" + SEPARATOR;
36 
37  /* package */ final static String ROUTE_TYPE = "experimentalPt1";
38 
41  private Id<TransitLine> lineId = null;
42  private Id<TransitRoute> routeId = null;
43  private String description = null;
44  private String routeDescription;
45 
46  /* package */ ExperimentalTransitRoute(final Id<Link> startLinkId, final Id<Link> endLinkId) {
47  super(startLinkId, endLinkId);
48  }
49 
50  public ExperimentalTransitRoute(final TransitStopFacility accessFacility, final TransitStopFacility egressFacility, final Id<TransitLine> lineId, final Id<TransitRoute> routeId) {
51  this(accessFacility.getLinkId(), egressFacility.getLinkId());
52  this.accessStopId = accessFacility.getId();
53  this.lineId = lineId;
54  this.routeId = routeId;
55  this.egressStopId = egressFacility.getId();
56  }
57 
61  public ExperimentalTransitRoute(final TransitStopFacility accessFacility, final TransitLine line, final TransitRoute route, final TransitStopFacility egressFacility) {
62  this(accessFacility, egressFacility, (line == null ? null : line.getId()), (route == null ? null : route.getId()));
63  }
64 
65  @Override
67  return (ExperimentalTransitRoute) super.clone();
68  }
69 
71  return this.accessStopId;
72  }
73 
75  return this.egressStopId;
76  }
77 
79  return this.lineId;
80  }
81 
83  return this.routeId;
84  }
85 
86  @Override
87  public void setRouteDescription(final String routeDescription) {
88 // super.setRouteDescription(routeDescription);
89  this.routeDescription = routeDescription;
90  if (routeDescription.startsWith(IDENTIFIER_1)) {
91  String[] parts = routeDescription.split(SEPARATOR, 6);// StringUtils.explode(routeDescription, '\t', 6);
92  this.accessStopId = Id.create(parts[1], TransitStopFacility.class);
93  this.lineId = Id.create(parts[2], TransitLine.class);
94  this.routeId = Id.create(parts[3], TransitRoute.class);
95  this.egressStopId = Id.create(parts[4], TransitStopFacility.class);
96  if (parts.length > 5) {
97  this.description = parts[5];
98  } else {
99  this.description = null;
100  }
101  } else {
102  this.accessStopId = null;
103  this.lineId = null;
104  this.egressStopId = null;
105  }
106  }
107 
108  @Override
109  public String getRouteDescription() {
110  if (this.accessStopId == null) {
111 // return super.getRouteDescription();
112  return this.routeDescription;
113  }
114  String str = IDENTIFIER_1 + this.accessStopId.toString() + SEPARATOR + this.lineId.toString() + SEPARATOR
115  + this.routeId.toString() + SEPARATOR + this.egressStopId.toString();
116  if (this.description != null) {
117  str = str + SEPARATOR + this.description;
118  }
119  return str;
120  }
121 
122  @Override
123  public String getRouteType() {
124  return ROUTE_TYPE;
125  }
126 
127  @Override
128  public String toString() {
129  return "[ExpTransitRoute: access=" + this.accessStopId.toString() + " egress=" + this.egressStopId + " line="
130  + this.lineId + " route=" + this.routeId + " ]";
131  }
132 
133  @Override
135  return OptionalTime.undefined();
136  }
137 }
ExperimentalTransitRoute(final TransitStopFacility accessFacility, final TransitStopFacility egressFacility, final Id< TransitLine > lineId, final Id< TransitRoute > routeId)
void setRouteDescription(final String routeDescription)
static< T > Id< T > create(final long key, final Class< T > type)
Definition: Id.java:68
ExperimentalTransitRoute(final TransitStopFacility accessFacility, final TransitLine line, final TransitRoute route, final TransitStopFacility egressFacility)