public class OTSLink extends nl.tudelft.simulation.event.EventProducer implements Link, Serializable, Locatable
Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2017-01-16 01:48:07 +0100 (Mon, 16 Jan 2017) $, @version $Revision: 3281 $, by $Author: averbraeck $,
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,
LongitudinalDirectionality directionality)
Construct a new link, with a directionality for all GTUs as provided.
|
|
OTSLink(Network network,
String id,
Node startNode,
Node endNode,
LinkType linkType,
OTSLine3D designLine,
OTSSimulatorInterface simulator,
Map<GTUType,LongitudinalDirectionality> directionalityMap)
Construct a new link.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDirectionality(GTUType gtuType,
LongitudinalDirectionality directionality)
This method sets the directionality of the link for a GTU type.
|
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) |
Bounds |
getBounds() |
OTSLine3D |
getDesignLine() |
LongitudinalDirectionality |
getDirectionality(GTUType gtuType)
This method returns the directionality of the link for a GTU type.
|
protected Map<GTUType,LongitudinalDirectionality> |
getDirectionalityMap() |
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() |
DirectedPoint |
getLocation() |
Network |
getNetwork()
Return the network in which this link is registered.
|
OTSSimulatorInterface |
getSimulator() |
Node |
getStartNode() |
int |
hashCode() |
void |
removeDirectionality(GTUType gtuType)
This method removes an earlier provided directionality of the link for a given GTU type, e.g.
|
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, Map<GTUType,LongitudinalDirectionality> directionalityMap) 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 scheduleddirectionalityMap - the directions (FORWARD, BACKWARD, BOTH, NONE) that GTUtypes can traverse this linkNetworkException - 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 OTSLink(Network network, String id, Node startNode, Node endNode, LinkType linkType, OTSLine3D designLine, OTSSimulatorInterface simulator, LongitudinalDirectionality directionality) 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 scheduleddirectionality - the directionality for all GTUsNetworkException - 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 addDirectionality(GTUType gtuType, LongitudinalDirectionality directionality)
addDirectionality in interface LinkgtuType - the GTU type to set the directionality for.directionality - the longitudinal directionality of the link (FORWARD, BACKWARD, BOTH or NONE) for the given GTU
type.public final void removeDirectionality(GTUType gtuType)
removeDirectionality in interface LinkgtuType - the GTU type to remove the directionality for.public 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 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 Linkprotected final Map<GTUType,LongitudinalDirectionality> getDirectionalityMap()
public final org.djunits.value.vdouble.scalar.Length getLength()
public final DirectedPoint getLocation()
getLocation in interface 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–2017 Delft University of Technology. All rights reserved.