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: 2022-02-09 18:05:59 +0100 (Wed, 09 Feb 2022) $, @version $Revision: 7012 $, by $Author: averbraeck $, initial version Aug 19, 2014
- Author:
- Alexander Verbraeck, Peter Knoppers
-
-
Field Summary
Fields Modifier and Type Field Description static TimedEventTypeGTU_ADD_EVENTThe timed event type for pub/sub indicating the addition of a GTU to the link.static TimedEventTypeGTU_REMOVE_EVENTThe 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 voidaddGTU(GTU gtu)Add a GTU to this link (e.g., for statistical purposes, or for a model on macro level).BoundsgetBounds()OTSLine3DgetDesignLine()LongitudinalDirectionalitygetDirectionality(GTUType gtuType)This method returns the directionality of the link for a GTU type.NodegetEndNode()intgetGTUCount()Provide the number of GTUs on this link.Set<GTU>getGTUs()Provide a safe copy of the set of GTUs.StringgetId()LengthgetLength()LinkTypegetLinkType()NetworkgetNetwork()Return the network in which this link is registered.SimulatorInterface.TimeDoubleUnitgetSimulator()NodegetStartNode()voidremoveGTU(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:
getIdin 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
SimulatorInterface.TimeDoubleUnit 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
-
-