Skip to content

Commit 56ae210

Browse files
author
Eduardo Rodrigues
committed
Adding MIT license
Updating Javadoc
1 parent 5d6c488 commit 56ae210

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

src/DependencyGraph.java

+29-5
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,44 @@
2626
import java.util.function.Supplier;
2727
import java.util.stream.Collectors;
2828

29+
/*
30+
* MIT License
31+
* Copyright (c) 2016 Eduardo Ribeiro Rodrigues
32+
*
33+
* Permission is hereby granted, free of charge, to any person obtaining a copy
34+
* of this software and associated documentation files (the "Software"), to deal
35+
* in the Software without restriction, including without limitation the rights
36+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37+
* copies of the Software, and to permit persons to whom the Software is
38+
* furnished to do so, subject to the following conditions:
39+
*
40+
* The above copyright notice and this permission notice shall be included in all
41+
* copies or substantial portions of the Software.
42+
*
43+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
47+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
48+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
49+
* SOFTWARE.
50+
*/
51+
2952
/**
3053
* <p>This class implements a dependency graph using a strongly connected
3154
* Directed Acyclic Graph (DAG) and allows sorting of its nodes in
3255
* topological order.</p>
3356
*
3457
* <p>Some important characteristics of this class are:</p>
35-
* <ol><li>Calling {@link #getTopology} will not destroy the graph:
36-
* the same graph instance can be safely reused after a topological sort operation.</li>
37-
* <li>It can optionally be instantiated to be thread-safe (see {@link #DependencyGraph(boolean)}).</li>
38-
* <li>It is capable of detecting cycles (or circular dependencies paths)
39-
* and for each cycle list all participant nodes (see {@link #findCycles}).</li></ol>
58+
* <ol><li>The graph fully implements the {@link Collection} interface</li>
59+
* <li>Calling {@link #getTopology} will not destroy the graph: the same graph instance can be safely reused after a topological sort operation.</li>
60+
* <li>It can optionally be instantiated to be thread-safe (see {@link #DependencyGraph(boolean)}) adding some overhead due to use of {@link ReentrantReadWriteLock}s</li>
61+
* <li>It is capable of detecting cycles (or circular dependencies paths) and for each cycle list all participant nodes (see {@link #findCycles})</li></ol>
4062
*
4163
* @param <T> The content type for the graph
64+
* @author Eduardo Rodrigues (https://github.com/errodrigues/ez-graph)
4265
*/
66+
//TODO: implement new method iteratePathsBetween(a, b) returning a standard Iterator where each next entry will be a Collection representing one valid path between nodes a and b
4367
public final class DependencyGraph<T> implements Collection<T> {
4468
private static final Predicate<Object> IS_NULL = o -> o == null;
4569

0 commit comments

Comments
 (0)