public final class ConflictIdSorter extends java.lang.Object implements DependencyGraphTransformer
TransformationContextKeys.CONFLICT_IDS
in the transformation context for an
existing mapping of nodes to their conflicts ids. In absence of this map, the transformer will automatically invoke
the ConflictMarker
to calculate the conflict ids. When this transformer has executed, the transformation
context holds a List<Object>
that denotes the topologically sorted conflict ids. The list will be stored
using the key TransformationContextKeys.SORTED_CONFLICT_IDS
. In addition, the transformer will store a
Collection<Collection<Object>>
using the key TransformationContextKeys.CYCLIC_CONFLICT_IDS
that
describes cycles among conflict ids.Modifier and Type | Class and Description |
---|---|
(package private) static class |
ConflictIdSorter.ConflictId |
(package private) static class |
ConflictIdSorter.RootQueue |
Constructor and Description |
---|
ConflictIdSorter() |
Modifier and Type | Method and Description |
---|---|
private void |
buildConflitIdDAG(java.util.Map<java.lang.Object,ConflictIdSorter.ConflictId> ids,
DependencyNode node,
ConflictIdSorter.ConflictId id,
int depth,
java.util.Map<DependencyNode,java.lang.Object> visited,
java.util.Map<?,?> conflictIds) |
private java.util.Collection<java.util.Collection<java.lang.Object>> |
findCycles(java.util.Collection<ConflictIdSorter.ConflictId> conflictIds) |
private void |
findCycles(ConflictIdSorter.ConflictId id,
java.util.Map<ConflictIdSorter.ConflictId,java.lang.Object> visited,
java.util.Map<java.lang.Object,java.lang.Integer> stack,
java.util.Collection<java.util.Collection<java.lang.Object>> cycles) |
private void |
processRoots(java.util.List<java.lang.Object> sorted,
ConflictIdSorter.RootQueue roots) |
private int |
topsortConflictIds(java.util.Collection<ConflictIdSorter.ConflictId> conflictIds,
DependencyGraphTransformationContext context) |
DependencyNode |
transformGraph(DependencyNode node,
DependencyGraphTransformationContext context)
Transforms the dependency graph denoted by the specified root node.
|
public DependencyNode transformGraph(DependencyNode node, DependencyGraphTransformationContext context) throws RepositoryException
DependencyGraphTransformer
transformGraph
in interface DependencyGraphTransformer
node
- The root node of the (possibly cyclic!) graph to transform, must not be null
.context
- The graph transformation context, must not be null
.null
.RepositoryException
- If the transformation failed.private void buildConflitIdDAG(java.util.Map<java.lang.Object,ConflictIdSorter.ConflictId> ids, DependencyNode node, ConflictIdSorter.ConflictId id, int depth, java.util.Map<DependencyNode,java.lang.Object> visited, java.util.Map<?,?> conflictIds)
private int topsortConflictIds(java.util.Collection<ConflictIdSorter.ConflictId> conflictIds, DependencyGraphTransformationContext context)
private void processRoots(java.util.List<java.lang.Object> sorted, ConflictIdSorter.RootQueue roots)
private java.util.Collection<java.util.Collection<java.lang.Object>> findCycles(java.util.Collection<ConflictIdSorter.ConflictId> conflictIds)
private void findCycles(ConflictIdSorter.ConflictId id, java.util.Map<ConflictIdSorter.ConflictId,java.lang.Object> visited, java.util.Map<java.lang.Object,java.lang.Integer> stack, java.util.Collection<java.util.Collection<java.lang.Object>> cycles)