Class BasicDirectedNode
- Object
- 
- BasicGraphable
- 
- BasicDirectedNode
 
 
- 
- All Implemented Interfaces:
- Serializable,- DirectedGraphable,- DirectedNode,- Graphable,- Node
 - Direct Known Subclasses:
- BasicDirectedXYNode
 
 public class BasicDirectedNode extends BasicGraphable implements DirectedNode Basic implementation of DirectedNode.- Author:
- Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description BasicDirectedNode()Constructs a new BasicDirectedNode.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Edge e)Unsupported operation.voidaddIn(DirectedEdge e)Adds an edge to the in adjacency list of the node which is an underlying List implementation.voidaddOut(DirectedEdge e)Adds an edge to the ou adjacency list of the node which is an underlying List implementation.intgetDegree()Returns sum of sizes of in and out adjacency lists.EdgegetEdge(Node other)First searches for an in edge with an out node == this, and in node == other.List<DirectedEdge>getEdges()Returns the combination of both the in and out adjacency lists.List<DirectedEdge>getEdges(Node other)A combination of the results of getInEdges(Node) and getOutEdges(Node).intgetInDegree()Returns the in degree of the node.EdgegetInEdge(DirectedNode other)Returns an edge that terminates at the node and originates from a specified node.List<DirectedEdge>getInEdges()Returns the in adjacency list of the node.List<DirectedEdge>getInEdges(DirectedNode other)Returns all edges that terminate at the node and originate from a specified node.Iterator<DirectedNode>getInRelated()Returns all in nodes of in edges.intgetOutDegree()Returns the out degree of the node.EdgegetOutEdge(DirectedNode other)Returns an edge that originates at the node and terminates at a specified node.List<DirectedEdge>getOutEdges()Returns the out adjacency list of the node.List<DirectedEdge>getOutEdges(DirectedNode other)Returns all edges that originate at the node and terminate from at specified node.Iterator<DirectedNode>getOutRelated()Returns all out nodes of out edges.Iterator<DirectedNode>getRelated()Returns an iterator over all out nodes of out edges and in nodes of in edges.voidremove(Edge e)Removes the edge from both the in and out adjacency lists.voidremoveIn(DirectedEdge e)Removes an edge from the in adjacency list of the node.voidremoveOut(DirectedEdge e)Removes an edge from the out adjacency list of node.- 
Methods inherited from class BasicGraphablegetCount, getID, getObject, isVisited, setCount, setID, setObject, setVisited, toString
 
- 
 
- 
- 
- 
Method Detail- 
addpublic void add(Edge e) Unsupported operation. Directed nodes classify edges as in and out. addIn(Edge) and addOut(Edge) should be used instead of this method.- Specified by:
- addin interface- Node
- Parameters:
- e- Adjacent edge to add.
- See Also:
- DirectedNode.addIn(DirectedEdge),- DirectedNode.addOut(DirectedEdge)
 
 - 
addInpublic void addIn(DirectedEdge e) Adds an edge to the in adjacency list of the node which is an underlying List implementation. No checking is done on the edge (duplication, looping...), it is simply added to the list. It is also assumed that the edge being added has the node as its out node.- Specified by:
- addInin interface- DirectedNode
- Parameters:
- e- A directed edge that terminates at the node.
- See Also:
- DirectedNode.addIn(DirectedEdge),- DirectedEdge.getOutNode()
 
 - 
addOutpublic void addOut(DirectedEdge e) Adds an edge to the ou adjacency list of the node which is an underlying List implementation. No checking is done on the edge (duplication, looping...), it is simply added to the list. It is also assumed that the edge being added has the node as its in node.- Specified by:
- addOutin interface- DirectedNode
- Parameters:
- e- A directed edge that originates from the node.
- See Also:
- DirectedNode.addOut(DirectedEdge),- DirectedEdge.getInNode()
 
 - 
removepublic void remove(Edge e) Removes the edge from both the in and out adjacency lists.- Specified by:
- removein interface- Node
- Parameters:
- e- Adjacent edge to remove.
- See Also:
- Node.remove(Edge)
 
 - 
removeInpublic void removeIn(DirectedEdge e) Description copied from interface:DirectedNodeRemoves an edge from the in adjacency list of the node.- Specified by:
- removeInin interface- DirectedNode
- Parameters:
- e- A directed edge that terminates at the node.
- See Also:
- DirectedNode.removeIn(DirectedEdge)
 
 - 
removeOutpublic void removeOut(DirectedEdge e) Description copied from interface:DirectedNodeRemoves an edge from the out adjacency list of node.- Specified by:
- removeOutin interface- DirectedNode
- Parameters:
- e- A directed edge that originates from the node.
- See Also:
- DirectedNode.removeOut(DirectedEdge)
 
 - 
getEdgepublic Edge getEdge(Node other) First searches for an in edge with an out node == this, and in node == other. If none is found an edge with out node == other, and in node == this is searched for.- Specified by:
- getEdgein interface- Node
- Parameters:
- other- The other node that the desired edge to return is adjacent to.
- Returns:
- The first edge that is found to be adjacent to the specified node.
- See Also:
- Node.remove(Edge)
 
 - 
