V
- The type of vertices in the graphE
- The type of edges in the graph@ProviderType
public interface GraphConfigurator<V,E>
Modifier and Type | Method and Description |
---|---|
GraphConfigurator<V,E> |
acyclic() |
default <L> GraphConfigurator<V,E> |
addInternalListener(java.util.function.Function<GraphListeners<V,E>,Observable<L>> listenerSet,
Observer<L> listener) |
Graph<V,E> |
create() |
default GraphConfigurator<V,E> |
directed()
The graph will be directed, and the direction of an edge will be determined
by the order in which the vertices for that edge are given when an edge is
added.
|
GraphConfigurator<V,E> |
direction(java.util.Comparator<V> lowToHigh)
This method sets a comparator to determine the direction of an edge between
two vertices.
|
GraphConfigurator<V,E> |
direction(java.util.function.Function<E,java.util.Comparator<V>> lowToHigh)
This method accepts a function to create a comparator from an edge, over
the vertices associated with that edge.
|
GraphConfigurator<V,E> |
edge(E edge,
V from,
V to) |
GraphConfigurator<V,E> |
edge(V from,
V to)
This method wraps and forwards it's parameters to
edges(Collection) . |
GraphConfigurator<V,E> |
edgeEquality(java.util.function.BiPredicate<? super E,? super E> comparator) |
<F extends E> |
edgeFactory(java.util.function.Function<EdgeVertices<V>,F> factory)
For simple or multigraphs, specify the mechanism by which edge
objects will be generated between two vertices when an edge is added
between them.
|
default <F extends E> |
edgeFactory(java.util.function.Supplier<F> factory)
This method behaves as
edgeFactory(Function) , except that the
creation of edge objects is independent of the associated vertex objects. |
<F extends E> |
edgeMultiFactory(java.util.function.Function<EdgeVertices<V>,java.util.Set<F>> factory)
For multigraphs, specify the mechanism by which edge objects will be
generated between two vertices when an edge is added between them.
|
GraphConfigurator<V,E> |
edges(java.util.Collection<? extends EdgeVertices<V>> edges)
Accepts a collection of vertex pairs for edges to be defined between.
|
default GraphConfigurator<V,E> |
edges(EdgeVertices<V>... edges)
This method wraps and forwards it's parameters to
edges(Collection) . |
<F extends E> |
edges(java.util.Map<F,EdgeVertices<V>> edges) |
<F extends E> |
edgeType() |
GraphConfigurator<V,E> |
edgeWeight(java.util.function.Function<E,java.lang.Double> weight)
This method accepts a mapping from an edge to a weight for that edge.
|
GraphConfigurator<V,E> |
internalListeners(java.util.function.Consumer<GraphListeners<V,E>> internalListeners)
Graph operations are atomic.
|
GraphConfigurator<V,E> |
multigraph() |
GraphConfigurator<V,E> |
readOnly()
Calling this method has the same effect as calling both
readOnlyVertices() and readOnlyEdges() . |
GraphConfigurator<V,E> |
readOnlyEdges()
Calling this method has the effect of making the resulting graph
unmodifiable through the manual addition of edges.
|
GraphConfigurator<V,E> |
readOnlyVertices()
Calling this method has the effect of making the resulting graph
unmodifiable through the manual addition of vertices.
|
GraphConfigurator<V,E> |
vertexEquality(java.util.function.BiPredicate<? super V,? super V> comparator) |
<W extends V> |
vertices(java.util.Collection<W> vertices)
Accepts a collection of vertices to be contained in the resulting graph.
|
default <W extends V> |
vertices(W... vertices)
This method wraps and forwards it's parameters to
vertices(Collection) . |
GraphConfigurator<V,E> readOnly()
readOnlyVertices()
and readOnlyEdges()
.GraphConfigurator<V,E> readOnlyVertices()
GraphConfigurator<V,E> readOnlyEdges()
<W extends V> GraphConfigurator<W,E> vertices(java.util.Collection<W> vertices)
vertices
- Vertex objects to include in the graphdefault <W extends V> GraphConfigurator<W,E> vertices(W... vertices)
vertices(Collection)
.vertices
- Vertex objects to include in the graphGraphConfigurator<V,E> edges(java.util.Collection<? extends EdgeVertices<V>> edges)
edges
- Edges to include in the graphdefault GraphConfigurator<V,E> edges(EdgeVertices<V>... edges)
edges(Collection)
.edges
- Edges to include in the graph<F extends E> GraphConfigurator<V,F> edgeType()
GraphConfigurator<V,E> edge(V from, V to)
edges(Collection)
.<F extends E> GraphConfigurator<V,F> edges(java.util.Map<F,EdgeVertices<V>> edges)
default GraphConfigurator<V,E> directed()
GraphConfigurator<V,E> acyclic()
GraphConfigurator<V,E> multigraph()
GraphConfigurator<V,E> direction(java.util.Comparator<V> lowToHigh)
lowToHigh
- A vertex comparator defining a direction between verticesGraphConfigurator<V,E> direction(java.util.function.Function<E,java.util.Comparator<V>> lowToHigh)
direction(Comparator)
method.
The function is only applied at most once per creation of an edge.lowToHigh
- A function from an edge between two vertices to a vertex
comparator defining a direction between those vertices<F extends E> GraphConfigurator<V,F> edgeFactory(java.util.function.Function<EdgeVertices<V>,F> factory)
The provided function will be invoked when an edge is added between two vertices without an edge object being explicitly provided.
If no edge factory is provided, by way of either this method or
edgeMultiFactory(Function)
, edge objects must be explicitly
provided when adding an edge between vertices, by way of e.g.
edge(Object, Object, Object)
or edges(Map)
. Conversely,
if an edge factory is provided, it will not be possible to add
edges in that manner.
<F extends E> GraphConfigurator<V,F> edgeMultiFactory(java.util.function.Function<EdgeVertices<V>,java.util.Set<F>> factory)
The provided function will be invoked when an edge is added between two vertices without an edge object being explicitly provided.
If no edge factory is provided, by way of either this method or
edgeMultiFactory(Function)
, edge objects must be explicitly
provided when adding an edge between vertices, by way of e.g.
edge(Object, Object, Object)
or edges(Map)
. Conversely,
if an edge factory is provided, it will not be possible to add
edges in that manner.
default <F extends E> GraphConfigurator<V,F> edgeFactory(java.util.function.Supplier<F> factory)
edgeFactory(Function)
, except that the
creation of edge objects is independent of the associated vertex objects.factory
- The factory with which to create edge objectsGraphConfigurator<V,E> edgeWeight(java.util.function.Function<E,java.lang.Double> weight)
weight
- A function from an edge object to its weightGraphConfigurator<V,E> vertexEquality(java.util.function.BiPredicate<? super V,? super V> comparator)
GraphConfigurator<V,E> edgeEquality(java.util.function.BiPredicate<? super E,? super E> comparator)
GraphConfigurator<V,E> internalListeners(java.util.function.Consumer<GraphListeners<V,E>> internalListeners)
If an exception is caught at the root invocation of an atomic operation, the operation will be cancelled and all pending changes discarded. Internal listeners are triggered during an atomic operation as each change occurs, and so any exceptions they throw may propagate down in this manner.
default <L> GraphConfigurator<V,E> addInternalListener(java.util.function.Function<GraphListeners<V,E>,Observable<L>> listenerSet, Observer<L> listener)