Class 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-2018 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information www.simulation.tudelft.nl. The source code and binary code of this software is proprietary information of Delft University of Technology.
    Author:
    Alexander Verbraeck
    • Method Detail

      • parseDefinitions

        public static void parseDefinitions​(OTSRoadNetwork otsNetwork,
                                            DEFINITIONS definitions,
                                            boolean overwriteDefaults,
                                            Map<String,​ROADLAYOUT> roadLayoutMap,
                                            Map<String,​GTUTEMPLATE> gtuTemplates,
                                            Map<String,​StreamInformation> streamMap,
                                            Map<LinkType,​Map<GTUType,​Speed>> linkTypeSpeedLimitMap)
                                     throws XmlParserException
        Parse the DEFINITIONS tag in the OTS XML file.
        Parameters:
        otsNetwork - the network
        definitions - the DEFINTIONS tag
        overwriteDefaults - overwrite default definitions in otsNetwork or not
        roadLayoutMap - temporary storage for the road layouts
        gtuTemplates - map of GTU templates for the OD and/or Generators
        streamMap - map with stream information
        linkTypeSpeedLimitMap - 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 - the DEFINTIONS tag
        otsNetwork - the network
        overwriteDefaults - 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 - the DEFINTIONS tag
        otsNetwork - the network
        overwriteDefaults - overwrite default definitions in otsNetwork or not
        linkTypeSpeedLimitMap - 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 - the DEFINTIONS tag
        otsNetwork - the network
        overwriteDefaults - 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,
                                             Map<String,​StreamInformation> streamMap)
                                      throws XmlParserException
        Store the GTUTEMPLATE tags in the OTS XML file.
        Parameters:
        definitions - the DEFINTIONS tag
        otsNetwork - the network
        overwriteDefaults - overwrite default definitions in otsNetwork or not
        gtuTemplates - the templates to be used in the OD/Generators
        streamMap - map with stream information
        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 - the DEFINTIONS tag
        otsNetwork - the network
        parameterMap - map to store parameter type by id
        Throws:
        XmlParserException - if the field in a PARAMETERTYPE does not refer to a ParameterType<?>