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

Classes

class  StringCache
 
class  TempRoute
 
class  TempTransitRoute
 

Public Member Functions

 TransitScheduleReaderV1 (final TransitSchedule schedule, final RouteFactories routeFactory)
 
 TransitScheduleReaderV1 (final Scenario scenario)
 
 TransitScheduleReaderV1 (final CoordinateTransformation coordinateTransformation, final Scenario scenario)
 
 TransitScheduleReaderV1 (CoordinateTransformation coordinateTransformation, TransitSchedule schedule, RouteFactories routeFactory)
 
void startTag (final String name, final Attributes atts, final Stack< String > context)
 
void endTag (final String name, final String content, final Stack< String > context)
 
abstract void startTag (String name, Attributes atts, Stack< String > context)
 
final void setValidating (final boolean validateXml)
 
final void setNamespaceAware (final boolean awareness)
 
final void setLocalDtdDirectory (final String localDtdDirectory)
 
final void readFile (final String filename) throws UncheckedIOException
 
final void readURL (final URL url) throws UncheckedIOException
 
final void readStream (InputStream stream) throws UncheckedIOException
 
final void parse (final URL url) throws UncheckedIOException
 
final void parse (final InputStream stream) throws UncheckedIOException
 
final void parse (final InputSource input) throws UncheckedIOException
 
final String getDoctype ()
 
final InputSource resolveEntity (final String publicId, final String systemId)
 
void characters (final char[] ch, final int start, final int length) throws SAXException
 
final void startElement (final String uri, final String localName, final String qName, Attributes atts)
 
final void endElement (final String uri, final String localName, final String qName) throws SAXException
 
final void error (final SAXParseException ex) throws SAXException
 
final void fatalError (final SAXParseException ex) throws SAXException
 
final void warning (final SAXParseException ex) throws SAXException
 

Static Public Member Functions

static double parseDouble (String value) throws NumberFormatException
 

Protected Member Functions

void setDoctype (final String doctype)
 

Private Attributes

final TransitSchedule schedule
 
final RouteFactories routeFactory
 
TransitLine currentTransitLine = null
 
TempTransitRoute currentTransitRoute = null
 
TempRoute currentRouteProfile = null
 
final CoordinateTransformation coordinateTransformation
 
final StringCache cache = new StringCache()
 

Detailed Description

Reads a transit schedule from a XML file in the format described by transitSchedule_v1.dtd.

Author
mrieser

Definition at line 54 of file TransitScheduleReaderV1.java.

Constructor & Destructor Documentation

◆ TransitScheduleReaderV1() [1/4]

org.matsim.pt.transitSchedule.TransitScheduleReaderV1.TransitScheduleReaderV1 ( final TransitSchedule  schedule,
final RouteFactories  routeFactory 
)

◆ TransitScheduleReaderV1() [2/4]

org.matsim.pt.transitSchedule.TransitScheduleReaderV1.TransitScheduleReaderV1 ( final Scenario  scenario)

Definition at line 70 of file TransitScheduleReaderV1.java.

References org.matsim.api.core.v01.population.Population.getFactory(), org.matsim.api.core.v01.Scenario.getPopulation(), org.matsim.api.core.v01.population.PopulationFactory.getRouteFactories(), and org.matsim.api.core.v01.Scenario.getTransitSchedule().

70  {
71  this( scenario.getTransitSchedule(),
72  scenario.getPopulation().getFactory().getRouteFactories() );
73  }
Here is the call graph for this function:

◆ TransitScheduleReaderV1() [3/4]

org.matsim.pt.transitSchedule.TransitScheduleReaderV1.TransitScheduleReaderV1 ( final CoordinateTransformation  coordinateTransformation,
final Scenario  scenario 
)

◆ TransitScheduleReaderV1() [4/4]

org.matsim.pt.transitSchedule.TransitScheduleReaderV1.TransitScheduleReaderV1 ( CoordinateTransformation  coordinateTransformation,
TransitSchedule  schedule,
RouteFactories  routeFactory 
)

Member Function Documentation

◆ startTag() [1/2]

void org.matsim.pt.transitSchedule.TransitScheduleReaderV1.startTag ( final String  name,
final Attributes  atts,
final Stack< String >  context 
)

Definition at line 94 of file TransitScheduleReaderV1.java.

