ID
- the ID type of the network.L
- public class ExpansionNetwork<ID,L extends Link<?,?>> extends Network<ID,L>
| -------O-------- |can be expanded into:
| A /|\ / | \ -----B--C--D----- \ | / \|/ E |Node O in the example is expanded into the subnetwork consisting of nodes A, B, C, D, and E, and links AB, AC, AD, BC, CD, BE, CE, and DE. It also means that when node expansion takes place, the links to node O have to be replaced. In the example below:
X | Y------O-------Z | Wcan be expanded into:
X | A /|\ / | \ Y----B--C--D----Z \ | / \|/ E | Wthe node XO is replaced by XA, YO is replaced by YB, OZ is replaced by DZ, and OW is replaced by EW in the network. The reverse takes place when we do node collapse.
Copyright (c) 2013-2014 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Constructor and Description |
---|
ExpansionNetwork(ID id)
Construction of an empty network.
|
ExpansionNetwork(ID id,
Collection<? extends L> collection)
Construction of a network with an initial set of links.
|
ExpansionNetwork(ID id,
Collection<? extends L> collection,
Node<?,?> expansionNode)
Construction of a network with an initial set of links, and an expansion node.
|
Modifier and Type | Method and Description |
---|---|
boolean |
collapseLinks(Node<?,?> node1,
Node<?,?> node2)
Collapse all links between two given nodes into one forward and one reverse link.
|
boolean |
collapseToNode(HashSet<Node<?,?>> nodesOfSubNetwork)
Collapse a nodes into a sub network.
|
boolean |
deleteNode(Node<?,?> deleteThis)
Delete a node from this network (or a sub-network of this network).
|
Set<L> |
findLinkHierarchyBelow(int hierarchyLevel)
Find all links that have a hierarchy level not exceeding the specified value.
|
Node<?,?> |
getExpansionOfNode() |
ExpansionNetwork<?,?> |
getSubNetworkConsistNode(Node<?,?> node)
Return the sub network that directly owns a specified node.
|
boolean |
isInNetwork(Node<?,?> node,
boolean recurse)
Determine if a node is part of this Network.
|
void |
setExpansionOfNode(Node<?,?> expansionOfNode) |
addNode, getId, getNodeSet, isInNetwork, setNodeSet
add, clear, clone, contains, isEmpty, iterator, remove, size
equals, hashCode, removeAll
addAll, containsAll, retainAll, toArray, toArray, toString
public ExpansionNetwork(ID id)
id
- the network id.public ExpansionNetwork(ID id, Collection<? extends L> collection)
id
- the network id.collection
- the initial collection of links.public ExpansionNetwork(ID id, Collection<? extends L> collection, Node<?,?> expansionNode) throws NetworkException
id
- the network id.collection
- the initial collection of links.expansionNode
- Node of which this network is an expansion.NetworkException
- when expansion node is part of the initial collection.public final Node<?,?> getExpansionOfNode()
public final void setExpansionOfNode(Node<?,?> expansionOfNode) throws NetworkException
expansionOfNode
- set expansionOfNodeNetworkException
- when expansion node is part of the node collection.public final boolean isInNetwork(Node<?,?> node, boolean recurse)
node
- Node<?, ?>; the noderecurse
- boolean; if true also search sub-networkspublic final ExpansionNetwork<?,?> getSubNetworkConsistNode(Node<?,?> node) throws NetworkException
node
- Node<?, ?>; the nodeNetworkException
- if the specified node is not contained in this Network or any of its sub Networkspublic final boolean deleteNode(Node<?,?> deleteThis) throws NetworkException
deleteNode
in class Network<ID,L extends Link<?,?>>
deleteThis
- Node<?, ?>; the node that must be deletedNetworkException
- on network inconsistencypublic final boolean collapseToNode(HashSet<Node<?,?>> nodesOfSubNetwork)
nodesOfSubNetwork
- HashSet<Node<?, ?>>; the nodes that go into the new sub networkpublic final boolean collapseLinks(Node<?,?> node1, Node<?,?> node2)
node1
- Node; the first nodenode2
- Node; the second nodepublic final Set<L> findLinkHierarchyBelow(int hierarchyLevel) throws NetworkException
hierarchyLevel
- int; the maximum hierarchy level of the returned linksNetworkException
- on network inconsistencyCopyright © 2014–2015 Delft University of Technology. All rights reserved.