Author: gnodet
Date: Mon Jul 13 15:19:50 2015
New Revision: 1690733
URL: http://svn.apache.org/r1690733
Log:
[FELIX-4942] Use depth-first search
Modified:
felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java
Modified:
felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java?rev=1690733&r1=1690732&r2=1690733&view=diff
==============================================================================
---
felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java
(original)
+++
felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java
Mon Jul 13 15:19:50 2015
@@ -211,6 +211,8 @@ public class ResolverImpl implements Res
// Holds candidate permutations based on permutating
requirement candidates.
// These permutations represent backtracking on previous
decisions.
List<Candidates> importPermutations = new
ArrayList<Candidates>();
+ // Holds candidate permutations based on substituted packages
+ List<Candidates> substPermutations = new
ArrayList<Candidates>();
// Record the initial candidate permutation.
usesPermutations.add(allCandidates);
@@ -241,6 +243,10 @@ public class ResolverImpl implements Res
{
allCandidates = importPermutations.remove(0);
}
+ else if (!substPermutations.isEmpty())
+ {
+ allCandidates = substPermutations.remove(0);
+ }
else
{
break;
@@ -261,7 +267,7 @@ public class ResolverImpl implements Res
//allCandidates.dump();
- rethrow =
allCandidates.checkSubstitutes(importPermutations);
+ rethrow =
allCandidates.checkSubstitutes(substPermutations);
if (rethrow != null)
{
continue;
@@ -290,16 +296,23 @@ public class ResolverImpl implements Res
}
Map<Resource, ResolutionError> currentFaultyResources =
new HashMap<Resource, ResolutionError>();
+
+ List<Candidates> newUses = new ArrayList<Candidates>();
+ List<Candidates> newImports = new ArrayList<Candidates>();
+
rethrow = checkConsistency(
executor,
session,
- usesPermutations,
- importPermutations,
+ newUses,
+ newImports,
allCandidates,
currentFaultyResources,
hosts,
false);
+ usesPermutations.addAll(0, newUses);
+ importPermutations.addAll(0, newImports);
+
if (!currentFaultyResources.isEmpty())
{
if (faultyResources == null)