View Javadoc

1   /*
2    * @(#) DemoModel2.java Jun 6, 2004
3    * 
4    * Copyright (c) 2003, 2004 Delft University of Technology Jaffalaan 5, 2628 BX
5    * Delft, the Netherlands All rights reserved.
6    * 
7    * This software is proprietary information of Delft University of Technology
8    * The code is published under the General Public License
9    */
10  
11  package nl.tudelft.simulation.traffic;
12  
13  import java.net.URL;
14  import java.rmi.RemoteException;
15  
16  import nl.tudelft.simulation.dsol.ModelInterface;
17  import nl.tudelft.simulation.dsol.SimRuntimeException;
18  import nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface;
19  import nl.tudelft.simulation.dsol.simulators.SimulatorInterface;
20  import nl.tudelft.simulation.traffic.file.InfraFileXMLParser;
21  
22  /***
23   * <br>
24   * (c) copyright 2003-2004 <a href="http://www.simulation.tudelft.nl">Delft
25   * University of Technology </a>, the Netherlands. <br>
26   * See for project information <a href="http://www.simulation.tudelft.nl">
27   * www.simulation.tudelft.nl </a> <br>
28   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General
29   * Public License (GPL) </a>, no warranty <br>
30   * 
31   * @version May 31, 2004 <br>
32   * @author <a
33   * href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
34   * Verbraeck </a>
35   */
36  public class DemoModel2 implements ModelInterface
37  {
38      /***
39       * @see nl.tudelft.simulation.dsol.ModelInterface#constructModel(nl.tudelft.simulation.dsol.simulators.SimulatorInterface)
40       */
41      public void constructModel(SimulatorInterface simulator)
42              throws SimRuntimeException, RemoteException
43      {
44          try
45          {
46              URL url = this.getClass().getResource(
47                      "/nl/tudelft/simulation/traffic/demoModel2.xml");
48              System.out.println("Constructing model " + url.toString());
49              new InfraFileXMLParser(url, InfraFileXMLParser.INFRAFILE_SCHEMA,
50                      "http://www.simulation.tudelft.nl/traffic",
51                      true, (DEVSSimulatorInterface) simulator);
52          } catch (Exception e)
53          {
54              e.printStackTrace();
55              System.exit(-1);
56          }
57      }
58  }