public class OTSNode extends Object implements Node, Locatable, Serializable
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2019-04-20 01:38:20 +0200 (Sat, 20 Apr 2019) $, @version $Revision: 5281 $, by $Author: averbraeck $,
initial version Aug 19, 2014
Constructor and Description |
---|
OTSNode(Network network,
String id,
OTSPoint3D point)
Construction of a Node.
|
Modifier and Type | Method and Description |
---|---|
void |
addConnection(GTUType gtuType,
Link incomingLink,
Link outgoingLink)
Add a single connection for a GTU type to the connections map.
|
void |
addConnections(GTUType gtuType,
Link incomingLink,
Set<Link> outgoingLinks)
Add a set of connections for a GTU type to the connections map.
|
void |
addLink(Link link)
Add a link to this Node.
|
OTSNode |
clone1(Network newNetwork,
SimulatorInterface.TimeDoubleUnit newSimulator)
Clone the OTSode for e.g., copying a network.
|
OTSNode |
clone2(Network newNetwork,
SimulatorInterface.TimeDoubleUnit newSimulator)
Complete the cloning of the OTSode for e.g., copying a network.
|
boolean |
equals(Object obj) |
javax.media.j3d.Bounds |
getBounds() |
String |
getId() |
ImmutableSet<Link> |
getLinks() |
DirectedPoint |
getLocation() |
Network |
getNetwork()
Return the network in which this link is registered.
|
OTSPoint3D |
getPoint() |
int |
hashCode() |
boolean |
isDirectionallyConnectedTo(GTUType gtuType,
Node toNode)
Note: this method does not take into account explicitly defined connections, as the previous link is not given.
|
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.
|
String |
toString() |
public OTSNode(Network network, String id, OTSPoint3D point) throws NetworkException
network
- Network; the network.id
- String; the id of the Node.point
- OTSPoint3D; the point with usually an x and y setting.NetworkException
- if node already exists in the network, or if name of the node is not unique.public final Network getNetwork()
getNetwork
in interface Node
public final String getId()
getId
in interface Identifiable
getId
in interface Node
public final OTSPoint3D getPoint()
public final void addLink(Link link)
public final void removeLink(Link link)
removeLink
in interface Node
link
- Link; the link to remove.public final void addConnection(GTUType gtuType, Link incomingLink, Link outgoingLink) throws NetworkException
gtuType
- GTUType; the GTU type for which this connection is madeincomingLink
- Link; the link that connects to this NodeoutgoingLink
- Link; the link that the GTU can use to depart from this Node when coming from the incoming linkNetworkException
- in case one of the links is not (correctly) connected to this Nodepublic final void addConnections(GTUType gtuType, Link incomingLink, Set<Link> outgoingLinks) throws NetworkException
gtuType
- GTUType; the GTU type for which this connection is madeincomingLink
- Link; the link that connects to this NodeoutgoingLinks
- Set<Link>; a set of links that the GTU can use to depart from this Node when coming from the
incoming linkNetworkException
- in case one of the links is not (correctly) connected to this Nodepublic final ImmutableSet<Link> getLinks()
public final Set<Link> nextLinks(GTUType gtuType, Link prevLink) throws NetworkException
nextLinks
in interface Node
gtuType
- GTUType; the GTU type to determine the next links forprevLink
- Link; the incoming link to the NodeNetworkException
- if the incoming link is not connected to this node for the given GTU typepublic final boolean isDirectionallyConnectedTo(GTUType gtuType, Node toNode)
isDirectionallyConnectedTo
in interface Node
gtuType
- GTUType; the GTU type to check the connection for.toNode
- Node; the to nodepublic DirectedPoint getLocation()
getLocation
in interface Locatable
public OTSNode clone1(Network newNetwork, SimulatorInterface.TimeDoubleUnit newSimulator) throws NetworkException
newNetwork
- Network; the new network to which the clone belongsnewSimulator
- SimulatorInterface.TimeDoubleUnit; the new simulator for this networkNetworkException
- in case the cloning failspublic OTSNode clone2(Network newNetwork, SimulatorInterface.TimeDoubleUnit newSimulator) throws NetworkException
newNetwork
- Network; the new network to which the clone belongsnewSimulator
- SimulatorInterface.TimeDoubleUnit; the new simulator for this networkNetworkException
- in case the cloning failsCopyright © 2014–2019 Delft University of Technology. All rights reserved.