Class BasicDirectedEdge
- Object
-
- BasicGraphable
-
- BasicDirectedEdge
-
- All Implemented Interfaces:
Serializable,DirectedEdge,DirectedGraphable,Edge,Graphable
public class BasicDirectedEdge extends BasicGraphable implements DirectedEdge
Basic implementation of DirectedEdge.- Author:
- Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface Edge
EQUAL_NODE_ORIENTATION, OPPOSITE_NODE_ORIENTATION, UNEQUAL_NODE_ORIENTATION
-
-
Constructor Summary
Constructors Constructor Description BasicDirectedEdge(DirectedNode in, DirectedNode out)Contstructs a new DirectedEdge.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareNodes(Edge other)Compares the node orientation of the edge with another edge.DirectedNodegetInNode()Returns the originating (in) node of the edge.Iterator<DirectedEdge>getInRelated()Returns an iterator over the in edges of the in node.NodegetNodeA()Returns the in node.NodegetNodeB()Returns the out node.NodegetOtherNode(Node node)Returns one of the two nodes of an edge.DirectedNodegetOutNode()Returns the terminating (out) node of the edge.Iterator<DirectedEdge>getOutRelated()Returns an iterator over the out edges of the out node.Iterator<Edge>getRelated()Returns an iterator over all edges incident to both the in and out nodes.voidreverse()Removes the edge from the out list of the in node and from the in list of the out node.-
Methods inherited from class BasicGraphable
getCount, getID, getObject, isVisited, setCount, setID, setObject, setVisited, toString
-
-
-
-
Constructor Detail
-
BasicDirectedEdge
public BasicDirectedEdge(DirectedNode in, DirectedNode out)
Contstructs a new DirectedEdge.- Parameters:
in- The in node of the edge.out- The out node of the edge.
-
-
Method Detail
-
getInNode
public DirectedNode getInNode()
Description copied from interface:DirectedEdgeReturns the originating (in) node of the edge.- Specified by:
getInNodein interfaceDirectedEdge- Returns:
- The directed node at the source of the edge.
- See Also:
DirectedEdge.getInNode()
-
getOutNode
public DirectedNode getOutNode()
Description copied from interface:DirectedEdgeReturns the terminating (out) node of the edge.- Specified by:
getOutNodein interfaceDirectedEdge- Returns:
- The directed node at the destination of the edge.
- See Also:
DirectedEdge.getOutNode()
-
getNodeA
public Node getNodeA()
Returns the in node.- Specified by:
getNodeAin interfaceEdge- Returns:
- The A node.
- See Also:
Edge.getNodeA()
-
getNodeB
public Node getNodeB()
Returns the out node.- Specified by:
getNodeBin interfaceEdge- Returns:
- The B node.
- See Also:
Edge.getNodeB()
-
getOtherNode
public Node getOtherNode(Node node)
Description copied from interface:EdgeReturns one of the two nodes of an edge. If the specified node is node A, then node B is returned, and vice versa.- Specified by:
getOtherNodein interfaceEdge- 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)
-
reverse
public void reverse()
Removes the edge from the out list of the in node and from the in list of the out node. Nodes are switched and then the edge is added to the in list of the new out node, and to the out list of the new in node.- Specified by:
reversein interfaceEdge- See Also:
Edge.reverse()
-
getRelated
public Iterator<Edge> getRelated()
Returns an iterator over all edges incident to both the in and out nodes.- Specified by:
getRelatedin interfaceGraphable- Returns:
- Iterator An iterator over other components of the graph that are related to the component.
- See Also:
Graphable.getRelated()
-
getInRelated
public Iterator<DirectedEdge> getInRelated()
Returns an iterator over the in edges of the in node.- Specified by:
getInRelatedin interfaceDirectedGraphable- Returns:
- An iterator over the other directed components related through an in relationship.
- See Also:
DirectedGraphable.getInRelated()
-
getOutRelated
public Iterator<DirectedEdge> getOutRelated()
Returns an iterator over the out edges of the out node.- Specified by:
getOutRelatedin interfaceDirectedGraphable- Returns:
- An iterator over the other directed components related through an out relationship.
- See Also:
DirectedGraphable.getOutRelated()
-
compareNodes
public int compareNodes(Edge other)
Description copied from interface:EdgeCompares the node orientation of the edge with another edge.- Specified by:
compareNodesin interfaceEdge- 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)
-
-