Class XmlOdParser
- java.lang.Object
-
- org.opentrafficsim.road.network.factory.xml.demand.XmlOdParser
-
- All Implemented Interfaces:
Serializable
public class XmlOdParser extends Object implements Serializable
OD parser.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 25 mei 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description XmlOdParser(OTSSimulatorInterface simulator, OTSRoadNetwork network, Set<GTUType> gtuTypes)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(InputStream stream)Applies demand from stream.voidapply(InputStream stream, ODOptions odOptions)Applies demand from stream using OD options.voidapply(URL url)Applies demand from URL.voidapply(URL url, ODOptions odOptions)Applies demand from URL using OD options.voidapply(Node xmlNode)Applies demand from xml node.voidapply(Node xmlNode, ODOptions odOptions)Applies demand from URL using OD options.ODMatrixbuild(InputStream stream)Build demand from stream.ODMatrixbuild(URL url)Build demand from URL.ODMatrixbuild(Node xmlNode)Build demand from xml node.GTUTypegetGTUType(String id)Returns the GTU type for the given id.
-
-
-
Constructor Detail
-
XmlOdParser
public XmlOdParser(OTSSimulatorInterface simulator, OTSRoadNetwork network, Set<GTUType> gtuTypes)
Constructor.- Parameters:
simulator- OTSSimulatorInterface; simulatornetwork- OTSRoadNetwork; networkgtuTypes- Set<GTUType>; set of GTU types
-
-
Method Detail
-
getGTUType
public GTUType getGTUType(String id) throws XmlParserException
Returns the GTU type for the given id.- Parameters:
id- String; id- Returns:
- GTU type for the given id
- Throws:
XmlParserException- if the GTU type is not available
-
apply
public final void apply(URL url) throws XmlParserException
Applies demand from URL.- Parameters:
url- URL; URL to file- Throws:
XmlParserException- if URL cannot be parsed
-
apply
public void apply(URL url, ODOptions odOptions) throws XmlParserException
Applies demand from URL using OD options.- Parameters:
url- URL; URL to fileodOptions- ODOptions; OD options- Throws:
XmlParserException- if URL cannot be parsed
-
apply
public final void apply(InputStream stream) throws XmlParserException
Applies demand from stream.- Parameters:
stream- InputStream; stream- Throws:
XmlParserException- if URL cannot be parsed
-
apply
public final void apply(InputStream stream, ODOptions odOptions) throws XmlParserException
Applies demand from stream using OD options.- Parameters:
stream- InputStream; streamodOptions- ODOptions; OD options- Throws:
XmlParserException- if URL cannot be parsed
-
apply
public final void apply(Node xmlNode) throws XmlParserException
Applies demand from xml node.- Parameters:
xmlNode- Node; node- Throws:
XmlParserException- if URL cannot be parsed
-
apply
public void apply(Node xmlNode, ODOptions odOptions) throws XmlParserException
Applies demand from URL using OD options.- Parameters:
xmlNode- Node; nodeodOptions- ODOptions; OD options- Throws:
XmlParserException- if URL cannot be parsed
-
build
public final ODMatrix build(URL url) throws XmlParserException
Build demand from URL.- Parameters:
url- URL; URL to file- Returns:
- ODMatrix; OD matrix
- Throws:
XmlParserException- if URL cannot be parsed
-
build
public final ODMatrix build(InputStream stream) throws XmlParserException
Build demand from stream.- Parameters:
stream- InputStream; stream- Returns:
- ODMatrix; OD matrix
- Throws:
XmlParserException- if stream cannot be parsed
-
build
public final ODMatrix build(Node xmlNode) throws XmlParserException
Build demand from xml node.- Parameters:
xmlNode- Node; node- Returns:
- ODMatrix; OD matrix
- Throws:
XmlParserException- if stream cannot be parsed
-
-