References org.matsim.pt.transitSchedule.TransitScheduleReaderV1.TempRoute.addLink(), org.matsim.pt.transitSchedule.api.TransitSchedule.addStopFacility(), org.matsim.pt.transitSchedule.api.TransitSchedule.addTransitLine(), org.matsim.api.core.v01.Id< T >.create(), org.matsim.pt.transitSchedule.api.TransitScheduleFactory.createTransitLine(), org.matsim.pt.transitSchedule.api.TransitScheduleFactory.createTransitStopFacility(), org.matsim.pt.transitSchedule.TransitScheduleReaderV1.TempTransitRoute.departures, org.matsim.pt.transitSchedule.TransitScheduleReaderV1.StringCache.get(), org.matsim.pt.transitSchedule.api.TransitSchedule.getFacilities(), org.matsim.pt.transitSchedule.api.TransitSchedule.getFactory(), org.matsim.core.utils.misc.Time.parseTime(), org.matsim.pt.transitSchedule.api.TransitStopFacility.setLinkId(), org.matsim.pt.transitSchedule.api.TransitStopFacility.setName(), org.matsim.pt.transitSchedule.api.TransitLine.setName(), org.matsim.pt.transitSchedule.api.Departure.setVehicleId(), and org.matsim.core.utils.geometry.CoordinateTransformation.transform().

94  {
95  if (Constants.STOP_FACILITY.equals(name)) {
96  boolean isBlocking = Boolean.parseBoolean(atts.getValue(Constants.IS_BLOCKING));
97  TransitStopFacility stop =
99  Id.create(
100  atts.getValue(Constants.ID),
101  TransitStopFacility.class),
103  new Coord(
104  Double.parseDouble(atts.getValue("x")),
105  Double.parseDouble(atts.getValue("y")))),
106  isBlocking);
107  if (atts.getValue(Constants.LINK_REF_ID) != null) {
108  Id<Link> linkId = Id.create(atts.getValue(Constants.LINK_REF_ID), Link.class);
109  stop.setLinkId(linkId);
110  }
111  if (atts.getValue(Constants.NAME) != null) {
112  stop.setName(this.cache.get(atts.getValue(Constants.NAME)));
113  }
114  this.schedule.addStopFacility(stop);
115  } else if (Constants.TRANSIT_LINE.equals(name)) {
116  Id<TransitLine> id = Id.create(atts.getValue(Constants.ID), TransitLine.class);
118  if (atts.getValue(Constants.NAME) != null) {
119  this.currentTransitLine.setName(atts.getValue(Constants.NAME));
120  }
122  } else if (Constants.TRANSIT_ROUTE.equals(name)) {
123  Id<TransitRoute> id = Id.create(atts.getValue(Constants.ID), TransitRoute.class);
124  this.currentTransitRoute = new TempTransitRoute(id);
125  } else if (Constants.DEPARTURE.equals(name)) {
126  Id<Departure> id = Id.create(atts.getValue(Constants.ID), Departure.class);
127  Departure departure = new DepartureImpl(id, Time.parseTime(atts.getValue("departureTime")));
128  String vehicleRefId = atts.getValue(Constants.VEHICLE_REF_ID);
129  if (vehicleRefId != null) {
130  departure.setVehicleId(Id.create(vehicleRefId, Vehicle.class));
131  }
132  this.currentTransitRoute.departures.put(id, departure);
133  } else if (Constants.ROUTE_PROFILE.equals(name)) {
134  this.currentRouteProfile = new TempRoute();
135  } else if (Constants.LINK.equals(name)) {
136  String linkStr = atts.getValue(Constants.REF_ID);
137  if (!linkStr.contains(" ")) {
138  this.currentRouteProfile.addLink(Id.create(linkStr, Link.class));
139  } else {
140  String[] links = linkStr.split(" ");
141  for (int i = 0; i < links.length; i++) {
142  this.currentRouteProfile.addLink(Id.create(links[i], Link.class));
143  }
144  }
145  } else if (Constants.STOP.equals(name)) {
146  Id<TransitStopFacility> id = Id.create(atts.getValue(Constants.REF_ID), TransitStopFacility.class);
147  TransitStopFacility facility = this.schedule.getFacilities().get(id);
148  if (facility == null) {
149  throw new RuntimeException("no stop/facility with id " + atts.getValue(Constants.REF_ID));
150  }
151  TransitRouteStopImpl.Builder stopBuilder = new TransitRouteStopImpl.Builder().stop(facility);
152  String arrival = atts.getValue(Constants.ARRIVAL_OFFSET);
153  String departure = atts.getValue(Constants.DEPARTURE_OFFSET);
154  if (arrival != null) {
155  Time.parseOptionalTime(arrival).ifDefined(stopBuilder::arrivalOffset);
156  }
157  if (departure != null) {
158  Time.parseOptionalTime(departure).ifDefined(stopBuilder::departureOffset);
159  }
160  stopBuilder.awaitDepartureTime(Boolean.parseBoolean(atts.getValue(Constants.AWAIT_DEPARTURE)));
161  this.currentTransitRoute.stopBuilders.add(stopBuilder);
162  }
163  }
Map< Id< TransitStopFacility >, TransitStopFacility > getFacilities()
void addTransitLine(final TransitLine line)
abstract TransitLine createTransitLine(final Id< TransitLine > lineId)
abstract TransitStopFacility createTransitStopFacility(final Id< TransitStopFacility > facilityId, final Coord coordinate, final boolean blocksLane)
void addStopFacility(final TransitStopFacility stop)
Here is the call graph for this function:

