MATSIM
Public Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | Static Private Attributes | List of all members
org.matsim.pt.routes.ExperimentalTransitRoute Class Reference
Inheritance diagram for org.matsim.pt.routes.ExperimentalTransitRoute:
Inheritance graph
[legend]

Public Member Functions

 ExperimentalTransitRoute (final TransitStopFacility accessFacility, final TransitStopFacility egressFacility, final Id< TransitLine > lineId, final Id< TransitRoute > routeId)
 
 ExperimentalTransitRoute (final TransitStopFacility accessFacility, final TransitLine line, final TransitRoute route, final TransitStopFacility egressFacility)
 
ExperimentalTransitRoute clone ()
 
Id< TransitStopFacilitygetAccessStopId ()
 
Id< TransitStopFacilitygetEgressStopId ()
 
Id< TransitLinegetLineId ()
 
Id< TransitRoutegetRouteId ()
 
void setRouteDescription (final String routeDescription)
 
String getRouteDescription ()
 
String getRouteType ()
 
String toString ()
 
OptionalTime getBoardingTime ()
 
final double getDistance ()
 
final void setDistance (final double dist)
 
final OptionalTime getTravelTime ()
 
final void setTravelTime (final double travTime)
 
void setTravelTimeUndefined ()
 
final void setEndLinkId (final Id< Link > linkId)
 
final void setStartLinkId (final Id< Link > linkId)
 
final Id< LinkgetStartLinkId ()
 
final Id< LinkgetEndLinkId ()
 
final void setLocked ()
 

Static Protected Member Functions

static OptionalTime asOptionalTime (double seconds)
 

Protected Attributes

double travTime = UNDEFINED_TIME
 

Static Protected Attributes

static final double UNDEFINED_TIME = Double.NEGATIVE_INFINITY
 

Private Attributes

Id< TransitStopFacilityaccessStopId = null
 
Id< TransitStopFacilityegressStopId = null
 
Id< TransitLinelineId = null
 
Id< TransitRouterouteId = null
 
String description = null
 
String routeDescription
 

Static Private Attributes

static final String SEPARATOR = "==="
 
static final String IDENTIFIER_1 = "PT1" + SEPARATOR
 

Detailed Description

Definition at line 32 of file ExperimentalTransitRoute.java.

Constructor & Destructor Documentation

◆ ExperimentalTransitRoute() [1/2]

org.matsim.pt.routes.ExperimentalTransitRoute.ExperimentalTransitRoute ( final TransitStopFacility  accessFacility,
final TransitStopFacility  egressFacility,
final Id< TransitLine lineId,
final Id< TransitRoute routeId 
)

Definition at line 50 of file ExperimentalTransitRoute.java.

References org.matsim.api.core.v01.Identifiable< T >.getId(), org.matsim.facilities.Facility.getLinkId(), org.matsim.pt.routes.ExperimentalTransitRoute.lineId, and org.matsim.pt.routes.ExperimentalTransitRoute.routeId.

50  {
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  }
Here is the call graph for this function:

◆ ExperimentalTransitRoute() [2/2]

org.matsim.pt.routes.ExperimentalTransitRoute.ExperimentalTransitRoute ( final TransitStopFacility  accessFacility,
final TransitLine  line,
final TransitRoute  route,
final TransitStopFacility  egressFacility 
)

Why do we need this constructor, if we only keep the id of the line/route?

Definition at line 61 of file ExperimentalTransitRoute.java.

References org.matsim.api.core.v01.Identifiable< T >.getId().

61  {
62  this(accessFacility, egressFacility, (line == null ? null : line.getId()), (route == null ? null : route.getId()));
63  }
Here is the call graph for this function:

Member Function Documentation

◆ clone()

ExperimentalTransitRoute org.matsim.pt.routes.ExperimentalTransitRoute.clone ( )

make the clone method public, but do NOT extend Cloneable so that implementations can decide on their own if they support Cloneable or use some other way to make a copy..

