Package org.geotools.graph.structure.opt
Class OptDirectedNode
- Object
- 
- OptGraphable
- 
- OptDirectedNode
 
 
- 
- All Implemented Interfaces:
- Serializable,- DirectedGraphable,- DirectedNode,- Graphable,- Node
 - Direct Known Subclasses:
- OptDirectedXYNode
 
 public class OptDirectedNode extends OptGraphable implements DirectedNode Optimized implementation of DirectedNode. The following optimizations reduce space and increase performance.
 - In and Out edge adjacency list stored as arrays of exact size.
- Support from removing edges is removed
- The related component iterators iterates over the underlying edge arrays of the node instread of newly created collections.
 - Author:
- Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
- See Also:
- DirectedNode, Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classOptDirectedNode.RelatedIteratorIterator used to iterate over related nodes.
 - 
Constructor SummaryConstructors Constructor Description OptDirectedNode()Constructs a new OptDirectedNode.OptDirectedNode(int indegree, int outdegree)Constructs a new OptDirectedNode.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Edge e)Not supported.voidaddIn(DirectedEdge e)Adds an edge to the in adjacency list of the node.voidaddOut(DirectedEdge e)Adds an edge to the out adjacency list of the node.intgetDegree()Returns the degree of the node.EdgegetEdge(Node other)Returns an edge in the adjacency list of the node that is adjacent to another specified node.List<DirectedEdge>getEdges()Returns the edge adjacency list of the node.List<Edge>getEdges(Node other)Returns a collection of edges in the adjacency list of the node that are adjacent to another specified 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.DirectedEdge[]getInEdgeArray()Returns the in adjacency edge array of the node.List<DirectedEdge>getInEdges()Returns the in adjacency list of the node.List<Edge>getInEdges(DirectedNode other)Returns all edges that terminate at the node and originate from a specified node.Iterator<Node>getInRelated()This iterator iterates over the underlying in edge array of the node.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.DirectedEdge[]getOutEdgeArray()Returns the out adjacency edge array of the node.List<DirectedEdge>getOutEdges()Returns the out adjacency list of the node.List<Edge>getOutEdges(DirectedNode other)Returns all edges that originate at the node and terminate from at specified node.Iterator<Node>getOutRelated()This iterator iterates over the underlying out edge array of the node.Iterator<Node>getRelated()This iterator iterates over the underlying edge arrays of the node.voidremove(Edge e)Unsupported Operation.voidremoveIn(DirectedEdge e)Unsupported Operation.voidremoveOut(DirectedEdge e)Unsupported Operation.voidsetInDegree(int indegree)Sets the in degree of the node.voidsetOutDegree(int outdegree)Sets the out degree of the node.- 
Methods inherited from class OptGraphablegetCount, getID, getObject, isVisited, setCount, setID, setObject, setVisited
 
- 
 
- 
- 
- 
Constructor Detail- 
OptDirectedNodepublic OptDirectedNode() Constructs a new OptDirectedNode. This constructor does not create the edge adjacency arrays for the node.
 - 
OptDirectedNodepublic OptDirectedNode(int indegree, int outdegree)Constructs a new OptDirectedNode.- Parameters:
- indegree- Number of in adjacenct edges to the node.
- outdegree- Number of out adjacent edges to the node.
 
 
- 
 - 
Method Detail- 
addpublic void add(Edge e) Not supported.
 - 
addInpublic void addIn(DirectedEdge e) Description copied from interface:DirectedNodeAdds an edge to the in adjacency list of the node.- Specified by:
- addInin interface- DirectedNode
- Parameters:
- e- A directed edge that terminates at the node.
- See Also:
- DirectedNode.addIn(DirectedEdge)
 
 - 
addOutpublic void addOut(DirectedEdge e) Description copied from interface:DirectedNodeAdds an edge to the out adjacency list of the node.- Specified by:
- addOutin interface- DirectedNode
- Parameters:
- e- A directed edge that originates from the node.
- See Also:
- DirectedNode.addOut(DirectedEdge)
 
 - 
removepublic void remove(Edge e) Unsupported Operation.
 - 
removeInpublic void removeIn(DirectedEdge e) Unsupported Operation.- Specified by:
- removeInin interface- DirectedNode
- Parameters:
- e- A directed edge that terminates at the node.
- See Also:
- Node.remove(Edge)
 
 - 
removeOutpublic void removeOut(DirectedEdge e) Unsupported Operation.- Specified by:
- removeOutin interface- DirectedNode
- Parameters:
- e- A directed edge that originates from the node.
- See Also:
- Node.remove(Edge)
 
 - 
getEdgepublic Edge getEdge(Node other) Description copied from interface:NodeReturns an edge in the adjacency list of the node that is adjacent to another specified node.
 
 Note: It is possible for two nodes to share multiple edges between them. In this case, getEdges(Node other) can be used to obtain a complete list.- 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.getEdge(Node)
 
 - 
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<Edge> getEdges(Node other) Description copied from interface:NodeReturns a collection of edges in the adjacency list of the node that are adjacent to another specified 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)
 
 - 
getInEdgespublic List<Edge> 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<Edge> 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)
 
 - 
getEdgespublic List<DirectedEdge> getEdges() Description copied from interface:NodeReturns the edge adjacency list of the node.- Specified by:
- getEdgesin interface- Node
- Returns:
- A list containing all edges that are adjacent to the node.
- See Also:
- Node.getEdges()
 
 - 
getInEdgeArraypublic DirectedEdge[] getInEdgeArray() Returns the in adjacency edge array of the node.- Returns:
- An array of in edges for the node.
 
 - 
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()
 
 - 
getOutEdgeArraypublic DirectedEdge[] getOutEdgeArray() Returns the out adjacency edge array of the node.- Returns:
- An array of out edges for the node.
 
 - 
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()
 
 - 
getDegreepublic int getDegree() Description copied from interface:NodeReturns the degree of the node. The degree of a node is defined as the number of edges that are adjacent to the node.- Specified by:
- getDegreein interface- Node
- Returns:
- int Degree of node.
- See Also:
- Node.getDegree()
 
 - 
setInDegreepublic void setInDegree(int indegree) Sets the in degree of the node. This method builds the in edge adjacency list of the node.- Parameters:
- indegree- The in degree / size of in edge array of the node.
 
 - 
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()
 
 - 
setOutDegreepublic void setOutDegree(int outdegree) Sets the out degree of the node. This method builds the out edge adjacency list of the node.- Parameters:
- outdegree- The out degree / size of out edge array of the node.
 
 - 
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<Node> getRelated() This iterator iterates over the underlying edge arrays of the node.- 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<Node> getInRelated() This iterator iterates over the underlying in edge array of the node.- Specified by:
- getInRelatedin interface- DirectedGraphable
- Returns:
- An iterator over the other directed components related through an in relationship.
- See Also:
- DirectedGraphable.getInRelated()
 
 - 
getOutRelatedpublic Iterator<Node> getOutRelated() This iterator iterates over the underlying out edge array of the node.- Specified by:
- getOutRelatedin interface- DirectedGraphable
- Returns:
- An iterator over the other directed components related through an out relationship.
- See Also:
- Graphable.getRelated()
 
 
- 
 
-