|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
TVertex - Type of IVertex that vertices in this graph are.TValue - Type of Object that the vertices in this graph contain.public interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>
This is a simple graph holding IVertex vertices and IEdge edges connecting them.
It is intended to be used in a builder-style pattern and then operations such as sort() may be called
on the graph.
Of particular note is the sortAsync(ITopologicalSortCallback) method which allows you to asynchronously and
in-parallel process the vertices of a graph topologically. Care is taken to prevent the processing of vertices before
their parent vertices have completed processing.
| Field Summary | |
|---|---|
static IVertex[] |
EMPTY_VERTICES
Reference for an array of empty vertices that can be reused instead of having to allocate a new empty array on the heap every time. |
| Field Detail |
|---|
static final IVertex[] EMPTY_VERTICES
| Method Detail |
|---|
Set<TVertex> getVertices()
IVertex vertices of TVertex represented by this IGraph.
IVertex vertices of TVertex represented by this IGraph.Set<IEdge<TVertex>> getEdges()
IEdge edges represented by this IGraph.
IEdge edges represented by this IGraph.IGraph<TVertex,TValue,TProcessedValue> copy()
Object.clone().
IGraph.IGraph<TVertex,TValue,TProcessedValue> addVertex(TVertex vertex)
IVertex instance of TVertex to this IGraph.
vertex - The instance of IVertex of TVertex to add to this IGraph.
IGraph for use in a builder-style pattern.IGraph<TVertex,TValue,TProcessedValue> removeVertex(TVertex vertex)
IVertex instance of TVertex from this IGraph.
vertex - The instance of IVertex of TVertex to remove from this IGraph.
IGraph for use in a builder-style pattern.
IGraph<TVertex,TValue,TProcessedValue> addEdge(TVertex from,
TVertex to)
IEdge instance to this IGraph.
from - An instance of IVertex of TVertex that begins the edge.to - An instance of IVertex of TVertex that the edge is pointing to.
IGraph for use in a builder-style pattern.
IGraph<TVertex,TValue,TProcessedValue> removeEdge(TVertex from,
TVertex to)
IGraph.
from - An instance of IVertex of TVertex that begins the edge.to - An instance of IVertex of TVertex that the edge is pointing to.
IGraph for use in a builder-style pattern.boolean validate()
true if the graph passes a simple sanity check; false otherwise.
List<TValue> sort()
throws CyclicGraphException
IVertex vertices.
IVertex vertices in the current graph.
CyclicGraphException - A CyclicGraphException is thrown if a cycle is detected during the sort.
List<TValue> sort(ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy)
throws CyclicGraphException
IVertex vertices.
It's strongly recommended that you use sort() in most cases unless you require an alternative approach to
the topological sorting algorithm.
strategy - An instance of ITopologicalSortStrategy that will perform the sort.
IVertex vertices in the current graph.
CyclicGraphException - A CyclicGraphException is thrown if a cycle is detected during the sort.ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ITopologicalSortCallback<TValue,TProcessedValue> callback)
callback - An instance of ITopologicalSortCallback that will be called to process each vertex.
This may be called concurrently depending on the makeup of the graph.
ITopologicalSortAsyncResult that allows the caller to coordinate the
asynchronous processing of the graph.
ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ITopologicalSortCallback<TValue,TProcessedValue> callback,
ITopologicalSortErrorCallback<TValue> errorCallback)
callback - An instance of ITopologicalSortCallback that will be called to process each vertex.
This may be called concurrently depending on the makeup of the graph.errorCallback - An instance of ITopologicalSortErrorCallback that will be called if an error during
processing occurs either in the
ITopologicalSortCallback.handle(Object, ITopologicalSortInput, IVertex, ITopologicalSortCoordinator) method or in the
ITopologicalSortStrategy.sortAsync(java.util.concurrent.ExecutorService, IAdjacencyList, ITopologicalSortCallback, ITopologicalSortErrorCallback)
method.
ITopologicalSortAsyncResult that allows the caller to coordinate the
asynchronous processing of the graph.
ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy,
ITopologicalSortCallback<TValue,TProcessedValue> callback)
sortAsync(ITopologicalSortCallback) in most cases unless you
require an alternative approach to the topological sorting algorithm.
strategy - An instance of ITopologicalSortStrategy that will perform the sort.callback - An instance of ITopologicalSortCallback that will be called to process each vertex.
This may be called concurrently depending on the makeup of the graph.
ITopologicalSortAsyncResult that allows the caller to coordinate the
asynchronous processing of the graph.
ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy,
ITopologicalSortCallback<TValue,TProcessedValue> callback,
ITopologicalSortErrorCallback<TValue> errorCallback)
sortAsync(ITopologicalSortCallback, ITopologicalSortErrorCallback)
in most cases unless you require an alternative approach to the topological sorting algorithm.
strategy - An instance of ITopologicalSortStrategy that will perform the sort.callback - An instance of ITopologicalSortCallback that will be called to process each vertex.
This may be called concurrently depending on the makeup of the graph.errorCallback - An instance of ITopologicalSortErrorCallback that will be called if an error during
processing occurs either in the
ITopologicalSortCallback.handle(Object, ITopologicalSortInput, IVertex, ITopologicalSortCoordinator) method or in the
ITopologicalSortStrategy.sortAsync(java.util.concurrent.ExecutorService, IAdjacencyList, ITopologicalSortCallback, ITopologicalSortErrorCallback)
method.
ITopologicalSortAsyncResult that allows the caller to coordinate the
asynchronous processing of the graph.
ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ExecutorService executor,
ITopologicalSortCallback<TValue,TProcessedValue> callback)
executor - An instance of ExecutorService that will be used to submit tasks for processing vertices.callback - An instance of ITopologicalSortCallback that will be called to process each vertex.
This may be called concurrently depending on the makeup of the graph.
ITopologicalSortAsyncResult that allows the caller to coordinate the
asynchronous processing of the graph.
ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ExecutorService executor,
ITopologicalSortCallback<TValue,TProcessedValue> callback,
ITopologicalSortErrorCallback<TValue> errorCallback)
executor - An instance of ExecutorService that will be used to submit tasks for processing
vertices.callback - An instance of ITopologicalSortCallback that will be called to process each vertex.
This may be called concurrently depending on the makeup of the graph.errorCallback - An instance of ITopologicalSortErrorCallback that will be called if an error during
processing occurs either in the
ITopologicalSortCallback.handle(Object, ITopologicalSortInput, IVertex, ITopologicalSortCoordinator) method or in the
ITopologicalSortStrategy.sortAsync(java.util.concurrent.ExecutorService, IAdjacencyList, ITopologicalSortCallback, ITopologicalSortErrorCallback)
method.
ITopologicalSortAsyncResult that allows the caller to coordinate the
asynchronous processing of the graph.
ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ExecutorService executor,
ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy,
ITopologicalSortCallback<TValue,TProcessedValue> callback)
sortAsync(java.util.concurrent.ExecutorService, ITopologicalSortCallback)
in most cases unless you require an alternative approach to the topological sorting algorithm.
executor - An instance of ExecutorService that will be used to submit tasks for processing
vertices.strategy - An instance of ITopologicalSortStrategy that will perform the sort.callback - An instance of ITopologicalSortCallback that will be called to process each vertex.
This may be called concurrently depending on the makeup of the graph.
ITopologicalSortAsyncResult that allows the caller to coordinate the
asynchronous processing of the graph.
ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ExecutorService executor,
ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy,
ITopologicalSortCallback<TValue,TProcessedValue> callback,
ITopologicalSortErrorCallback<TValue> errorCallback)
sortAsync(java.util.concurrent.ExecutorService, ITopologicalSortCallback, ITopologicalSortErrorCallback)
in most cases unless you require an alternative approach to the topological sorting algorithm.
executor - An instance of ExecutorService that will be used to submit tasks for processing
vertices.strategy - An instance of ITopologicalSortStrategy that will perform the sort.callback - An instance of ITopologicalSortCallback that will be called to process each vertex.
This may be called concurrently depending on the makeup of the graph.errorCallback - An instance of ITopologicalSortErrorCallback that will be called if an error during
processing occurs either in the
ITopologicalSortCallback.handle(Object, ITopologicalSortInput, IVertex, ITopologicalSortCoordinator) method or in the
ITopologicalSortStrategy.sortAsync(java.util.concurrent.ExecutorService, IAdjacencyList, ITopologicalSortCallback, ITopologicalSortErrorCallback)
method.
ITopologicalSortAsyncResult that allows the caller to coordinate the
asynchronous processing of the graph.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||