◆ endTag()

void org.matsim.pt.transitSchedule.TransitScheduleReaderV1.endTag ( final String  name,
final String  content,
final Stack< String >  context 
)

Definition at line 166 of file TransitScheduleReaderV1.java.

References org.matsim.pt.transitSchedule.api.TransitRoute.addDeparture(), org.matsim.pt.transitSchedule.api.TransitLine.addRoute(), org.matsim.pt.transitSchedule.api.TransitScheduleFactory.createTransitRoute(), org.matsim.pt.transitSchedule.TransitScheduleReaderV1.TempTransitRoute.departures, org.matsim.pt.transitSchedule.TransitScheduleReaderV1.TempTransitRoute.description, org.matsim.pt.transitSchedule.api.TransitSchedule.getFactory(), org.matsim.pt.transitSchedule.TransitScheduleReaderV1.TempTransitRoute.id, org.matsim.pt.transitSchedule.api.TransitRoute.setDescription(), and org.matsim.core.population.routes.NetworkRoute.setLinkIds().

166  {
167  if (Constants.DESCRIPTION.equals(name) && Constants.TRANSIT_ROUTE.equals(context.peek())) {
168  this.currentTransitRoute.description = content;
169  } else if (Constants.TRANSPORT_MODE.equals(name)) {
170  this.currentTransitRoute.mode = content.intern();
171  } else if (Constants.TRANSIT_ROUTE.equals(name)) {
172  List<TransitRouteStop> stops = new ArrayList<>(this.currentTransitRoute.stopBuilders.size());
173  this.currentTransitRoute.stopBuilders.forEach(stopBuilder -> stops.add(stopBuilder.build()));
174  NetworkRoute route = null;
175  if (this.currentRouteProfile.firstLinkId != null) {
176  if (this.currentRouteProfile.lastLinkId == null) {
177  this.currentRouteProfile.lastLinkId = this.currentRouteProfile.firstLinkId;
178  }
179  route = this.routeFactory.createRoute(NetworkRoute.class, this.currentRouteProfile.firstLinkId, this.currentRouteProfile.lastLinkId);
180  route.setLinkIds(this.currentRouteProfile.firstLinkId, this.currentRouteProfile.linkIds, this.currentRouteProfile.lastLinkId);
181  }
182  TransitRoute transitRoute = this.schedule.getFactory().createTransitRoute(this.currentTransitRoute.id, route, stops, this.currentTransitRoute.mode);
184  for (Departure departure : this.currentTransitRoute.departures.values()) {
185  transitRoute.addDeparture(departure);
186  }
187  this.currentTransitLine.addRoute(transitRoute);
188  }
189  }
void addRoute(final TransitRoute transitRoute)
void setDescription(final String description)
abstract TransitRoute createTransitRoute(final Id< TransitRoute > routeId, final NetworkRoute route, final List< TransitRouteStop > stops, final String mode)
Here is the call graph for this function:

◆ startTag() [2/2]

