org.geotools.graph
Class InOutEdgeList

java.lang.Object
  extended byorg.geotools.graph.InOutEdgeList
All Implemented Interfaces:
EdgeList

public class InOutEdgeList
extends java.lang.Object
implements EdgeList

An implementaion of EdgeList that groups edges into two categories, incoming and outgoing.


Constructor Summary
InOutEdgeList()
          Creates a new InOutEdgeList object.
 
Method Summary
 void add(Edge edge)
          Operation not supported.
 void addIn(Edge edge)
          Adds an incoming edge to the edge list.
 void addOut(Edge edge)
          Adds an outgoing edge to the edge list.
 boolean contains(Edge edge)
          Determines if the edge list contains a certain edge.
 Edge getEdge(Node n1, Node n2)
          Returns an edge containted in the list specified by the two nodes.
 java.util.List getEdges()
          Returns all the edges contained in the edge list.
 Edge getInEdge(Node n1, Node n2)
          Returns an incoming edge contained in the list specified by the two nodes.
 java.util.List getInEdges()
          Returns the incoming edges contained in the edge list.
 java.util.List getOtherEdges(Edge edge)
          Returns all edges present in the list minus the specified edge.
 java.util.List getOtherInEdges(Edge edge)
          Returns all incoming edges minus the specified edge.
 java.util.List getOtherInNodes(Node node)
          Returns the list of nodes that are incident to the set of incoming edges and not equal to the specified node.
 java.util.List getOtherNodes(Node node)
          Returns the list of nodes that are incident to edges in the list which are not equal to the specified node.
 java.util.List getOtherOutEdges(Edge edge)
          Returns all outgoing edges minus the specified edge.
 java.util.List getOtherOutNodes(Node node)
          Returns the list of nodes that are incident to the set of outgoing edges and not equal to the specified node.
 Edge getOutEdge(Node n1, Node n2)
          Returns an outgoing edge contained in the list specified by the two nodes.
 java.util.List getOutEdges()
          Returns the outgoing edges contained in the edge list.
 int getSize()
          Returns the sum of the number of incoming and outgoing edges.
 void remove(Edge edge)
          Removes both an incoming and outgoing edge.
 void removeIn(Edge edge)
          Removes an incoming edge from the edge list.
 void removeOut(Edge edge)
          Removes an outgoing edge from the edge list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InOutEdgeList

public InOutEdgeList()
Creates a new InOutEdgeList object.

Method Detail

add

public void add(Edge edge)
Operation not supported. Use addIn(Edge) or addOut(Edge).

Specified by:
add in interface EdgeList
Parameters:
edge - the edge to be added.
See Also:
EdgeList.add(Edge)

addIn

public void addIn(Edge edge)
Adds an incoming edge to the edge list.

Parameters:
edge - Edge ME!

addOut

public void addOut(Edge edge)
Adds an outgoing edge to the edge list.

Parameters:
edge - Edge

remove

public void remove(Edge edge)
Removes both an incoming and outgoing edge.

Specified by:
remove in interface EdgeList
Parameters:
edge - the edge to be removed.
See Also:
EdgeList.remove(Edge)

removeIn

public void removeIn(Edge edge)
Removes an incoming edge from the edge list.

Parameters:
edge - Edge

removeOut

public void removeOut(Edge edge)
Removes an outgoing edge from the edge list.

Parameters:
edge -

getEdges

public java.util.List getEdges()
Returns all the edges contained in the edge list. Incoming and outgoing.

Specified by:
getEdges in interface EdgeList
Returns:
List

getInEdges

public java.util.List getInEdges()
Returns the incoming edges contained in the edge list.

Returns:
List

getOutEdges

public java.util.List getOutEdges()
Returns the outgoing edges contained in the edge list.

Returns:
List

getEdge

public Edge getEdge(Node n1,
                    Node n2)
Returns an edge containted in the list specified by the two nodes. First the incoming edges are examined. If no incoming edge is found, the outgoing edges are examined.

Specified by:
getEdge in interface EdgeList
Parameters:
n1 - Node
n2 - Node
Returns:
The edge if found, otherwise null.

getInEdge

public Edge getInEdge(Node n1,
                      Node n2)
Returns an incoming edge contained in the list specified by the two nodes.

Parameters:
n1 - The source node of the edge.
n2 - The terminal node of the edge.
Returns:
The edge if found, otherwise null.

getOutEdge

public Edge getOutEdge(Node n1,
                       Node n2)
Returns an outgoing edge contained in the list specified by the two nodes.

Parameters:
n1 - The source node of the edge.
n2 - The terminal node of the edge.
Returns:
The edge if found, otherwise null.

getOtherNodes

public java.util.List getOtherNodes(Node node)
Returns the list of nodes that are incident to edges in the list which are not equal to the specified node.

Specified by:
getOtherNodes in interface EdgeList
Parameters:
node - The node not to be returned.
Returns:
List
See Also:
EdgeList.getOtherNodes(Node)

getOtherInNodes

public java.util.List getOtherInNodes(Node node)
Returns the list of nodes that are incident to the set of incoming edges and not equal to the specified node.

Parameters:
node - Node
Returns:
List

getOtherOutNodes

public java.util.List getOtherOutNodes(Node node)
Returns the list of nodes that are incident to the set of outgoing edges and not equal to the specified node.

Parameters:
node - Node
Returns:
List

getOtherEdges

public java.util.List getOtherEdges(Edge edge)
Returns all edges present in the list minus the specified edge.

Specified by:
getOtherEdges in interface EdgeList
Parameters:
edge - The edge not to be returned.
Returns:
List
See Also:
EdgeList.getOtherEdges(Edge)

getOtherInEdges

public java.util.List getOtherInEdges(Edge edge)
Returns all incoming edges minus the specified edge.

Parameters:
edge - Edge
Returns:
Node

getOtherOutEdges

public java.util.List getOtherOutEdges(Edge edge)
Returns all outgoing edges minus the specified edge.

Parameters:
edge - Edge
Returns:
List

contains

public boolean contains(Edge edge)
Description copied from interface: EdgeList
Determines if the edge list contains a certain edge.

Specified by:
contains in interface EdgeList
Returns:
True if the edge is contained, false otherwise.
See Also:
EdgeList.contains(Edge)

getSize

public int getSize()
Returns the sum of the number of incoming and outgoing edges.

Specified by:
getSize in interface EdgeList
Returns:
The number of edges contained in the list.
See Also:
EdgeList.getSize()