getInEdgepublic Edge getInEdge(DirectedNode other) Description copied from interface:DirectedNodeReturns an edge that terminates at the node and originates from a specified node.
 
 Note: It is possible for two nodes to share multiple edges between them. In this case, getInEdges(Node other) can be used to obtain a complete list.- Specified by:
- getInEdgein interface- DirectedNode
- Parameters:
- other- The originating node.
- Returns:
- The first edge found to terminate at the node and originate from the specefied node.
- See Also:
- DirectedNode.getInEdge(DirectedNode)
 
 - 
getOutEdgepublic Edge getOutEdge(DirectedNode other) Description copied from interface:DirectedNodeReturns an edge that originates at the node and terminates at a specified node.
 
 Note: It is possible for two nodes to share multiple edges between them. In this case, getOutEdges(Node other) can be used to obtain a complete list.- Specified by:
- getOutEdgein interface- DirectedNode
- Parameters:
- other- The terminating node.
- Returns:
- The first edge found to originate at the node and terminate at the specefied node.
- See Also:
- DirectedNode.getOutEdge(DirectedNode)
 
 - 
getEdgespublic List<DirectedEdge> getEdges() Returns the combination of both the in and out adjacency lists.
 - 
getInEdgespublic List<DirectedEdge> getInEdges() Description copied from interface:DirectedNodeReturns the in adjacency list of the node.- Specified by:
- getInEdgesin interface- DirectedNode
- Returns:
- A list of edges that terminate at the node.
- See Also:
- DirectedNode.getInEdges()
 
 - 
getOutEdgespublic List<DirectedEdge> getOutEdges() Description copied from interface:DirectedNodeReturns the out adjacency list of the node.- Specified by:
- getOutEdgesin interface- DirectedNode
- Returns:
- A list of edges originating at the node.
- See Also:
- DirectedNode.getOutEdges()
 
 - 
getEdgespublic List<DirectedEdge> getEdges(Node other) A combination of the results of getInEdges(Node) and getOutEdges(Node).- Specified by:
- getEdgesin interface- Node
- Parameters:
- other- The other node that the desired edges to return are adjacent to.
- Returns:
- List of all edges that are found to be adjacent to the specified node.
- See Also:
- Node.getEdges(Node),- DirectedNode.getInEdges(DirectedNode),- DirectedNode.getOutEdges(DirectedNode)
 
 - 
getInEdgespublic List<DirectedEdge> getInEdges(DirectedNode other) Description copied from interface:DirectedNodeReturns all edges that terminate at the node and originate from a specified node.- Specified by:
- getInEdgesin interface- DirectedNode
- Parameters:
- other- The originating node.
- Returns:
- All edges found to terminate at the node and originate from the specified node.
- See Also:
- DirectedNode.getInEdges(DirectedNode)
 
 - 
getOutEdgespublic List<DirectedEdge> getOutEdges(DirectedNode other) Description copied from interface:DirectedNodeReturns all edges that originate at the node and terminate from at specified node.- Specified by:
- getOutEdgesin interface- DirectedNode
- Parameters:
- other- The temimnating node.
- Returns:
- All edges found to originate at the node and terminate at the specified node.
- See Also:
- DirectedNode.getOutEdges(DirectedNode)
 
 - 
getDegreepublic int getDegree() Returns sum of sizes of in and out adjacency lists.- Specified by:
- getDegreein interface- Node
- Returns:
- int Degree of node.
- See Also:
- Node.getDegree()
 
 - 
getInDegreepublic int getInDegree() Description copied from interface:DirectedNodeReturns the in degree of the node.- Specified by:
- getInDegreein interface- DirectedNode
- Returns:
- The number of edges that terminate at the node.
- See Also:
- DirectedNode.getInDegree()
 
 - 
getOutDegreepublic int getOutDegree() Description copied from interface:DirectedNodeReturns the out degree of the node.- Specified by:
- getOutDegreein interface- DirectedNode
- Returns:
- The number of edges that originate at the node.
- See Also:
- DirectedNode.getOutDegree()
 
 - 
getRelatedpublic Iterator<DirectedNode> getRelated() Returns an iterator over all out nodes of out edges and in nodes of in edges.- Specified by:
- getRelatedin interface- Graphable
- Returns:
- Iterator An iterator over other components of the graph that are related to the component.
- See Also:
- Graphable.getRelated()
 
 - 
getInRelatedpublic Iterator<DirectedNode> getInRelated() Returns all in nodes of in edges.- Specified by:
- getInRelatedin interface- DirectedGraphable
- Returns:
- An iterator over the other directed components related through an in relationship.
- See Also:
- DirectedGraphable.getInRelated()
 
 - 
getOutRelatedpublic Iterator<DirectedNode> getOutRelated() Returns all out nodes of out edges.- Specified by:
- getOutRelatedin interface- DirectedGraphable
- Returns:
- An iterator over the other directed components related through an out relationship.
- See Also:
- DirectedGraphable.getOutRelated()
 
 
- 
 
-