Author: rickhall Date: Fri Nov 13 16:41:46 2009 New Revision: 835909 URL: http://svn.apache.org/viewvc?rev=835909&view=rev Log: Removed unnecessary loop.
Modified:
felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
Modified:
felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
URL:
http://svn.apache.org/viewvc/felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java?rev=835909&r1=835908&r2=835909&view=diff
==============================================================================
---
felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
(original)
+++
felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
Fri Nov 13 16:41:46 2009
@@ -132,110 +132,106 @@
boolean repeat;
do
{
- do
- {
- repeat = false;
+ repeat = false;
- // Loop through all of the target module's imports
and v
- for (int impIdx = 0; impIdx < imports.size();
impIdx++)
+ // Loop through all of the target module's imports and
v
+ for (int impIdx = 0; impIdx < imports.size(); impIdx++)
+ {
+ // Get the current candidate for the import.
+ List<Module> exporters =
candidateMap.get(imports.get(impIdx));
+ // If the current candidate is already resolved,
then try
+ // to merge packages while verifying constraints.
+ if (exporters.get(0).isResolved())
{
- // Get the current candidate for the import.
- List<Module> exporters =
candidateMap.get(imports.get(impIdx));
- // If the current candidate is already
resolved, then try
- // to merge packages while verifying
constraints.
- if (exporters.get(0).isResolved())
+ // HERE WE WILL NEED TO TRY TO MERGE THE
CANDIDATE.
+ }
+ // If the current candidate is not resolved, then
try to resolve
+ // it, which will also merge packages while verify
constraints.
+ else if (!exporters.get(0).isResolved())
+ {
+ try
{
- // HERE WE WILL NEED TO TRY TO MERGE THE
CANDIDATE.
+ resolve(
+ exporters.get(0),
+ imports.get(impIdx),
+ module,
+ candidateMap,
+ currentConstraints,
+ cycleMap);
}
- // If the current candidate is not resolved,
then try to resolve
- // it, which will also merge packages while
verify constraints.
- else if (!exporters.get(0).isResolved())
+ // If we have a constraint conflict, then the
current candidate
+ // should be removed, since it conflicts with
an existing choice.
+ // If we are at the root, we should try the
next permutated
+ // candidate map if possible.
+ catch (ResolverConflictException ex)
{
- try
- {
- resolve(
- exporters.get(0),
- imports.get(impIdx),
- module,
- candidateMap,
- currentConstraints,
- cycleMap);
- }
- // If we have a constraint conflict, then
the current candidate
- // should be removed, since it conflicts
with an existing choice.
- // If we are at the root, we should try
the next permutated
- // candidate map if possible.
- catch (ResolverConflictException ex)
- {
//System.out.println("RCE " + ex);
//System.out.println("Current candidate map : " + candidateMap);
- // Remove offending candidate.
- exporters.remove(0);
+ // Remove offending candidate.
+ exporters.remove(0);
//System.out.println("Updated candidate map : " + candidateMap);
- if (exporters.size() == 0)
+ if (exporters.size() == 0)
+ {
+ // TODO: PROTO RESOLVER - Maybe this
should be moved.
+ if ((module == m_rootModule) &&
(m_candidatePermutations.size() > 0))
{
- // TODO: PROTO RESOLVER - Maybe
this should be moved.
- if ((module == m_rootModule) &&
(m_candidatePermutations.size() > 0))
- {
- currentConstraints.clear();
-
currentConstraints.putAll(currentConstraintsOrig);
- candidateMap =
m_candidatePermutations.remove(0);
+ currentConstraints.clear();
+
currentConstraints.putAll(currentConstraintsOrig);
+ candidateMap =
m_candidatePermutations.remove(0);
System.out.println("+++ TRYING ALTERNATIVE: " + candidateMap);
- repeat = true;
- }
- else
- {
-
candidateMap.remove(imports.get(impIdx));
- throw new
ResolveException("Unresolved constraint "
- + imports.get(impIdx)
- + " in " + module);
- }
+ repeat = true;
}
else
{
- repeat = true;
+
candidateMap.remove(imports.get(impIdx));
+ throw new
ResolveException("Unresolved constraint "
+ + imports.get(impIdx)
+ + " in " + module);
}
- break;
}
- // If we cannot resolve the candidate,
then the current candidate
- // should be removed. If we are at the
root, we should try the
- // next permutated candidate map if
possible.
- catch (ResolveException ex)
+ else
{
+ repeat = true;
+ }
+ break;
+ }
+ // If we cannot resolve the candidate, then
the current candidate
+ // should be removed. If we are at the root,
we should try the
+ // next permutated candidate map if possible.
+ catch (ResolveException ex)
+ {
System.out.println("RE " + ex);
//System.out.println("Current candidate map : " + candidateMap);
- // Remove offending candidate.
- exporters.remove(0);
+ // Remove offending candidate.
+ exporters.remove(0);
//System.out.println("Updated candidate map : " + candidateMap);
- if (exporters.size() == 0)
+ if (exporters.size() == 0)
+ {
+ // TODO: PROTO RESOLVER - Maybe this
should be moved.
+ if ((module == m_rootModule) &&
(m_candidatePermutations.size() > 0))
{
- // TODO: PROTO RESOLVER - Maybe
this should be moved.
- if ((module == m_rootModule) &&
(m_candidatePermutations.size() > 0))
- {
- currentConstraints.clear();
-
currentConstraints.putAll(currentConstraintsOrig);
- candidateMap =
m_candidatePermutations.remove(0);
+ currentConstraints.clear();
+
currentConstraints.putAll(currentConstraintsOrig);
+ candidateMap =
m_candidatePermutations.remove(0);
System.out.println("+++ TRYING ALTERNATIVE: " + candidateMap);
- repeat = true;
- }
- else
- {
-
candidateMap.remove(imports.get(impIdx));
- throw new
ResolveException("Unresolved constraint "
- + imports.get(impIdx)
- + " in " + module);
- }
+ repeat = true;
}
else
{
- repeat = true;
+
candidateMap.remove(imports.get(impIdx));
+ throw new
ResolveException("Unresolved constraint "
+ + imports.get(impIdx)
+ + " in " + module);
}
- break;
}
+ else
+ {
+ repeat = true;
+ }
+ break;
}
}
}
- while (repeat);
}
while (repeat);
