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()
GraphBuilder
buildNode
in interface GraphBuilder
GraphBuilder.buildNode()
public Edge buildEdge(Node nodeA, Node nodeB)
GraphBuilder
buildEdge
in interface GraphBuilder
nodeA
- Adjacent node to edge.nodeB
- Adjacent node to edge.GraphBuilder.buildEdge(Node, Node)
public void addNode(Node node)
GraphBuilder
addNode
in interface GraphBuilder
node
- Node to be added to graph.GraphBuilder.addNode(Node)
public void addEdge(Edge edge)
addEdge
in interface GraphBuilder
edge
- Edge to be added to graph.GraphBuilder.addEdge(Edge)
public void removeNode(Node node)
GraphBuilder
removeNode
in interface GraphBuilder
node
- Node to be removed from graph.GraphBuilder.removeNode(Node)
public void removeNodes(Collection nodes)
GraphBuilder
removeNodes
in interface GraphBuilder
nodes
- A collection of nodes to be removed from the graph.GraphBuilder.removeNodes(Collection)
public void removeEdge(Edge edge)
GraphBuilder
removeEdge
in interface GraphBuilder
edge
- Edge to be removed from graph.GraphBuilder.removeEdge(Edge)
public void removeEdges(Collection edges)
GraphBuilder
removeEdges
in interface GraphBuilder
edges
- Collection of edges to be removed from the graph.GraphBuilder.removeEdges(Collection)
public Graph getGraph()
GraphBuilder
getGraph
in interface GraphBuilder
GraphBuilder.getGraph()
public Object clone(boolean deep) throws Exception
GraphBuilder
clone
in interface GraphBuilder
deep
- Deep or non deep clone.Exception
GraphBuilder.clone(boolean)
public void importGraph(Graph g)
GraphBuilder
importGraph
in interface GraphBuilder
g
- A pre built graph.GraphBuilder.importGraph(Graph)
public Collection getNodes()
public Collection getEdges()
protected Graph buildGraph()
Copyright © 1996–2019 Geotools. All rights reserved.