Class DefinitionsParser
- java.lang.Object
-
- org.opentrafficsim.road.network.factory.xml.parser.DefinitionsParser
-
public final class DefinitionsParser extends Object
DefinitionParser parses the XML nodes of the DEFINITIONS tag: GTUTYPE, GTUTEMPLATE, LINKTYPE, LANETYPE and ROADLAYOUT.Copyright (c) 2003-2020 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidparseDefinitions(OTSRoadNetwork otsNetwork, DEFINITIONS definitions, boolean overwriteDefaults, Map<String,ROADLAYOUT> roadLayoutMap, Map<String,GTUTEMPLATE> gtuTemplates, StreamInformation streamInformation, Map<LinkType,Map<GTUType,Speed>> linkTypeSpeedLimitMap)Parse the DEFINITIONS tag in the OTS XML file.static voidparseGtuTemplates(DEFINITIONS definitions, OTSRoadNetwork otsNetwork, boolean overwriteDefaults, Map<String,GTUTEMPLATE> gtuTemplates, StreamInformation streamInformation)Store the GTUTEMPLATE tags in the OTS XML file.static voidparseGtuTypes(DEFINITIONS definitions, OTSRoadNetwork otsNetwork, boolean overwriteDefaults)Parse the GTUTYPES tag in the OTS XML file.static voidparseLaneTypes(DEFINITIONS definitions, OTSRoadNetwork otsNetwork, boolean overwriteDefaults)Parse the LANETYPES tag in the OTS XML file.static voidparseLinkTypes(DEFINITIONS definitions, OTSRoadNetwork otsNetwork, boolean overwriteDefaults, Map<LinkType,Map<GTUType,Speed>> linkTypeSpeedLimitMap)Parse the LINKTYPES tag in the OTS XML file.static voidparseParameterTypes(DEFINITIONS definitions, OTSRoadNetwork otsNetwork, Map<String,ParameterType<?>> parameterMap)Parse the PARAMETERTYPE tags in the OTS XML file.static voidparseRoadLayouts(DEFINITIONS definitions, OTSRoadNetwork otsNetwork, Map<String,ROADLAYOUT> roadLayoutMap)Parse the ROADLAYOUTS tag in the OTS XML file.
-
-
-
Method Detail
-
parseDefinitions
public static void parseDefinitions(OTSRoadNetwork otsNetwork, DEFINITIONS definitions, boolean overwriteDefaults, Map<String,ROADLAYOUT> roadLayoutMap, Map<String,GTUTEMPLATE> gtuTemplates, StreamInformation streamInformation, Map<LinkType,Map<GTUType,Speed>> linkTypeSpeedLimitMap) throws XmlParserException
Parse the DEFINITIONS tag in the OTS XML file.- Parameters:
otsNetwork- OTSRoadNetwork; the networkdefinitions- DEFINITIONS; the DEFINTIONS tagoverwriteDefaults- boolean; overwrite default definitions in otsNetwork or notroadLayoutMap- Map<String,ROADLAYOUT>; temporary storage for the road layoutsgtuTemplates- Map<String,GTUTEMPLATE>; map of GTU templates for the OD and/or GeneratorsstreamInformation- StreamInformation; the random streams that will be used in the modellinkTypeSpeedLimitMap- Map<LinkType,Map<GTUType,Speed>>; map with speed limit information per link type- Throws:
XmlParserException- on parsing error
-
parseGtuTypes
public static void parseGtuTypes(DEFINITIONS definitions, OTSRoadNetwork otsNetwork, boolean overwriteDefaults) throws XmlParserException
Parse the GTUTYPES tag in the OTS XML file.- Parameters:
definitions- DEFINITIONS; the DEFINTIONS tagotsNetwork- OTSRoadNetwork; the networkoverwriteDefaults- boolean; overwrite default definitions in otsNetwork or not- Throws:
XmlParserException- on parsing error
-
parseLinkTypes
public static void parseLinkTypes(DEFINITIONS definitions, OTSRoadNetwork otsNetwork, boolean overwriteDefaults, Map<LinkType,Map<GTUType,Speed>> linkTypeSpeedLimitMap) throws XmlParserException
Parse the LINKTYPES tag in the OTS XML file.- Parameters:
definitions- DEFINITIONS; the DEFINTIONS tagotsNetwork- OTSRoadNetwork; the networkoverwriteDefaults- boolean; overwrite default definitions in otsNetwork or notlinkTypeSpeedLimitMap- Map<LinkType,Map<GTUType,Speed>>; map with speed limit information per link type- Throws:
XmlParserException- on parsing error
-
parseLaneTypes
public static void parseLaneTypes(DEFINITIONS definitions, OTSRoadNetwork otsNetwork, boolean overwriteDefaults) throws XmlParserException
Parse the LANETYPES tag in the OTS XML file.- Parameters:
definitions- DEFINITIONS; the DEFINTIONS tagotsNetwork- OTSRoadNetwork; the networkoverwriteDefaults- boolean; overwrite default definitions in otsNetwork or not- Throws:
XmlParserException- on parsing error
-
parseGtuTemplates
public static void parseGtuTemplates(DEFINITIONS definitions, OTSRoadNetwork otsNetwork, boolean overwriteDefaults, Map<String,GTUTEMPLATE> gtuTemplates, StreamInformation streamInformation) throws XmlParserException
Store the GTUTEMPLATE tags in the OTS XML file.- Parameters:
definitions- DEFINITIONS; the DEFINTIONS tagotsNetwork- OTSRoadNetwork; the networkoverwriteDefaults- boolean; overwrite default definitions in otsNetwork or notgtuTemplates- Map<String,GTUTEMPLATE>; the templates to be used in the OD/GeneratorsstreamInformation- StreamInformation; the random streams that will be used in the model- Throws:
XmlParserException- on parsing error
-
parseRoadLayouts
public static void parseRoadLayouts(DEFINITIONS definitions, OTSRoadNetwork otsNetwork, Map<String,ROADLAYOUT> roadLayoutMap) throws XmlParserException
Parse the ROADLAYOUTS tag in the OTS XML file.- Parameters:
definitions- DEFINITIONS; the DEFINTIONS tagotsNetwork- OTSRoadNetwork; the networkroadLayoutMap- Map<String,ROADLAYOUT>; temporary storage for the road layouts- Throws:
XmlParserException- on parsing error
-
parseParameterTypes
public static void parseParameterTypes(DEFINITIONS definitions, OTSRoadNetwork otsNetwork, Map<String,ParameterType<?>> parameterMap) throws XmlParserException
Parse the PARAMETERTYPE tags in the OTS XML file.- Parameters:
definitions- DEFINITIONS; the DEFINTIONS tagotsNetwork- OTSRoadNetwork; the networkparameterMap- Map<String,ParameterType<?>>; map to store parameter type by id- Throws:
XmlParserException- if the field in a PARAMETERTYPE does not refer to a ParameterType<?>
-
-