abstract void org.matsim.core.utils.io.MatsimXmlParser.startTag ( String  name,
Attributes  atts,
Stack< String >  context 
)
abstractinherited

◆ setValidating()

final void org.matsim.core.utils.io.MatsimXmlParser.setValidating ( final boolean  validateXml)
inherited

Sets, if this parser should validate the read XML or not. Not validating is sometimes useful during development or during some tests with format-extensions that are not yet part of the DTD, but it is strongly discouraged not to validate during production use.

Parameters
validateXmlWhether the parsed XML should be validated or not.

Definition at line 117 of file MatsimXmlParser.java.

Referenced by org.matsim.core.events.EventsConverterXML.EventsConverterXML(), and org.matsim.core.events.EventsReaderXMLv1.EventsReaderXMLv1().

117  {
118  this.isValidating = validateXml;
119  }

◆ setNamespaceAware()

final void org.matsim.core.utils.io.MatsimXmlParser.setNamespaceAware ( final boolean  awareness)
inherited

Specifies that the parser produced by this code will provide support for XML namespaces. By default the value of this is set to false.

Parameters
awarenesstrue if the parser produced by this code will provide support for XML namespaces; false otherwise.
See also
javax.xml.parsers.SAXParserFactory::setNamespaceAware(boolean)

Definition at line 128 of file MatsimXmlParser.java.

128  {
129  this.isNamespaceAware = awareness;
130  }

◆ setLocalDtdDirectory()

final void org.matsim.core.utils.io.MatsimXmlParser.setLocalDtdDirectory ( final String  localDtdDirectory)
inherited

Sets the directory where to look for DTD and XSD files if they are not found at the location specified in the XML.

Parameters
localDtdDirectory

Definition at line 138 of file MatsimXmlParser.java.

138  {
139  this.localDtdBase = localDtdDirectory;
140  }

◆ readFile()

final void org.matsim.core.utils.io.MatsimXmlParser.readFile ( final String  filename) throws UncheckedIOException
inherited

Parses the specified file. The file can be gzip-compressed and is decompressed on-the-fly while parsing. A gzip-compressed file must have the ending ".gz" to be correctly recognized. The passed filename may or may not contain the ending ".gz". If no uncompressed file is found with the specified name, the ending ".gz" will be added to the filename and a compressed file will be searched for and read if found.

Parameters
filenameThe filename of the file to read, optionally ending with ".gz" to force reading a gzip-compressed file.
Exceptions
UncheckedIOException

Implements org.matsim.core.api.internal.MatsimReader.

Definition at line 152 of file MatsimXmlParser.java.

References org.matsim.core.utils.io.IOUtils.getBufferedReader(), and org.matsim.core.utils.io.MatsimXmlParser.parse().

Referenced by org.matsim.utils.gis.matsim2esri.plans.SelectedPlans2ESRIShape.main(), org.matsim.core.utils.io.OsmNetworkReader.parse(), org.matsim.vehicles.MatsimVehicleReader.readFile(), org.matsim.pt.transitSchedule.api.TransitScheduleReader.readFile(), org.matsim.core.events.MatsimEventsReader.readFile(), org.matsim.core.population.io.StreamingPopulationReader.readFile(), org.matsim.core.network.NetworkUtils.readNetwork(), org.matsim.core.population.PopulationUtils.readPopulation(), org.matsim.core.network.algorithms.intersectionSimplifier.RunIntersectionSimplifier.run(), and org.matsim.run.gui.ScheduleValidatorWindow.run().

152  {
153  log.info("starting to parse xml from file " + filename + " ...");
154  this.theSource = filename;
155  parse(new InputSource(IOUtils.getBufferedReader(filename)));
156  }
Here is the call graph for this function:

◆ readURL()

final void org.matsim.core.utils.io.MatsimXmlParser.readURL ( final URL  url) throws UncheckedIOException
inherited

Implements org.matsim.core.api.internal.MatsimReader.

Definition at line 159 of file MatsimXmlParser.java.

References org.matsim.core.utils.io.MatsimXmlParser.parse().

Referenced by org.matsim.vehicles.MatsimVehicleReader.readURL(), and org.matsim.core.events.MatsimEventsReader.readURL().

159  {
160  parse( url ) ;
161  }
Here is the call graph for this function:

◆ readStream()

final void org.matsim.core.utils.io.MatsimXmlParser.readStream ( InputStream  stream) throws UncheckedIOException
inherited

