|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjcommon.graph.DirectedAcyclicGraph<TVertex,TValue,TProcessedValue>
TVertex - Type of IVertex vertices that this graph contains.public class DirectedAcyclicGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>
Factory and implementation of a dependency graph that can topologically sort its vertices.
IGraph| Field Summary |
|---|
| Fields inherited from interface jcommon.graph.IGraph |
|---|
EMPTY_VERTICES |
| Method Summary | ||
|---|---|---|
IGraph<TVertex,TValue,TProcessedValue> |
addEdge(TVertex from,
TVertex to)
Adds a new IEdge instance to this IGraph. |
|
IGraph<TVertex,TValue,TProcessedValue> |
addVertex(TVertex vertex)
Adds a new IVertex instance of TVertex to this IGraph. |
|
static
|
build(TVertex... vertices)
Convenience method for easily constructing an instance of IGraph with the provided vertices. |
|
IGraph<TVertex,TValue,TProcessedValue> |
copy()
More type-safe version of Object.clone(). |
|
static
|
create()
Convenience method for easily constructing an instance of IGraph with an empty set of vertices. |
|
Set<IEdge<TVertex>> |
getEdges()
Retrieves the set of IEdge edges represented by this IGraph. |
|
Set<TVertex> |
getVertices()
Retrieves the set of IVertex vertices of TVertex represented by this IGraph. |
|
IGraph<TVertex,TValue,TProcessedValue> |
removeEdge(TVertex from,
TVertex to)
Removes an existing edge from this IGraph. |
|
IGraph<TVertex,TValue,TProcessedValue> |
removeVertex(TVertex vertex)
Removes an IVertex instance of TVertex from this IGraph. |
|
List<TValue> |
sort()
Provides a topologically sorted list of IVertex vertices. |
|
List<TValue> |
sort(ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy)
Provides a topologically sorted list of IVertex vertices. |
|
ITopologicalSortAsyncResult<TValue,TProcessedValue> |
sortAsync(ExecutorService executor,
ITopologicalSortCallback<TValue,TProcessedValue> callback)
Allows you to asynchronously and in-parallel process the vertices of a graph topologically. |
|
ITopologicalSortAsyncResult<TValue,TProcessedValue> |
sortAsync(ExecutorService executor,
ITopologicalSortCallback<TValue,TProcessedValue> callback,
ITopologicalSortErrorCallback<TValue> errorCallback)
Allows you to asynchronously and in-parallel process the vertices of a graph topologically. |
|
ITopologicalSortAsyncResult<TValue,TProcessedValue> |
sortAsync(ExecutorService executor,
ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy,
ITopologicalSortCallback<TValue,TProcessedValue> callback)
Allows you to asynchronously and in-parallel process the vertices of a graph topologically. |
|
ITopologicalSortAsyncResult<TValue,TProcessedValue> |
sortAsync(ExecutorService executor,
ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy,
ITopologicalSortCallback<TValue,TProcessedValue> callback,
ITopologicalSortErrorCallback<TValue> errorCallback)
Allows you to asynchronously and in-parallel process the vertices of a graph topologically. |
|
ITopologicalSortAsyncResult<TValue,TProcessedValue> |
sortAsync(ITopologicalSortCallback<TValue,TProcessedValue> callback)
Allows you to asynchronously and in-parallel process the vertices of a graph topologically. |
|
ITopologicalSortAsyncResult<TValue,TProcessedValue> |
sortAsync(ITopologicalSortCallback<TValue,TProcessedValue> callback,
ITopologicalSortErrorCallback<TValue> errorCallback)
Allows you to asynchronously and in-parallel process the vertices of a graph topologically. |
|
ITopologicalSortAsyncResult<TValue,TProcessedValue> |
sortAsync(ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy,
ITopologicalSortCallback<TValue,TProcessedValue> callback)
Allows you to asynchronously and in-parallel process the vertices of a graph topologically. |
|
ITopologicalSortAsyncResult<TValue,TProcessedValue> |
sortAsync(ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy,
ITopologicalSortCallback<TValue,TProcessedValue> callback,
ITopologicalSortErrorCallback<TValue> errorCallback)
Allows you to asynchronously and in-parallel process the vertices of a graph topologically. |
|
boolean |
validate()
Does a simple sanity check on the structure of the graph. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public Set<TVertex> getVertices()
IGraphIVertex vertices of TVertex represented by this IGraph.
getVertices in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>IVertex vertices of TVertex represented by this IGraph.IGraph.getVertices()public Set<IEdge<TVertex>> getEdges()
IGraphIEdge edges represented by this IGraph.
getEdges in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>IEdge edges represented by this IGraph.IGraph.getEdges()public IGraph<TVertex,TValue,TProcessedValue> copy()
IGraphObject.clone().
copy in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>IGraph.IGraph.copy()public static <TVertex extends IVertex<TValue>,TValue,TProcessedValue> IGraph<TVertex,TValue,TProcessedValue> build(TVertex... vertices)
IGraph with the provided vertices.
TVertex - Type of IVertex of the vertices in the new IGraph.vertices - A list of IVertex vertices to be added to a new IGraph.
IGraph with the provided vertices already added.public static <TVertex extends IVertex<TValue>,TValue,TProcessedValue> IGraph<TVertex,TValue,TProcessedValue> create()
IGraph with an empty set of vertices.
TVertex - Type of IVertex of the vertices in the new IGraph.
IGraph with an empty set of vertices.public IGraph<TVertex,TValue,TProcessedValue> addVertex(TVertex vertex)
IGraphIVertex instance of TVertex to this IGraph.
addVertex in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>vertex - The instance of IVertex of TVertex to add to this IGraph.
IGraph for use in a builder-style pattern.IGraph.addVertex(IVertex)public IGraph<TVertex,TValue,TProcessedValue> removeVertex(TVertex vertex)
IGraphIVertex instance of TVertex from this IGraph.
removeVertex in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>vertex - The instance of IVertex of TVertex to remove from this IGraph.
IGraph for use in a builder-style pattern.IGraph.removeVertex(IVertex)
public IGraph<TVertex,TValue,TProcessedValue> addEdge(TVertex from,
TVertex to)
IGraphIEdge instance to this IGraph.
addEdge in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>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.addEdge(IVertex, IVertex)
public IGraph<TVertex,TValue,TProcessedValue> removeEdge(TVertex from,
TVertex to)
IGraphIGraph.
removeEdge in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>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.removeEdge(IVertex, IVertex)public boolean validate()
IGraph
validate in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>true if the graph passes a simple sanity check; false otherwise.IGraph.validate()
public List<TValue> sort()
throws CyclicGraphException
IGraphIVertex vertices.
sort in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>IVertex vertices in the current graph.
CyclicGraphException - A CyclicGraphException is thrown if a cycle is detected during the sort.IGraph.sort()
public List<TValue> sort(ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy)
throws CyclicGraphException
IGraphIVertex vertices.
It's strongly recommended that you use IGraph.sort() in most cases unless you require an alternative approach to
the topological sorting algorithm.
sort in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>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.IGraph.sort(ITopologicalSortStrategy)public ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ITopologicalSortCallback<TValue,TProcessedValue> callback)
IGraph
sortAsync in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>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.IGraph.sortAsync(ITopologicalSortCallback)
public ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ITopologicalSortCallback<TValue,TProcessedValue> callback,
ITopologicalSortErrorCallback<TValue> errorCallback)
IGraph
sortAsync in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>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.IGraph.sortAsync(ITopologicalSortCallback, ITopologicalSortErrorCallback)
public ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy,
ITopologicalSortCallback<TValue,TProcessedValue> callback)
IGraphIGraph.sortAsync(ITopologicalSortCallback) in most cases unless you
require an alternative approach to the topological sorting algorithm.
sortAsync in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>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.IGraph.sortAsync(ITopologicalSortStrategy, ITopologicalSortCallback)
public ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy,
ITopologicalSortCallback<TValue,TProcessedValue> callback,
ITopologicalSortErrorCallback<TValue> errorCallback)
IGraphIGraph.sortAsync(ITopologicalSortCallback, ITopologicalSortErrorCallback)
in most cases unless you require an alternative approach to the topological sorting algorithm.
sortAsync in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>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.IGraph.sortAsync(ITopologicalSortStrategy, ITopologicalSortCallback, ITopologicalSortErrorCallback)
public ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ExecutorService executor,
ITopologicalSortCallback<TValue,TProcessedValue> callback)
IGraph
sortAsync in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>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.IGraph.sortAsync(java.util.concurrent.ExecutorService, ITopologicalSortCallback)
public ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ExecutorService executor,
ITopologicalSortCallback<TValue,TProcessedValue> callback,
ITopologicalSortErrorCallback<TValue> errorCallback)
IGraph
sortAsync in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>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.IGraph.sortAsync(java.util.concurrent.ExecutorService, ITopologicalSortCallback, ITopologicalSortErrorCallback)
public ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ExecutorService executor,
ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy,
ITopologicalSortCallback<TValue,TProcessedValue> callback)
IGraphIGraph.sortAsync(java.util.concurrent.ExecutorService, ITopologicalSortCallback)
in most cases unless you require an alternative approach to the topological sorting algorithm.
sortAsync in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>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.IGraph.sortAsync(java.util.concurrent.ExecutorService, ITopologicalSortStrategy, ITopologicalSortCallback)
public ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ExecutorService executor,
ITopologicalSortStrategy<TVertex,TValue,TProcessedValue> strategy,
ITopologicalSortCallback<TValue,TProcessedValue> callback,
ITopologicalSortErrorCallback<TValue> errorCallback)
IGraphIGraph.sortAsync(java.util.concurrent.ExecutorService, ITopologicalSortCallback, ITopologicalSortErrorCallback)
in most cases unless you require an alternative approach to the topological sorting algorithm.
sortAsync in interface IGraph<TVertex extends IVertex<TValue>,TValue,TProcessedValue>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.IGraph.sortAsync(java.util.concurrent.ExecutorService, ITopologicalSortStrategy, ITopologicalSortCallback, ITopologicalSortErrorCallback)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||