org.geotools.graph
Class BasicEdgeList

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

public class BasicEdgeList
extends java.lang.Object
implements EdgeList

Basic implentation of an edge adjacency list.

See Also:
EdgeList

Constructor Summary
BasicEdgeList()
          Creates the edge list.
 
Method Summary
 void add(Edge edge)
          Adds an edge to the edge list.
 boolean contains(Edge edge)
          Determines if the edge list contains a certain edge.
 boolean contains(Edge edge, boolean reverse)
          Determines if an edge is contained in the list.
 Edge getEdge(Node n1, Node n2)
          Returns an edge in the list ended by specfic nodes.
 java.util.List getEdges()
          Returns the edges contained in the edge list.
 java.util.List getOtherEdges(Edge edge)
          Returns the edges in the list minus a specific edge.
 java.util.List getOtherNodes(Node node)
          Returns a collection of nodes adjacent to edges in the list minus a specifc node.
 int getSize()
          Returns the size of the edge list.
 void remove(Edge edge)
          Removed an 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

BasicEdgeList

public BasicEdgeList()
Creates the edge list.

Method Detail

add

public void add(Edge edge)
Description copied from interface: EdgeList
Adds an edge to the edge list.

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

remove

public void remove(Edge edge)
Description copied from interface: EdgeList
Removed an edge from the edge list.

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

getEdges

public java.util.List getEdges()
Description copied from interface: EdgeList
Returns the edges contained in the edge list.

Specified by:
getEdges in interface EdgeList
Returns:
List
See Also:
EdgeList.getEdges()

getEdge

public Edge getEdge(Node n1,
                    Node n2)
Description copied from interface: EdgeList
Returns an edge in the list ended by specfic nodes.

Specified by:
getEdge in interface EdgeList
Parameters:
n1 - Starting Edge Node
n2 - Ending Edge Node
Returns:
The Edge
See Also:
EdgeList.getEdge(Node, Node)

getSize

public int getSize()
Description copied from interface: EdgeList
Returns the size of the edge list.

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

getOtherNodes

public java.util.List getOtherNodes(Node node)
Description copied from interface: EdgeList
Returns a collection of nodes adjacent to edges in the list minus a specifc node.

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

getOtherEdges

public java.util.List getOtherEdges(Edge edge)
Description copied from interface: EdgeList
Returns the edges in the list minus a specific edge.

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

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)

contains

public boolean contains(Edge edge,
                        boolean reverse)
Determines if an edge is contained in the list.

Parameters:
edge - Edge to test for existance in list.
reverse - Wether or not consider two edges that are the reverse of each other equal. True if so, otherwise false.
Returns:
True if the edge is contained, false otherwise.