Definition at line 163 of file MatsimXmlParser.java.

References org.matsim.core.utils.io.MatsimXmlParser.parse().

163  {
164  parse(stream);
165  }
Here is the call graph for this function:

◆ parse() [1/3]

final void org.matsim.core.utils.io.MatsimXmlParser.parse ( final URL  url) throws UncheckedIOException
inherited

◆ parse() [2/3]

final void org.matsim.core.utils.io.MatsimXmlParser.parse ( final InputStream  stream) throws UncheckedIOException
inherited

Definition at line 175 of file MatsimXmlParser.java.

References org.matsim.core.utils.io.MatsimXmlParser.parse().

175  {
176  this.theSource = "stream";
177  parse(new InputSource(stream));
178  }
Here is the call graph for this function:

◆ parse() [3/3]

final void org.matsim.core.utils.io.MatsimXmlParser.parse ( final InputSource  input) throws UncheckedIOException
inherited

Definition at line 180 of file MatsimXmlParser.java.

References org.matsim.core.utils.io.MatsimXmlParser.ValidationType.DTD_ONLY, and org.matsim.core.utils.io.MatsimXmlParser.ValidationType.NO_VALIDATION.

180  {
181  try {
182  boolean validating = this.isValidating && this.validationType != ValidationType.NO_VALIDATION;
183  boolean useWstxParser = !validating || this.validationType == ValidationType.DTD_ONLY;
184 
185  if (useWstxParser) {
186  // use Woodstox-library as XML parser when no validation or only DTD-validation is required, as it is much faster than the default (xerces)
187 
188  WstxSAXParserFactory factory = new WstxSAXParserFactory();
189  factory.setValidating(validating);
190  factory.setNamespaceAware(this.isNamespaceAware);
191  factory.setFeature("http://xml.org/sax/features/external-general-entities", false); // prevent XEE attack: https://en.wikipedia.org/wiki/XML_external_entity_attack
192 
193  if (validating) {
194  factory.setFeature("http://xml.org/sax/features/validation", true); // required to enable DTD validation in Woodstox
195  SAXParser parser = factory.newSAXParser();
196  XMLReader reader = parser.getXMLReader();
197  reader.setContentHandler(this);
198  reader.setErrorHandler(this);
199  reader.setEntityResolver(this);
200  reader.parse(input);
201  } else {
202  SAXParser parser = factory.newSAXParser();
203  parser.parse(input, this);
204  }
205 
206  } else {
207  // use the default (Xerces) SAX parser, it is slower than Woodstox, but supports XSD validation
208 
209  SAXParserFactory factory = SAXParserFactory.newInstance();
210  factory.setValidating(validating);
211  factory.setNamespaceAware(this.isNamespaceAware);
212  factory.setFeature("http://xml.org/sax/features/external-general-entities", false); // prevent XEE attack: https://en.wikipedia.org/wiki/XML_external_entity_attack
213 
214  if (validating) {
215  // enable optional support for XML Schemas
216  factory.setFeature("http://apache.org/xml/features/validation/schema", true);
217  SAXParser parser = factory.newSAXParser();
218  XMLReader reader = parser.getXMLReader();
219  reader.setContentHandler(this);
220  reader.setErrorHandler(this);
221  reader.setEntityResolver(this);
222  reader.parse(input);
223  } else {
224  SAXParser parser = factory.newSAXParser();
225  parser.parse(input, this);
226  }
227  }
228  } catch (IOException e) {
229  throw new UncheckedIOException(e);
230  } catch (SAXException | ParserConfigurationException e) {
231  throw new UncheckedIOException(new IOException(e));
232  }
233  }

◆ getDoctype()

final String org.matsim.core.utils.io.MatsimXmlParser.getDoctype ( )
inherited

Definition at line 235 of file MatsimXmlParser.java.

References org.matsim.core.utils.io.MatsimXmlParser.doctype.

235  {
236  return this.doctype;
237  }

◆ setDoctype()

void org.matsim.core.utils.io.MatsimXmlParser.setDoctype ( final String  doctype)
protectedinherited

Definition at line 239 of file MatsimXmlParser.java.

References org.matsim.core.utils.io.MatsimXmlParser.doctype.

Referenced by org.matsim.core.utils.io.MatsimXmlParser.resolveEntity().

