diva.pod.lwgraph
Class LightweightNetwork

java.lang.Object
  extended by diva.pod.lwgraph.LightweightGraph
      extended by diva.pod.lwgraph.LightweightNetwork

public class LightweightNetwork
extends LightweightGraph

A light-weight network is an extension of light-weight graph, and adds methods for dealing with explicit port objects.

Version:
$Revision: 1.5 $
Author:
John Reekie

Nested Class Summary
 
Nested classes/interfaces inherited from class diva.pod.lwgraph.LightweightGraph
LightweightGraph.TraversalIterator
 
Constructor Summary
LightweightNetwork()
          Create a new, empty, light-weight network
 
Method Summary
 void addEdge(LWEdge edge)
          Add an edge to the graph.
 void addPort(LWNode node, LWPort port)
          Add a port to the graph, and give it the given node as its parent
 void connect(LWEdge edge, LWPort tailport, LWPort headport)
          Connect the given tail and head ports using the given edge.
 LWPort getHeadPort(LWEdge edge)
          Get the head port of the given edge, or null if there isn't one.
 LWPort getTailPort(LWEdge edge)
          Get the tail port of the given edge, or null if there isn't one.
 Iterator ports(LWNode node)
          Return an iterator over the ports that belong to the given node.
 void setHeadPort(LWEdge edge, LWPort head)
          Connect the given head port to an edge.
 void setTailPort(LWEdge edge, LWPort tail)
          Connect the given tail port to an edge.
 
Methods inherited from class diva.pod.lwgraph.LightweightGraph
addNode, cacheTraversal, connect, edges, getEdge, getEdgeCount, getHeadNode, getNode, getNodeCount, getParent, getTailNode, getTopology, inEdges, invalidateCache, nodes, nodes, outEdges, predecessors, removeEdge, removeNode, roots, setHeadNode, setParent, setTailNode, successors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LightweightNetwork

public LightweightNetwork()
Create a new, empty, light-weight network

Method Detail

addPort

public void addPort(LWNode node,
                    LWPort port)
Add a port to the graph, and give it the given node as its parent


addEdge

public void addEdge(LWEdge edge)
Add an edge to the graph. Override the superclass method only for implementation reasons (to check and extend the \ length of some internal arrays if necessary).

Overrides:
addEdge in class LightweightGraph

connect

public void connect(LWEdge edge,
                    LWPort tailport,
                    LWPort headport)
Connect the given tail and head ports using the given edge. The ports must have previously been added to this network, as must the edge. If for some reason you don't want one end connected, use setHeadPort or setTailPort instead.


getHeadPort

public LWPort getHeadPort(LWEdge edge)
Get the head port of the given edge, or null if there isn't one.


getTailPort

public LWPort getTailPort(LWEdge edge)
Get the tail port of the given edge, or null if there isn't one.


ports

public Iterator ports(LWNode node)
Return an iterator over the ports that belong to the given node. This method is not particularly efficient. In general, a client of this class will ahve their own implementation of LWNode that has its own notion of ports, and that class would usually be a better way of performaing an operation like this. The remove() method is not supported.


setHeadPort

public void setHeadPort(LWEdge edge,
                        LWPort head)
Connect the given head port to an edge. To disconnect the edge from the port, set the port to null. The edge must have previously been added to the graph.


setTailPort

public void setTailPort(LWEdge edge,
                        LWPort tail)
Connect the given tail port to an edge. To disconnect the edge from the port, set the port to null. The edge must have previously been added to the graph.



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.