Package org.opentrafficsim.core.network
Interface Link
-
- All Superinterfaces:
Drawable
,Identifiable
,Locatable
,Serializable
- All Known Implementing Classes:
CapacityOTSLink
,OTSLink
public interface Link extends Locatable, Serializable, Identifiable, Drawable
Link as a connection between two Nodes.Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.$LastChangedDate$, @version $Revision$, by $Author$, initial version Aug 19, 2014
- Author:
- Alexander Verbraeck, Peter Knoppers
-
-
Field Summary
Fields Modifier and Type Field Description static TimedEventType
GTU_ADD_EVENT
The timed event type for pub/sub indicating the addition of a GTU to the link.static TimedEventType
GTU_REMOVE_EVENT
The timed event type for pub/sub indicating the removal of a GTU from the link.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addGTU(GTU gtu)
Add a GTU to this link (e.g., for statistical purposes, or for a model on macro level).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()
Network
getNetwork()
Return the network in which this link is registered.OTSSimulatorInterface
getSimulator()
Node
getStartNode()
void
removeGTU(GTU gtu)
Remove a GTU from this link.-
Methods inherited from interface nl.tudelft.simulation.dsol.animation.Locatable
getDirZ, getLocation, getZ
-
-
-
-
Field Detail
-
GTU_ADD_EVENT
static final TimedEventType GTU_ADD_EVENT
The timed event type for pub/sub indicating the addition of a GTU to the link.
Payload: Object[] {String gtuId, int count_after_addition}
-
GTU_REMOVE_EVENT
static final TimedEventType GTU_REMOVE_EVENT
The timed event type for pub/sub indicating the removal of a GTU from the link.
Payload: Object[] {String gtuId, int count_after_removal}
-
-
Method Detail
-
getNetwork
Network getNetwork()
Return the network in which this link is registered. Cannot be null.- Returns:
- Network; the network in which this link is registered
-
getId
String getId()
- Specified by:
getId
in interfaceIdentifiable
- Returns:
- id.
-
getStartNode
Node getStartNode()
- Returns:
- start node.
-
getEndNode
Node getEndNode()
- Returns:
- end node.
-
getLinkType
LinkType getLinkType()
- Returns:
- the link type.
-
getDesignLine
OTSLine3D getDesignLine()
- Returns:
- the design line.
-
getSimulator
OTSSimulatorInterface getSimulator()
- Returns:
- the simulator.
-
getLength
Length getLength()
- Returns:
- length of the link.
-
getDirectionality
LongitudinalDirectionality getDirectionality(GTUType gtuType)
This method returns the directionality of the link for a GTU type. It might be that the link is FORWARD (from start node to end node) for the GTU type CAR, but BOTH for the GTU type BICYCLE (i.e., bicycles can also go from end node to start node). If there is no entry for the given GTU Type, the values of GTUType.ALL will be returned. If this entry is not present, LongitudinalDirectionality.NONE will be returned.- Parameters:
gtuType
- GTUType; the GTU type to request the directionality for- Returns:
- the longitudinal directionality of the link (FORWARD, BACKWARD, BOTH or NONE) for the given GTU type. NONE will be returned if no directionality is given.
-
addGTU
void addGTU(GTU gtu)
Add a GTU to this link (e.g., for statistical purposes, or for a model on macro level). It is safe to add a GTU again. No warning or error will be given. The GTU_ADD_EVENT will only be fired when the GTU was not already on the link.- Parameters:
gtu
- GTU; the GTU to add.
-
removeGTU
void removeGTU(GTU gtu)
Remove a GTU from this link. It is safe to try to remove a GTU again. No warning or error will be given. The GTU_REMOVE_EVENT will only be fired when the GTU was on the link.- Parameters:
gtu
- GTU; the GTU to remove.
-
getGTUs
Set<GTU> getGTUs()
Provide a safe copy of the set of GTUs.- Returns:
- Set<GTU>; a safe copy of the set of GTUs
-
getGTUCount
int getGTUCount()
Provide the number of GTUs on this link.- Returns:
- int; the number of GTUs on this link
-
-