public class OTSLink extends EventProducer implements Link, Serializable, Locatable
Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2018-09-19 13:55:45 +0200 (Wed, 19 Sep 2018) $, @version $Revision: 4006 $, by $Author: averbraeck $,
initial version Aug 19, 2014
listenersGTU_ADD_EVENT, GTU_REMOVE_EVENTFIRST_POSITION, LAST_POSITION| Modifier | Constructor and Description |
|---|---|
protected |
OTSLink(Network newNetwork,
SimulatorInterface.TimeDoubleUnit 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,
SimulatorInterface.TimeDoubleUnit 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,
SimulatorInterface.TimeDoubleUnit 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() |
Length |
getLength() |
LinkType |
getLinkType() |
DirectedPoint |
getLocation() |
Network |
getNetwork()
Return the network in which this link is registered.
|
SimulatorInterface.TimeDoubleUnit |
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, SimulatorInterface.TimeDoubleUnit 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, SimulatorInterface.TimeDoubleUnit 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()
getId in interface IdentifiablegetId in interface Linkpublic 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 SimulatorInterface.TimeDoubleUnit getSimulator()
getSimulator in interface Linkpublic final Length getLength()
public DirectedPoint getLocation()
getLocation in interface Locatablepublic OTSLink clone(Network newNetwork, SimulatorInterface.TimeDoubleUnit 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.