public abstract class AbstractGraphBuilder<V,E,G extends Graph<V,E>,B extends AbstractGraphBuilder<V,E,G,B>> extends Object
Graph
Constructor and Description |
---|
AbstractGraphBuilder(G baseGraph)
Creates a builder based on
baseGraph . |
Modifier and Type | Method and Description |
---|---|
B |
addEdge(V source,
V target)
Adds an edge to the graph being built.
|
B |
addEdgeChain(V first,
V second,
V... rest)
Adds a chain of edges to the graph being built.
|
B |
addGraph(Graph<? extends V,? extends E> sourceGraph)
Adds all the vertices and all the edges of the
sourceGraph to the
graph being built. |
B |
addVertex(V vertex)
Adds
vertex to the graph being built. |
B |
addVertices(V... vertices)
Adds each vertex of
vertices to the graph being built. |
G |
build()
Build the graph.
|
UnmodifiableGraph<V,E> |
buildUnmodifiable()
Build an unmodifiable version graph.
|
B |
removeEdge(V source,
V target)
Removes an edge going from source vertex to target vertex from the graph
being built, if such vertices and such edge exist in the graph.
|
B |
removeVertex(V vertex)
Removes
vertex from the graph being built, if such vertex exist
in graph. |
B |
removeVertices(V... vertices)
Removes each vertex of
vertices from the graph being built, if
such vertices exist in graph. |
protected abstract B |
self() |
public AbstractGraphBuilder(G baseGraph)
baseGraph
. baseGraph
must be
mutable.baseGraph
- the graph object to base building onprotected abstract B self()
this
object.public B addVertex(V vertex)
vertex
to the graph being built.vertex
- the vertex to addGraph.addVertex(Object)
public B addVertices(V... vertices)
vertices
to the graph being built.vertices
- the vertices to addaddVertex(Object)
public B addEdge(V source, V target)
source
- source vertex of the edge.target
- target vertex of the edge.Graphs.addEdgeWithVertices(Graph, Object, Object)
public B addEdgeChain(V first, V second, V... rest)
addEdge(Object, Object)
public B addGraph(Graph<? extends V,? extends E> sourceGraph)
sourceGraph
to the
graph being built.Graphs.addGraph(Graph, Graph)
public B removeVertex(V vertex)
vertex
from the graph being built, if such vertex exist
in graph.vertex
- the vertex to removeGraph.removeVertex(Object)
public B removeVertices(V... vertices)
vertices
from the graph being built, if
such vertices exist in graph.vertices
- the vertices to removeremoveVertex(Object)
public B removeEdge(V source, V target)
source
- source vertex of the edge.target
- target vertex of the edge.Graph.removeVertex(Object)
public G build()
public UnmodifiableGraph<V,E> buildUnmodifiable()
build()
Copyright © 2016. All rights reserved.