public class BasicGraph extends Object implements Graph, Serializable
Graph,
Serialized FormFAIL_QUERY, PASS_AND_CONTINUE, PASS_AND_STOP| Constructor and Description |
|---|
BasicGraph()
Constructs an empty graph with edge and node collections uninitialized.
|
BasicGraph(Collection nodes,
Collection edges)
Constructs a graph from a collection of nodes and a collection of edges.
|
| Modifier and Type | Method and Description |
|---|---|
Collection |
getEdges()
Returns the edges of the graph.
|
Collection |
getNodes()
Returns the nodes of the graph.
|
List |
getNodesOfDegree(int n)
Returns all the nodes in the graph of a specified degree.
|
List |
getVisitedEdges(boolean visited)
Returns all the edges in the graph that have been marked as visited or non-visited.
|
List |
getVisitedNodes(boolean visited)
Returns all the nodes in the graph that have been marked as visited or non-visited.
|
void |
initEdges()
Initializes the edges in the graph by setting all visited flags to false and all visited
counts to zero.
|
void |
initNodes()
Initializes the nodes in the graph by setting all visited flags to false and all visited
counts to zero.
|
List |
queryEdges(GraphVisitor visitor)
Performs a query against the edges of the graph.
|
List |
queryNodes(GraphVisitor visitor)
Performs a query against the nodes of the graph.
|
void |
setEdges(Collection edges)
Sets the edge collection for the graph.
|
void |
setNodes(Collection nodes)
Sets the node collection of the graph.
|
String |
toString()
Returns the string representation of the graph which is just the string representation of the
edge and node collections.
|
void |
visitEdges(GraphVisitor visitor)
Applies the visitor pattern to the edges of the graph.
|
void |
visitNodes(GraphVisitor visitor)
Applies the visitor pattern to the nodes of the graph.
|
public BasicGraph()
public BasicGraph(Collection nodes, Collection edges)
nodes - Collection of nodes to be contained by the graph.edges - Collection of edges to be contained by the graph.public void setNodes(Collection nodes)
nodes - Collection of Node objects.public Collection getNodes()
GraphgetNodes in interface GraphGraph.getNodes()public void setEdges(Collection edges)
edges - Collection of Edge objects.public Collection getEdges()
GraphgetEdges in interface GraphGraph.getEdges()public List queryNodes(GraphVisitor visitor)
GraphqueryNodes in interface Graphvisitor - Determines if node meets query criteria. Returns MEET_AND_CONTINUE to signal
that the node meets the query criteria and the query should continue.Graph.queryNodes(GraphVisitor)public List queryEdges(GraphVisitor visitor)
GraphqueryEdges in interface Graphvisitor - Determines if the meets the query criteria. Graph.queryEdges(GraphVisitor)public void visitNodes(GraphVisitor visitor)
GraphvisitNodes in interface GraphGraph.visitNodes(GraphVisitor)public void visitEdges(GraphVisitor visitor)
GraphvisitEdges in interface GraphGraph.visitEdges(GraphVisitor)public List getNodesOfDegree(int n)
GraphgetNodesOfDegree in interface Graphn - The desired degree of nodes to be returned.Graph.getNodesOfDegree(int),
Node.getDegree()public List getVisitedNodes(boolean visited)
GraphgetVisitedNodes in interface Graphvisited - True if node is visited, false if node is unvisited.Graph.getVisitedNodes(boolean)public List getVisitedEdges(boolean visited)
GraphgetVisitedEdges in interface Graphvisited - True if edge is visited, false if edge is unvisited.Graph.getVisitedEdges(boolean)public void initNodes()
public void initEdges()
Copyright © 1996–2019 Geotools. All rights reserved.