Class PackageDependencyCycle
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<PackageDependency>
nl.talsmasoftware.umldoclet.javadoc.dependencies.PackageDependencyCycle
- All Implemented Interfaces:
Iterable<PackageDependency>,Collection<PackageDependency>,List<PackageDependency>,RandomAccess
A cycle of dependencies.
Package Dependencies can form a cycle if the chain of package dependencies somehow 'return' to the
initial package. For example if you have three packages a, b and c and the following
dependencies: a -> b, b -> c, they will form a cycle if you somehow create a dependency back to
a, e.g. b -> a or c -> a.
- Author:
- Sjoerd Talsma
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionPackageDependencyCycle(PackageDependency... dependencies) Create a new dependency cycle object. -
Method Summary
Modifier and TypeMethodDescriptionstatic Set<PackageDependencyCycle>detectCycles(Iterable<PackageDependency> dependencies) Detect cycles in a collection of dependencies.get(int index) intsize()toString()Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, streamMethods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Constructor Details
-
PackageDependencyCycle
Create a new dependency cycle object.This constructor validates that the specified package dependencies actually form a cycle and will throw an
IllegalArgumentExceptionif they do not form an actual cycle.- Parameters:
dependencies- The package dependencies that form a cycle.
-
-
Method Details
-
detectCycles
Detect cycles in a collection of dependencies.First the collection of dependencies is converted to a list of dependency chains. Next, the dependency chains are selected from all chains and returned as a new set.
- Parameters:
dependencies- The package dependencies to detect dependency cycles from.- Returns:
- A set with all found dependency cycles.
-
get
- Specified by:
getin interfaceList<PackageDependency>- Specified by:
getin classAbstractList<PackageDependency>
-
size
public int size()- Specified by:
sizein interfaceCollection<PackageDependency>- Specified by:
sizein interfaceList<PackageDependency>- Specified by:
sizein classAbstractCollection<PackageDependency>
-
toString
- Overrides:
toStringin classAbstractCollection<PackageDependency>
-