Design comments:

  • Do we really want this? Martin ("Clean code") argues for the difference between data objects and behavioral objects. Data objects should only be accessed via the interface methods. I think that "route" is a data object. In consequence, "copy" and/or "deepCopy" should, in my view, be static methods. (The argument against this is, I guess, that one might want to add Route implementations that are not part of the standard. Yet given that we want to be able to read/write them in xml, I am not sure how far this carries.) kai, jan'13
  • In our particular situation, "clone" may be considered as a useful approach to our problem (first clone the plan or its elements, then mutate the contents). Having clone but not Cloneable in the API leaves implementing classes the choice to implement it via Cloneable or via other means. kai, dec'15

Implements org.matsim.api.core.v01.population.Route.

Definition at line 66 of file ExperimentalTransitRoute.java.

References org.matsim.pt.routes.ExperimentalTransitRoute.clone().

Referenced by org.matsim.pt.routes.ExperimentalTransitRoute.clone().

66  {
67  return (ExperimentalTransitRoute) super.clone();
68  }
Here is the call graph for this function:

◆ getAccessStopId()

Id<TransitStopFacility> org.matsim.pt.routes.ExperimentalTransitRoute.getAccessStopId ( )

◆ getEgressStopId()

Id<TransitStopFacility> org.matsim.pt.routes.ExperimentalTransitRoute.getEgressStopId ( )

◆ getLineId()

Id<TransitLine> org.matsim.pt.routes.ExperimentalTransitRoute.getLineId ( )

◆ getRouteId()

Id<TransitRoute> org.matsim.pt.routes.ExperimentalTransitRoute.getRouteId ( )

◆ setRouteDescription()

void org.matsim.pt.routes.ExperimentalTransitRoute.setRouteDescription ( final String  routeDescription)

Sets the state of the route based on it's description

Parameters
routeDescription

Implements org.matsim.api.core.v01.population.Route.

Definition at line 87 of file ExperimentalTransitRoute.java.

References org.matsim.api.core.v01.Id< T >.create(), and org.matsim.pt.routes.ExperimentalTransitRoute.routeDescription.