239  {
240  // implementation of this method is what reacts to the different version of the file formats, so we cannot make it final. kai, jul'16
241 
242  this.doctype = doctype;
243  }

◆ resolveEntity()

final InputSource org.matsim.core.utils.io.MatsimXmlParser.resolveEntity ( final String  publicId,
final String  systemId 
)
inherited

Definition at line 248 of file MatsimXmlParser.java.

References org.matsim.core.utils.io.MatsimXmlParser.findDtdInClasspath(), org.matsim.core.utils.io.MatsimXmlParser.findDtdInDefaultLocation(), org.matsim.core.utils.io.MatsimXmlParser.findDtdInLocalFilesystem(), org.matsim.core.utils.io.MatsimXmlParser.findDtdInRemoteLocation(), and org.matsim.core.utils.io.MatsimXmlParser.setDoctype().

248  {
249  // ConfigReader* did override this. Not sure if it did that for good reasons. kai, jul'16
250 
251  // extract the last part of the systemId
252  int index = systemId.replace('\\', '/').lastIndexOf('/');
253  String shortSystemId = systemId.substring(index + 1);
254 
255  if (this.doctype == null) {
256  // this is the first systemId we have to resolve, assume it's the doctype
257  // I haven't found any other way to determine the doctype of the currently read file
258  setDoctype(shortSystemId);
259  }
260 
261  InputSource source;
262  if (this.preferLocalDtds) {
263  source = findDtdInLocalFilesystem(shortSystemId);
264  if (source == null) {
265  source = findDtdInClasspath(shortSystemId);
266  }
267  if (source == null) {
268  source = findDtdInDefaultLocation(shortSystemId);
269  }
270  if (source == null) {
271  source = findDtdInRemoteLocation(systemId);
272  }
273  } else {
274  source = findDtdInRemoteLocation(systemId);
275  if (source == null) {
276  source = findDtdInLocalFilesystem(shortSystemId);
277  }
278  if (source == null) {
279  source = findDtdInClasspath(shortSystemId);
280  }
281  if (source == null) {
282  source = findDtdInDefaultLocation(shortSystemId);
283  }
284  }
285 
286  if (source == null) {
287  // We could neither get the remote nor the local version of the dtd, show a warning
288  log.warn("Could neither get the DTD from the web nor a local one. " + systemId);
289  } else {
290  source.setSystemId(systemId);
291  }
292  return source;
293  }
static InputSource findDtdInDefaultLocation(final String shortSystemId)
static InputSource findDtdInRemoteLocation(final String fullSystemId)
InputSource findDtdInLocalFilesystem(final String shortSystemId)
InputSource findDtdInClasspath(final String shortSystemId)
Here is the call graph for this function:

◆ characters()

void org.matsim.core.utils.io.MatsimXmlParser.characters ( final char []  ch,
final int  start,
final int  length 
) throws SAXException
inherited

Definition at line 352 of file MatsimXmlParser.java.

352  {
353  // has to be non-final since otherwise the events parser does not work. Probably ok (this here is just a default implementation). kai, jul'16
354 
355  StringBuffer buffer = this.buffers.peek();
356  if (buffer != null) {
357  buffer.append(ch, start, length);
358  }
359  }

◆ startElement()

final void org.matsim.core.utils.io.MatsimXmlParser.startElement ( final String  uri,
final String  localName,
final String  qName,
Attributes  atts 
)
inherited

Definition at line 362 of file MatsimXmlParser.java.

References org.matsim.core.utils.io.MatsimXmlParser.startTag().

362  {
363  // I have not good intuition if making this one non-final might be ok. kai, jul'16
364 
365  String tag = (uri.length() == 0) ? qName : localName;
366  this.buffers.push(new StringBuffer());
367  this.startTag(tag, atts, this.theContext);
368  this.theContext.push(tag);
369  }
abstract void startTag(String name, Attributes atts, Stack< String > context)
Here is the call graph for this function:

◆ endElement()

final void org.matsim.core.utils.io.MatsimXmlParser.endElement ( final String  uri,
final String  localName,
final String  qName 
) throws SAXException
inherited

Definition at line 372 of file MatsimXmlParser.java.

References org.matsim.core.utils.io.MatsimXmlParser.endTag(), and org.matsim.core.utils.io.MatsimXmlParser.theContext.

