Class XmlOdParser

  • All Implemented Interfaces:
    java.io.Serializable

    public class XmlOdParser
    extends java.lang.Object
    implements java.io.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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void apply​(java.io.InputStream stream)
      Applies demand from stream.
      void apply​(java.io.InputStream stream, ODOptions odOptions)
      Applies demand from stream using OD options.
      void apply​(java.net.URL url)
      Applies demand from URL.
      void apply​(java.net.URL url, ODOptions odOptions)
      Applies demand from URL using OD options.
      void apply​(org.w3c.dom.Node xmlNode)
      Applies demand from xml node.
      void apply​(org.w3c.dom.Node xmlNode, ODOptions odOptions)
      Applies demand from URL using OD options.
      ODMatrix build​(java.io.InputStream stream)
      Build demand from stream.
      ODMatrix build​(java.net.URL url)
      Build demand from URL.
      ODMatrix build​(org.w3c.dom.Node xmlNode)
      Build demand from xml node.
      GTUType getGTUType​(java.lang.String id)
      Returns the GTU type for the given id.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XmlOdParser

        public XmlOdParser​(OTSSimulatorInterface simulator,
                           OTSRoadNetwork network,
                           java.util.Set<GTUType> gtuTypes)
        Constructor.
        Parameters:
        simulator - OTSSimulatorInterface; simulator
        network - OTSRoadNetwork; network
        gtuTypes - Set<GTUType>; set of GTU types
    • Method Detail

      • getGTUType

        public GTUType getGTUType​(java.lang.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​(java.net.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​(java.net.URL url,
                          ODOptions odOptions)
                   throws XmlParserException
        Applies demand from URL using OD options.
        Parameters:
        url - URL; URL to file
        odOptions - ODOptions; OD options
        Throws:
        XmlParserException - if URL cannot be parsed
      • apply

        public final void apply​(java.io.InputStream stream)
                         throws XmlParserException
        Applies demand from stream.
        Parameters:
        stream - InputStream; stream
        Throws:
        XmlParserException - if URL cannot be parsed
      • apply

        public final void apply​(java.io.InputStream stream,
                                ODOptions odOptions)
                         throws XmlParserException
        Applies demand from stream using OD options.
        Parameters:
        stream - InputStream; stream
        odOptions - ODOptions; OD options
        Throws:
        XmlParserException - if URL cannot be parsed
      • apply

        public final void apply​(org.w3c.dom.Node xmlNode)
                         throws XmlParserException
        Applies demand from xml node.
        Parameters:
        xmlNode - Node; node
        Throws:
        XmlParserException - if URL cannot be parsed
      • apply

        public void apply​(org.w3c.dom.Node xmlNode,
                          ODOptions odOptions)
                   throws XmlParserException
        Applies demand from URL using OD options.
        Parameters:
        xmlNode - Node; node
        odOptions - ODOptions; OD options
        Throws:
        XmlParserException - if URL cannot be parsed
      • build

        public final ODMatrix build​(java.net.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​(java.io.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​(org.w3c.dom.Node xmlNode)
                             throws XmlParserException
        Build demand from xml node.
        Parameters:
        xmlNode - Node; node
        Returns:
        ODMatrix; OD matrix
        Throws:
        XmlParserException - if stream cannot be parsed