Class BasicDirectedEdge
Object
BasicGraphable
BasicDirectedEdge
- All Implemented Interfaces:
Serializable
,DirectedEdge
,DirectedGraphable
,Edge
,Graphable
Basic implementation of DirectedEdge.
- Author:
- Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
- See Also:
-
Field Summary
Fields inherited from interface Edge
EQUAL_NODE_ORIENTATION, OPPOSITE_NODE_ORIENTATION, UNEQUAL_NODE_ORIENTATION
-
Constructor Summary
ConstructorsConstructorDescriptionBasicDirectedEdge
(DirectedNode in, DirectedNode out) Contstructs a new DirectedEdge. -
Method Summary
Modifier and TypeMethodDescriptionint
compareNodes
(Edge other) Compares the node orientation of the edge with another edge.Returns the originating (in) node of the edge.Returns an iterator over the in edges of the in node.getNodeA()
Returns the in node.getNodeB()
Returns the out node.getOtherNode
(Node node) Returns one of the two nodes of an edge.Returns the terminating (out) node of the edge.Returns an iterator over the out edges of the out node.Returns an iterator over all edges incident to both the in and out nodes.void
reverse()
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 Details
-
BasicDirectedEdge
Contstructs a new DirectedEdge.- Parameters:
in
- The in node of the edge.out
- The out node of the edge.
-
-
Method Details
-
getInNode
Description copied from interface:DirectedEdge
Returns the originating (in) node of the edge.- Specified by:
getInNode
in interfaceDirectedEdge
- Returns:
- The directed node at the source of the edge.
- See Also:
-
getOutNode
Description copied from interface:DirectedEdge
Returns the terminating (out) node of the edge.- Specified by:
getOutNode
in interfaceDirectedEdge
- Returns:
- The directed node at the destination of the edge.
- See Also:
-
getNodeA
Returns the in node. -
getNodeB
Returns the out node. -
getOtherNode
Description copied from interface:Edge
Returns 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:
getOtherNode
in 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:
-
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. -
getRelated
Returns an iterator over all edges incident to both the in and out nodes.- Specified by:
getRelated
in interfaceGraphable
- Returns:
- Iterator An iterator over other components of the graph that are related to the component.
- See Also:
-
getInRelated
Returns an iterator over the in edges of the in node.- Specified by:
getInRelated
in interfaceDirectedGraphable
- Returns:
- An iterator over the other directed components related through an in relationship.
- See Also:
-
getOutRelated
Returns an iterator over the out edges of the out node.- Specified by:
getOutRelated
in interfaceDirectedGraphable
- Returns:
- An iterator over the other directed components related through an out relationship.
- See Also:
-
compareNodes
Description copied from interface:Edge
Compares the node orientation of the edge with another edge.- Specified by:
compareNodes
in 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:
-