public class OTSLink extends nl.tudelft.simulation.event.EventProducer implements Link, Serializable, nl.tudelft.simulation.dsol.animation.Locatable
Copyright (c) 2013-2017 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2018-09-12 11:53:16 +0200 (Wed, 12 Sep 2018) $, @version $Revision: 3931 $, by $Author: pknoppers $,
initial version Aug 19, 2014
GTU_ADD_EVENT, GTU_REMOVE_EVENT| Modifier | Constructor and Description |
|---|---|
protected |
OTSLink(Network newNetwork,
OTSSimulatorInterface newSimulator,
boolean animation,
OTSLink link)
Clone a link for a new network.
|
|
OTSLink(Network network,
String id,
Node startNode,
Node endNode,
LinkType linkType,
OTSLine3D designLine,
OTSSimulatorInterface simulator)
Construct a new link.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addGTU(GTU gtu)
Add a GTU to this link (e.g., for statistical purposes, or for a model on macro level).
|
OTSLink |
clone(Network newNetwork,
OTSSimulatorInterface newSimulator,
boolean animation)
Clone the OTSLink for e.g., copying a network.
|
boolean |
equals(Object obj) |
javax.media.j3d.Bounds |
getBounds() |
OTSLine3D |
getDesignLine() |
LongitudinalDirectionality |
getDirectionality(GTUType gtuType)
This method returns the directionality of the link for a GTU type.
|
Node |
getEndNode() |
int |
getGTUCount()
Provide the number of GTUs on this link.
|
Set<GTU> |
getGTUs()
Provide a safe copy of the set of GTUs.
|
String |
getId() |
org.djunits.value.vdouble.scalar.Length |
getLength() |
LinkType |
getLinkType() |
nl.tudelft.simulation.language.d3.DirectedPoint |
getLocation() |
Network |
getNetwork()
Return the network in which this link is registered.
|
OTSSimulatorInterface |
getSimulator() |
Node |
getStartNode() |
int |
hashCode() |
void |
removeGTU(GTU gtu)
Remove a GTU from this link.
|
String |
toString() |
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListenerpublic OTSLink(Network network, String id, Node startNode, Node endNode, LinkType linkType, OTSLine3D designLine, OTSSimulatorInterface simulator) throws NetworkException
id - the link idnetwork - the network to which the link belongsstartNode - start node (directional)endNode - end node (directional)linkType - Link type to indicate compatibility with GTU typesdesignLine - the OTSLine3D design line of the Linksimulator - the simulator on which events can be scheduledNetworkException - 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.protected OTSLink(Network newNetwork, OTSSimulatorInterface newSimulator, boolean animation, OTSLink link) throws NetworkException
newNetwork - the new network to which the clone belongsnewSimulator - the new simulator for this networkanimation - whether to (re)create animation or not. Could be used in subclasses.link - the link to clone fromNetworkException - 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.public final LongitudinalDirectionality getDirectionality(GTUType gtuType)
getDirectionality in interface LinkgtuType - the GTU type to request the directionality forpublic final void addGTU(GTU gtu)
public final void removeGTU(GTU gtu)
public final int getGTUCount()
getGTUCount in interface Linkpublic final Network getNetwork()
getNetwork in interface Linkpublic final String getId()
public final Node getStartNode()
getStartNode in interface Linkpublic final Node getEndNode()
getEndNode in interface Linkpublic final LinkType getLinkType()
getLinkType in interface Linkpublic final OTSLine3D getDesignLine()
getDesignLine in interface Linkpublic final OTSSimulatorInterface getSimulator()
getSimulator in interface Linkpublic final org.djunits.value.vdouble.scalar.Length getLength()
public nl.tudelft.simulation.language.d3.DirectedPoint getLocation()
getLocation in interface nl.tudelft.simulation.dsol.animation.Locatablepublic javax.media.j3d.Bounds getBounds()
getBounds in interface nl.tudelft.simulation.dsol.animation.Locatablepublic OTSLink clone(Network newNetwork, OTSSimulatorInterface newSimulator, boolean animation) throws NetworkException
newNetwork - the new network to which the clone belongsnewSimulator - the new simulator for this networkanimation - whether to (re)create animation or notNetworkException - in case the cloning failsCopyright © 2014–2018 Delft University of Technology. All rights reserved.