Package org.opentrafficsim.core.network
Class CapacityOTSLink
- java.lang.Object
-
- org.djutils.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-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Nov 8, 2015
BSD-style license. See OpenTrafficSim License.- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.djutils.event.EventProducer
eventProducerImpl
-
Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
-
Fields 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, Frequency capacity)
Construct a new link.protected
CapacityOTSLink(Network newNetwork, CapacityOTSLink link)
Clone a link for a new network.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CapacityOTSLink
clone(OTSNetwork newNetwork)
Clone the OTSLink for e.g., copying a network.Frequency
getCapacity()
void
setCapacity(Frequency capacity)
Set the link capacity.String
toString()
-
Methods inherited from class org.opentrafficsim.core.network.OTSLink
addGTU, equals, getBounds, getDesignLine, getDirectionality, getEndNode, getGTUCount, getGTUs, getId, getLength, getLinkType, getLocation, getNetwork, getSimulator, getSourceId, getStartNode, hashCode, removeGTU
-
Methods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
-
-
-
Constructor Detail
-
CapacityOTSLink
public CapacityOTSLink(Network network, String id, Node startNode, Node endNode, LinkType linkType, OTSLine3D designLine, Frequency capacity) throws NetworkException
Construct a new link.- Parameters:
network
- OTSNetwork; 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 Linkcapacity
- 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, CapacityOTSLink link) throws NetworkException
Clone a link for a new network.- Parameters:
newNetwork
- OTSNetwork; the new network to which the clone belongslink
- 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 Detail
-
getCapacity
public final Frequency getCapacity()
- Specified by:
getCapacity
in interfaceCapacity
- Returns:
- link capacity.
-
setCapacity
public final void setCapacity(Frequency capacity)
Set the link capacity.- Specified by:
setCapacity
in interfaceCapacity
- Parameters:
capacity
- Frequency; the new capacity of the link as a frequency in GTUs per time unit.
-
clone
public CapacityOTSLink clone(OTSNetwork newNetwork) throws NetworkException
Clone the OTSLink for e.g., copying a network.- Overrides:
clone
in classOTSLink
- Parameters:
newNetwork
- Network; the new network to which the clone belongs- Returns:
- a clone of this object
- Throws:
NetworkException
- in case the cloning fails
-
-