public class OTSLink extends EventProducer implements Link, Serializable, Locatable
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.
$LastChangedDate: 2019-04-11 12:30:43 +0200 (Thu, 11 Apr 2019) $, @version $Revision: 5255 $, by $Author: pknoppers $,
initial version Aug 19, 2014
listeners
GTU_ADD_EVENT, GTU_REMOVE_EVENT
FIRST_POSITION, LAST_POSITION
Modifier | Constructor and Description |
---|---|
protected |
OTSLink(Network newNetwork,
OTSSimulatorInterface newSimulator,
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)
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.
|
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, removeListener
public OTSLink(Network network, String id, Node startNode, Node endNode, LinkType linkType, OTSLine3D designLine, OTSSimulatorInterface simulator) throws NetworkException
id
- String; the link idnetwork
- Network; the network to which the link belongsstartNode
- 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 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, OTSLink link) throws NetworkException
newNetwork
- Network; the new network to which the clone belongsnewSimulator
- OTSSimulatorInterface; the new simulator for this networklink
- OTSLink; 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 Link
gtuType
- GTUType; 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 Link
public Network getNetwork()
getNetwork
in interface Link
public final String getId()
getId
in interface Identifiable
getId
in interface Link
public final Node getStartNode()
getStartNode
in interface Link
public final Node getEndNode()
getEndNode
in interface Link
public final LinkType getLinkType()
getLinkType
in interface Link
public final OTSLine3D getDesignLine()
getDesignLine
in interface Link
public final OTSSimulatorInterface getSimulator()
getSimulator
in interface Link
public final Length getLength()
public DirectedPoint getLocation()
getLocation
in interface Locatable
public OTSLink clone(Network newNetwork, OTSSimulatorInterface newSimulator) throws NetworkException
newNetwork
- Network; the new network to which the clone belongsnewSimulator
- OTSSimulatorInterface; the new simulator for this networkNetworkException
- in case the cloning failsCopyright © 2014–2019 Delft University of Technology. All rights reserved.