372  {
373  // I have not good intuition if making this one non-final might be ok. kai, jul'16
374 
375  String tag = (uri.length() == 0) ? qName : localName;
376  this.theContext.pop();
377  StringBuffer buffer = this.buffers.pop();
378  this.endTag(tag, buffer.toString(), this.theContext);
379  }
abstract void endTag(String name, String content, Stack< String > context)
Here is the call graph for this function:

◆ error()

final void org.matsim.core.utils.io.MatsimXmlParser.error ( final SAXParseException  ex) throws SAXException
inherited

Definition at line 384 of file MatsimXmlParser.java.

References org.matsim.core.utils.io.MatsimXmlParser.getInputSource().

384  {
385  if (this.theContext.isEmpty()) {
386  System.err.println("Missing DOCTYPE.");
387  }
388  System.err.println("XML-ERROR: " + getInputSource(ex) + ", line " + ex.getLineNumber() + ", column " + ex.getColumnNumber() + ":");
389  System.err.println(ex.toString());
390  throw ex;
391  }
String getInputSource(final SAXParseException ex)
Here is the call graph for this function:

◆ fatalError()

final void org.matsim.core.utils.io.MatsimXmlParser.fatalError ( final SAXParseException  ex) throws SAXException
inherited

Definition at line 394 of file MatsimXmlParser.java.

References org.matsim.core.utils.io.MatsimXmlParser.getInputSource().

394  {
395  System.err.println("XML-FATAL: " + getInputSource(ex) + ", line " + ex.getLineNumber() + ", column " + ex.getColumnNumber() + ":");
396  System.err.println(ex.toString());
397  throw ex;
398  }
String getInputSource(final SAXParseException ex)
Here is the call graph for this function:

◆ warning()

final void org.matsim.core.utils.io.MatsimXmlParser.warning ( final SAXParseException  ex) throws SAXException
inherited

Definition at line 401 of file MatsimXmlParser.java.

References org.matsim.core.utils.io.MatsimXmlParser.getInputSource().

401  {
402  System.err.println("XML-WARNING: " + getInputSource(ex) + ", line " + ex.getLineNumber() + ", column " + ex.getColumnNumber() + ":");
403  System.err.println(ex.getMessage());
404  }
String getInputSource(final SAXParseException ex)
Here is the call graph for this function:

◆ parseDouble()

static double org.matsim.core.utils.io.MatsimXmlParser.parseDouble ( String  value) throws NumberFormatException
staticinherited

Parses a String into a double, taking into account the special encoding for Infinity according to the xsd-specifications for the xs:double data type

Definition at line 426 of file MatsimXmlParser.java.

426  {
427  if ("INF".equals(value)) {
428  return Double.POSITIVE_INFINITY;
429  }
430  if ("-INF".equals(value)) {
431  return Double.NEGATIVE_INFINITY;
432  }
433  if ("NaN".equals(value)) {
434  return Double.NaN;
435  }
436  return Double.parseDouble(value);
437  }

Member Data Documentation

◆ schedule

final TransitSchedule org.matsim.pt.transitSchedule.TransitScheduleReaderV1.schedule
private

◆ routeFactory

final RouteFactories org.matsim.pt.transitSchedule.TransitScheduleReaderV1.routeFactory
private

◆ currentTransitLine

TransitLine org.matsim.pt.transitSchedule.TransitScheduleReaderV1.currentTransitLine = null
private

Definition at line 59 of file TransitScheduleReaderV1.java.

◆ currentTransitRoute

TempTransitRoute org.matsim.pt.transitSchedule.TransitScheduleReaderV1.currentTransitRoute = null
private

Definition at line 60 of file TransitScheduleReaderV1.java.

◆ currentRouteProfile

TempRoute org.matsim.pt.transitSchedule.TransitScheduleReaderV1.currentRouteProfile = null
private

Definition at line 61 of file TransitScheduleReaderV1.java.

◆ coordinateTransformation

final CoordinateTransformation org.matsim.pt.transitSchedule.TransitScheduleReaderV1.coordinateTransformation
private

◆ cache

final StringCache org.matsim.pt.transitSchedule.TransitScheduleReaderV1.cache = new StringCache()
private

Definition at line 64 of file TransitScheduleReaderV1.java.


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