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-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
$LastChangedDate: 2020-01-23 11:14:19 +0100 (Thu, 23 Jan 2020) $, @version $Revision: 6010 $, by $Author: averbraeck $, initial version Aug 19, 2014
BSD-style license. See OpenTrafficSim License.- Author:
- Alexander Verbraeck, Peter Knoppers, Guus Tamminga
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddLink(Link link)Add a link to this Node.Bounds3dgetBounds()doublegetHeading()Retrieve the heading of this Node.StringgetId()Retrieve the id of this Node.ImmutableSet<Link>getLinks()Return an ImmutableSet of all Links at this Node.OrientedPoint3dgetLocation()NetworkgetNetwork()Return the network in which this link is registered.Point3dgetPoint()Retrieve the point of this Node.booleanisCentroid()Checks whether this Node has only connector links going in and/or out, and no other links.booleanisDirectionallyConnectedTo(GtuType gtuType, Node toNode)Check if this Node is linked to a specific 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.voidremoveLink(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()
Retrieve the id of this Node.- Specified by:
getIdin interfaceIdentifiable- Returns:
- String; the id of this Node
-
getPoint
Point3d getPoint()
Retrieve the point of this Node.- Returns:
- Point3d; the point of this Node
-
getHeading
double getHeading()
Retrieve the heading of this Node.- Returns:
- double; the heading of this node in Radians from the East direction (North is Pi/2; etc.)
-
addLink
void addLink(Link link)
Add a link to this Node. This method should only be called from the constructor of the Link.- Parameters:
link- Link; the link to add
-
removeLink
void removeLink(Link link)
Remove a Link from this Node. TODO decide if an attempt to remove a Link that is not linked to this Node should throw some exception.- Parameters:
link- Link; the link to remove
-
getLinks
ImmutableSet<Link> getLinks()
Return an ImmutableSet of all Links at this Node.- Returns:
- ImmutableSet<Link>; an immutable set 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:
- Set<Link>; a set of links connecting from the previous link via this Node for the given GTU type. This set is mutable and the caller may modify the result as it is created specifically for each invocation of this method
- 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 this Node is linked to a specific 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 fortoNode- Node; the to node- Returns:
- boolean; true if the nodes are directly linked in the specified direction for the specified GTUType; false if the nodes are not directly linked in the specified direction for the specified GTUType
-
isCentroid
boolean isCentroid()
Checks whether this Node has only connector links going in and/or out, and no other links.- Returns:
- boolean; true if this Node is a centroid, i.e. it only has connector links going in and out; false if this Node is not a centroid
-
getLocation
OrientedPoint3d getLocation()
- Specified by:
getLocationin interfaceLocatable
-
-