87  {
88 // super.setRouteDescription(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  }
Here is the call graph for this function:

◆ getRouteDescription()

String org.matsim.pt.routes.ExperimentalTransitRoute.getRouteDescription ( )
Returns
a serialization of this routes state as a String. Used to write the route to files.

Implements org.matsim.api.core.v01.population.Route.

Definition at line 109 of file ExperimentalTransitRoute.java.

References org.matsim.pt.routes.ExperimentalTransitRoute.description, and org.matsim.pt.routes.ExperimentalTransitRoute.routeDescription.

109  {
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  }

◆ getRouteType()

String org.matsim.pt.routes.ExperimentalTransitRoute.getRouteType ( )
Returns
an identifier describing the type of this route uniquely. Used when writing the route to files.

Implements org.matsim.api.core.v01.population.Route.

Definition at line 123 of file ExperimentalTransitRoute.java.

123  {
124  return ROUTE_TYPE;
125  }

◆ toString()

String org.matsim.pt.routes.ExperimentalTransitRoute.toString ( )

Definition at line 128 of file ExperimentalTransitRoute.java.

128  {
129  return "[ExpTransitRoute: access=" + this.accessStopId.toString() + " egress=" + this.egressStopId + " line="
130  + this.lineId + " route=" + this.routeId + " ]";
131  }

◆ getBoardingTime()

OptionalTime org.matsim.pt.routes.ExperimentalTransitRoute.getBoardingTime ( )

Implements org.matsim.pt.routes.TransitPassengerRoute.

Definition at line 134 of file ExperimentalTransitRoute.java.

References org.matsim.core.utils.misc.OptionalTime.undefined().

134  {
135  return OptionalTime.undefined();
136  }
Here is the call graph for this function:

◆ asOptionalTime()

static OptionalTime org.matsim.core.population.routes.AbstractRoute.asOptionalTime ( double  seconds)
staticprotectedinherited

Definition at line 54 of file AbstractRoute.java.

References org.matsim.core.utils.misc.OptionalTime.defined(), and org.matsim.core.utils.misc.OptionalTime.undefined().

Referenced by org.matsim.pt.routes.DefaultTransitPassengerRoute.getBoardingTime(), and org.matsim.core.population.routes.AbstractRoute.getTravelTime().

54  {
55  return seconds == UNDEFINED_TIME ? OptionalTime.undefined() : OptionalTime.defined(seconds);
56  }
Here is the call graph for this function:

◆ getDistance()

final double org.matsim.core.population.routes.AbstractRoute.getDistance ( )
inherited

◆ setDistance()

final void org.matsim.core.population.routes.AbstractRoute.setDistance ( final double  dist)
inherited

◆ getTravelTime()

final OptionalTime org.matsim.core.population.routes.AbstractRoute.getTravelTime ( )
inherited

◆ setTravelTime()

final void org.matsim.core.population.routes.AbstractRoute.setTravelTime ( final double  travTime)
inherited

◆ setTravelTimeUndefined()

void org.matsim.core.population.routes.AbstractRoute.setTravelTimeUndefined ( )
inherited

◆ setEndLinkId()

final void org.matsim.core.population.routes.AbstractRoute.setEndLinkId ( final Id< Link linkId)
inherited

Implements org.matsim.api.core.v01.population.Route.

Definition at line 85 of file AbstractRoute.java.

References org.matsim.core.population.routes.AbstractRoute.testForLocked().

Here is the call graph for this function:

◆ setStartLinkId()

final void org.matsim.core.population.routes.AbstractRoute.setStartLinkId ( final Id< Link linkId)
inherited

Implements org.matsim.api.core.v01.population.Route.

Definition at line 91 of file AbstractRoute.java.

References org.matsim.core.population.routes.AbstractRoute.testForLocked().

Here is the call graph for this function:

◆ getStartLinkId()

final Id<Link> org.matsim.core.population.routes.AbstractRoute.getStartLinkId ( )
inherited

◆ getEndLinkId()

final Id<Link> org.matsim.core.population.routes.AbstractRoute.getEndLinkId ( )
inherited

◆ setLocked()

final void org.matsim.core.population.routes.AbstractRoute.setLocked ( )
inherited

Definition at line 106 of file AbstractRoute.java.

106  {
107  locked = true ;
108  }

Member Data Documentation

◆ SEPARATOR

final String org.matsim.pt.routes.ExperimentalTransitRoute.SEPARATOR = "==="
staticprivate

Definition at line 34 of file ExperimentalTransitRoute.java.

◆ IDENTIFIER_1

final String org.matsim.pt.routes.ExperimentalTransitRoute.IDENTIFIER_1 = "PT1" + SEPARATOR
staticprivate

Definition at line 35 of file ExperimentalTransitRoute.java.

◆ accessStopId

Id<TransitStopFacility> org.matsim.pt.routes.ExperimentalTransitRoute.accessStopId = null
private

◆ egressStopId

Id<TransitStopFacility> org.matsim.pt.routes.ExperimentalTransitRoute.egressStopId = null
private

◆ lineId

Id<TransitLine> org.matsim.pt.routes.ExperimentalTransitRoute.lineId = null
private

◆ routeId

Id<TransitRoute> org.matsim.pt.routes.ExperimentalTransitRoute.routeId = null
private

◆ description

String org.matsim.pt.routes.ExperimentalTransitRoute.description = null
private

◆ routeDescription

String org.matsim.pt.routes.ExperimentalTransitRoute.routeDescription
private

◆ UNDEFINED_TIME

final double org.matsim.core.population.routes.AbstractRoute.UNDEFINED_TIME = Double.NEGATIVE_INFINITY
staticprotectedinherited

◆ travTime

double org.matsim.core.population.routes.AbstractRoute.travTime = UNDEFINED_TIME
protectedinherited

The documentation for this class was generated from the following file: