View Javadoc
1   package org.opentrafficsim.water.network;
2   
3   import java.util.SortedMap;
4   import java.util.TreeMap;
5   
6   import org.djunits.value.vdouble.scalar.Length;
7   import org.opentrafficsim.core.dsol.OTSSimulatorInterface;
8   import org.opentrafficsim.core.geometry.OTSLine3D;
9   import org.opentrafficsim.core.network.LinkType;
10  import org.opentrafficsim.core.network.Network;
11  import org.opentrafficsim.core.network.NetworkException;
12  import org.opentrafficsim.core.network.OTSLink;
13  import org.opentrafficsim.core.network.OTSNode;
14  import org.opentrafficsim.water.network.infra.Obstacle;
15  import org.opentrafficsim.water.transfer.Terminal;
16  
17  /**
18   * A waterway, i.e. a river, canal or sailable route on a lake or sea.
19   * <p>
20   * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
21   * BSD-style license. See <a href="http://opentrafficsim.org/docs/current/license.html">OpenTrafficSim License</a>.
22   * </p>
23   * <p>
24   * Based on software from the IDVV project, which is Copyright (c) 2013 Rijkswaterstaat - Dienst Water, Verkeer en Leefomgeving
25   * and licensed without restrictions to Delft University of Technology, including the right to sub-license sources and derived
26   * products to third parties.
27   * </p>
28   * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
29   * initial version Nov 6, 2016 <br>
30   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
31   */
32  public class Waterway extends OTSLink
33  {
34      /** */
35      private static final long serialVersionUID = 20150927L;
36  
37      /** name. */
38      private final String name;
39  
40      /** current; positive direction is along the design line. */
41      private double current;
42  
43      /** list of obstacles, sorted on distance along the design line. */
44      private SortedMap<Length, Obstacle> obstacles = new TreeMap<>();
45  
46      /** list of terminals, sorted on distance along the design line. */
47      private SortedMap<Length, Terminal> terminals = new TreeMap<>();
48  
49      /**
50       * Construct a new waterway.
51       * @param network Network; the network.
52       * @param id String; the waterway id
53       * @param name String; the name
54       * @param startNode OTSNode; start node (directional)
55       * @param endNode OTSNode; end node (directional)
56       * @param linkType LinkType; Link type to indicate compatibility with GTU types
57       * @param designLine OTSLine3D; the OTSLine3D design line of the Link
58       * @param simulator OTSSimulatorInterface; the simulator to schedule events on
59       * @throws NetworkException when waterway with this id already exists
60       */
61      @SuppressWarnings("checkstyle:parameternumber")
62      public Waterway(final Network network, final String id, final String name, final OTSNode startNode, final OTSNode endNode,
63              final LinkType linkType, final OTSLine3D designLine, final OTSSimulatorInterface simulator) throws NetworkException
64      {
65          super(network, id, startNode, endNode, linkType, designLine, simulator);
66          this.name = name;
67      }
68  
69      /**
70       * @return name
71       */
72      public final String getName()
73      {
74          return this.name;
75      }
76  
77  }