Class DefaultDependencyCycle
- java.lang.Object
-
- org.eclipse.aether.internal.impl.collect.DefaultDependencyCycle
-
- All Implemented Interfaces:
DependencyCycle
public final class DefaultDependencyCycle extends java.lang.Object implements DependencyCycle
Default implementation ofDependencyCycle
. Internal helper class for collector implementations.
-
-
Field Summary
Fields Modifier and Type Field Description private int
cycleEntry
private java.util.List<Dependency>
dependencies
-
Constructor Summary
Constructors Constructor Description DefaultDependencyCycle(java.util.List<DependencyNode> nodes, int cycleEntry, Dependency dependency)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
find(java.util.List<DependencyNode> nodes, Artifact artifact)
Searches for a node associated with the given artifact.java.util.List<Dependency>
getCyclicDependencies()
Gets the dependencies that actually form the cycle.java.util.List<Dependency>
getPrecedingDependencies()
Gets the dependencies that lead to the first dependency on the cycle, starting from the root of the dependency graph.java.lang.String
toString()
-
-
-
Field Detail
-
dependencies
private final java.util.List<Dependency> dependencies
-
cycleEntry
private final int cycleEntry
-
-
Constructor Detail
-
DefaultDependencyCycle
public DefaultDependencyCycle(java.util.List<DependencyNode> nodes, int cycleEntry, Dependency dependency)
-
-
Method Detail
-
getPrecedingDependencies
public java.util.List<Dependency> getPrecedingDependencies()
Description copied from interface:DependencyCycle
Gets the dependencies that lead to the first dependency on the cycle, starting from the root of the dependency graph.- Specified by:
getPrecedingDependencies
in interfaceDependencyCycle
- Returns:
- The (read-only) sequence of dependencies that precedes the cycle in the graph, potentially empty but
never
null
.
-
getCyclicDependencies
public java.util.List<Dependency> getCyclicDependencies()
Description copied from interface:DependencyCycle
Gets the dependencies that actually form the cycle. For example, a -> b -> c -> a, i.e. the last dependency in this sequence duplicates the first element and closes the cycle. Hence the length of the cycle is the size of the returned sequence minus 1.- Specified by:
getCyclicDependencies
in interfaceDependencyCycle
- Returns:
- The (read-only) sequence of dependencies that forms the cycle, never
null
.
-
find
public static int find(java.util.List<DependencyNode> nodes, Artifact artifact)
Searches for a node associated with the given artifact. A version of the artifact is not considered during the search.- Parameters:
nodes
- a list representing single path in the dependency graph. First element is the root.artifact
- to find among the parent nodes.- Returns:
- the index of the node furthest from the root and associated with the given artifact, or -1 if there is no such node.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-