public class BasicGraphBuilder extends Object implements GraphBuilder
| Constructor and Description |
|---|
BasicGraphBuilder()
Constructs a new empty graph builder.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEdge(Edge edge)
Checks for loops in which case it only added the edge to the adjacency list of one of the
nodes (both of its nodes are the same node).
|
void |
addNode(Node node)
Adds a node to the graph.
|
Edge |
buildEdge(Node nodeA,
Node nodeB)
Builds a new edge for the graph.
|
protected Graph |
buildGraph()
Creates the underlying graph object.
|
Node |
buildNode()
Builds a new node for the graph.
|
Object |
clone(boolean deep)
Returns a clone of the builder.
|
Collection |
getEdges()
Returns the edges belonging to the graph being built.
|
Graph |
getGraph()
Returns the graph being built.
|
Collection |
getNodes()
Returns the nodes belonging to the graph being built.
|
void |
importGraph(Graph g)
Constructs a graph builder from a pre built graph.
|
void |
removeEdge(Edge edge)
Removes an edge from the graph.
|
void |
removeEdges(Collection edges)
Removes a collection of edges from the graph.
|
void |
removeNode(Node node)
Removes an node from the graph.
|
void |
removeNodes(Collection nodes)
Removes a collection of nodes from the graph.
|
public BasicGraphBuilder()
public Node buildNode()
GraphBuilderbuildNode in interface GraphBuilderGraphBuilder.buildNode()public Edge buildEdge(Node nodeA, Node nodeB)
GraphBuilderbuildEdge in interface GraphBuildernodeA - Adjacent node to edge.nodeB - Adjacent node to edge.GraphBuilder.buildEdge(Node, Node)public void addNode(Node node)
GraphBuilderaddNode in interface GraphBuildernode - Node to be added to graph.GraphBuilder.addNode(Node)public void addEdge(Edge edge)
addEdge in interface GraphBuilderedge - Edge to be added to graph.GraphBuilder.addEdge(Edge)public void removeNode(Node node)
GraphBuilderremoveNode in interface GraphBuildernode - Node to be removed from graph.GraphBuilder.removeNode(Node)public void removeNodes(Collection nodes)
GraphBuilderremoveNodes in interface GraphBuildernodes - A collection of nodes to be removed from the graph.GraphBuilder.removeNodes(Collection)public void removeEdge(Edge edge)
GraphBuilderremoveEdge in interface GraphBuilderedge - Edge to be removed from graph.GraphBuilder.removeEdge(Edge)public void removeEdges(Collection edges)
GraphBuilderremoveEdges in interface GraphBuilderedges - Collection of edges to be removed from the graph.GraphBuilder.removeEdges(Collection)public Graph getGraph()
GraphBuildergetGraph in interface GraphBuilderGraphBuilder.getGraph()public Object clone(boolean deep) throws Exception
GraphBuilderclone in interface GraphBuilderdeep - Deep or non deep clone.ExceptionGraphBuilder.clone(boolean)public void importGraph(Graph g)
GraphBuilderimportGraph in interface GraphBuilderg - A pre built graph.GraphBuilder.importGraph(Graph)public Collection getNodes()
public Collection getEdges()
protected Graph buildGraph()
Copyright © 1996–2019 Geotools. All rights reserved.