Package org.opentrafficsim.core.network
Interface Node
-
- All Superinterfaces:
Drawable
,Identifiable
,Locatable
,Serializable
- All Known Implementing Classes:
OTSNode
public interface Node extends Locatable, Serializable, Identifiable, Drawable
The Node is a point with an id. It is used in the network to connect Links.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, Guus Tamminga
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addLink(Link link)
Add a link to this Node.Bounds
getBounds()
double
getHeading()
String
getId()
ImmutableSet<Link>
getLinks()
DirectedPoint
getLocation()
Network
getNetwork()
Return the network in which this link is registered.OTSPoint3D
getPoint()
boolean
isCentroid()
Checks whether the node has only connector links going in and/or out, and no other links.boolean
isDirectionallyConnectedTo(GTUType gtuType, Node toNode)
Check if the current node is linked to the given Node in the specified direction for the given GTUType.Set<Link>
nextLinks(GTUType gtuType, Link prevLink)
Determine the links connecting from the previous link via this Node for the given GTU type.void
removeLink(Link link)
Remove a link from this Node.
-
-
-
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:
- node id.
-
getPoint
OTSPoint3D getPoint()
- Returns:
- point.
-
getHeading
double getHeading()
- Returns:
- heading.
-
addLink
void addLink(Link link)
Add a link to this Node.- Parameters:
link
- Link; the link to add.
-
removeLink
void removeLink(Link link)
Remove a link from this Node.- Parameters:
link
- Link; the link to remove.
-
getLinks
ImmutableSet<Link> getLinks()
- Returns:
- a safe copy of the links connected to this Node
-
nextLinks
Set<Link> nextLinks(GTUType gtuType, Link prevLink) throws NetworkException
Determine the links connecting from the previous link via this Node for the given GTU type.- Parameters:
gtuType
- GTUType; the GTU type to determine the next links forprevLink
- Link; the incoming link to the Node- Returns:
- a set of links connecting from the previous link via this Node for the given GTU type
- Throws:
NetworkException
- if the incoming link is not connected to this node for the given GTU type
-
isDirectionallyConnectedTo
boolean isDirectionallyConnectedTo(GTUType gtuType, Node toNode)
Check if the current node is linked to the given Node in the specified direction for the given GTUType. This can mean there is a Link from this node to toNode, and the LongitudinalDirectionality for the Link between this node and toNode is FORWARD or BOTH; or there is a Link from toNode to this node, and the LongitudinalDirectionality for the Link between toNode and this node is BACKWARD or BOTH for the provided GTUType.- Parameters:
gtuType
- GTUType; the GTU type to check the connection for.toNode
- Node; the to node- Returns:
- whether two nodes are linked in the specified direction.
-
isCentroid
boolean isCentroid()
Checks whether the node has only connector links going in and/or out, and no other links.- Returns:
- boolean; whether the node is a centroid, i.e. it only has connector links going in and out
-
getLocation
DirectedPoint getLocation()
- Specified by:
getLocation
in interfaceLocatable
-
-