Class GraphAnalyzer
- java.lang.Object
-
- org.mapstruct.ap.internal.model.dependency.GraphAnalyzer
-
public class GraphAnalyzer extends Object
Analyzes graphs: Discovers all descendants of given nodes and detects cyclic dependencies between nodes if present.- Author:
- Gunnar Morling
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GraphAnalyzer.GraphAnalyzerBuilder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GraphAnalyzer.GraphAnalyzerBuilder
builder()
Set<List<String>>
getCycles()
int
getTraversalSequence(String name)
Returns the traversal sequence number of the given node.static GraphAnalyzer.GraphAnalyzerBuilder
withNode(String name, String... descendants)
-
-
-
Method Detail
-
builder
public static GraphAnalyzer.GraphAnalyzerBuilder builder()
-
withNode
public static GraphAnalyzer.GraphAnalyzerBuilder withNode(String name, String... descendants)
-
getTraversalSequence
public int getTraversalSequence(String name)
Returns the traversal sequence number of the given node. The ascending order of the traversal sequence numbers of multiple nodes represents the depth-first traversal order of those nodes.Note: The traversal sequence numbers will only be complete if the graph contains no cycles.
- Parameters:
name
- the node name to get the traversal sequence number for- Returns:
- the traversal sequence number, or
-1
if the node doesn't exist or the node was not visited (in case of cycles).
-
-