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