Package org.opentrafficsim.core.network
Class CapacityOTSLink
java.lang.Object
nl.tudelft.simulation.event.EventProducer
org.opentrafficsim.core.network.OTSLink
org.opentrafficsim.core.network.CapacityOTSLink
- All Implemented Interfaces:
Serializable,Locatable,EventProducerInterface,Identifiable,Drawable,Capacity,Link
public class CapacityOTSLink extends OTSLink implements Capacity
A link with a maximum capacity, expressed as the maximum number of GTUs per time unit that the link can handle.
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface
FIRST_POSITION, LAST_POSITIONFields inherited from interface org.opentrafficsim.core.network.Link
GTU_ADD_EVENT, GTU_REMOVE_EVENT -
Constructor Summary
Constructors Modifier Constructor Description CapacityOTSLink(Network network, String id, Node startNode, Node endNode, LinkType linkType, OTSLine3D designLine, OTSSimulatorInterface simulator, Frequency capacity)Construct a new link.protectedCapacityOTSLink(Network newNetwork, OTSSimulatorInterface newSimulator, CapacityOTSLink link)Clone a link for a new network. -
Method Summary
Modifier and Type Method Description CapacityOTSLinkclone(Network newNetwork, OTSSimulatorInterface newSimulator)Clone the OTSLink for e.g., copying a network.FrequencygetCapacity()voidsetCapacity(Frequency capacity)Set the link capacity.StringtoString()Methods inherited from class org.opentrafficsim.core.network.OTSLink
addGTU, equals, getBounds, getDesignLine, getDirectionality, getEndNode, getGTUCount, getGTUs, getId, getLength, getLinkType, getLocation, getNetwork, getSimulator, getStartNode, hashCode, removeGTUMethods inherited from class nl.tudelft.simulation.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListener
-
Constructor Details
-
CapacityOTSLink
public CapacityOTSLink(Network network, String id, Node startNode, Node endNode, LinkType linkType, OTSLine3D designLine, OTSSimulatorInterface simulator, Frequency capacity) throws NetworkExceptionConstruct a new link.- Parameters:
network- Network; the network.id- String; the link idstartNode- Node; start node (directional)endNode- Node; end node (directional)linkType- LinkType; Link type to indicate compatibility with GTU typesdesignLine- OTSLine3D; the OTSLine3D design line of the Linksimulator- OTSSimulatorInterface; the simulator on which events can be scheduledcapacity- Frequency; link capacity in GTUs per hour // XXX per direction? which GTUType?- Throws:
NetworkException- if link already exists in the network, if name of the link is not unique, or if the start node or the end node of the link are not registered in the network.
-
CapacityOTSLink
protected CapacityOTSLink(Network newNetwork, OTSSimulatorInterface newSimulator, CapacityOTSLink link) throws NetworkExceptionClone a link for a new network.- Parameters:
newNetwork- Network; the new network to which the clone belongsnewSimulator- OTSSimulatorInterface; the new simulator for this networklink- CapacityOTSLink; the link to clone from- Throws:
NetworkException- if link already exists in the network, if name of the link is not unique, or if the start node or the end node of the link are not registered in the network.
-
-
Method Details
-
getCapacity
- Specified by:
getCapacityin interfaceCapacity- Returns:
- link capacity.
-
setCapacity
Set the link capacity.- Specified by:
setCapacityin interfaceCapacity- Parameters:
capacity- Frequency; the new capacity of the link as a frequency in GTUs per time unit.
-
toString
-
clone
public CapacityOTSLink clone(Network newNetwork, OTSSimulatorInterface newSimulator) throws NetworkExceptionClone the OTSLink for e.g., copying a network.- Overrides:
clonein classOTSLink- Parameters:
newNetwork- Network; the new network to which the clone belongsnewSimulator- OTSSimulatorInterface; the new simulator for this network- Returns:
- a clone of this object
- Throws:
NetworkException- in case the cloning fails
-