org.geotools.graph.structure.basic
Class BasicEdge

java.lang.Object
  extended byorg.geotools.graph.structure.basic.BasicGraphable
      extended byorg.geotools.graph.structure.basic.BasicEdge
All Implemented Interfaces:
Edge, Graphable, java.io.Serializable
Direct Known Subclasses:
DelaunayEdge

public class BasicEdge
extends BasicGraphable
implements Edge

Basic implementation of Edge.

Author:
Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.geotools.graph.structure.Edge
EQUAL_NODE_ORIENTATION, OPPOSITE_NODE_ORIENTATION, UNEQUAL_NODE_ORIENTATION
 
Constructor Summary
BasicEdge(Node nodeA, Node nodeB)
          Constructs a new edge.
 
Method Summary
 int compareNodes(Edge other)
          Compares the node orientation of the edge with another edge.
 Node getNodeA()
          Returns the A node of the edge.
 Node getNodeB()
          Returns the B node of the edge.
 Node getOtherNode(Node node)
          Returns null if the specified node is neither the A node or the B node.
 java.util.Iterator getRelated()
          Returns all edges that are adjacent to both the A and B nodes.
 void reverse()
          Reverses the node orientation of the edge.
 java.lang.String toString()
          Returns ([A node.toString()],[B node.toString()]).
 
Methods inherited from class org.geotools.graph.structure.basic.BasicGraphable
getCount, getID, getObject, isVisited, setCount, setID, setObject, setVisited
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.geotools.graph.structure.Graphable
getCount, getID, getObject, isVisited, setCount, setID, setObject, setVisited
 

Constructor Detail

BasicEdge

public BasicEdge(Node nodeA,
                 Node nodeB)
Constructs a new edge.

Parameters:
nodeA - A node of edge.
nodeB - B node of edge.
Method Detail

getNodeA

public Node getNodeA()
Description copied from interface: Edge
Returns the A node of the edge.

Specified by:
getNodeA in interface Edge
Returns:
The A node.
See Also:
Edge.getNodeA()

getNodeB

public Node getNodeB()
Description copied from interface: Edge
Returns the B node of the edge.

Specified by:
getNodeB in interface Edge
Returns:
The B node.
See Also:
Edge.getNodeB()

getOtherNode

public Node getOtherNode(Node node)
Returns null if the specified node is neither the A node or the B node.

Specified by:
getOtherNode in interface Edge
Parameters:
node - The node opposite of the node to return.
Returns:
Node A if node B is specified, node B if node A is specified.
See Also:
Edge.getOtherNode(Node)

getRelated

public java.util.Iterator getRelated()
Returns all edges that are adjacent to both the A and B nodes. This iterator is generated by calculating an underlying collection upon each method call.

Specified by:
getRelated in interface Graphable
Returns:
Iterator An iterator over other components of the graph that are related to the component.
See Also:
Graphable.getRelated()

reverse

public void reverse()
Description copied from interface: Edge
Reverses the node orientation of the edge.

Specified by:
reverse in interface Edge
See Also:
Edge.reverse()

compareNodes

public int compareNodes(Edge other)
Description copied from interface: Edge
Compares the node orientation of the edge with another edge.

Specified by:
compareNodes in interface Edge
Returns:
EQUAL_NODE_ORIENTATION : both nodes are equal in the correct order. UNEQUAL_NODE_ORIENTATION: both nodes are not equal OPPOSITE_NODE_ORIENTATION : both nodes are equal in opposite order.
See Also:
Edge.compareNodes(Edge)

toString

public java.lang.String toString()
Returns ([A node.toString()],[B node.toString()]).

Overrides:
toString in class BasicGraphable
See Also:
Graphable.getID()


Copyright © GeoTools. All Rights Reserved.