Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.director/src')
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/ProfileChangeRequest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/UserDefinedOptimizationFunction.java32
4 files changed, 33 insertions, 34 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/ProfileChangeRequest.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/ProfileChangeRequest.java
index 3bf49a105..8b4c33b22 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/ProfileChangeRequest.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/ProfileChangeRequest.java
@@ -222,7 +222,7 @@ public class ProfileChangeRequest implements Cloneable, IProfileChangeRequest {
@Override
public String toString() {
- StringBuffer result = new StringBuffer(1000);
+ StringBuilder result = new StringBuilder(1000);
result.append("==Profile change request for "); //$NON-NLS-1$
result.append(profile.getProfileId());
result.append('\n');
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
index b52d41216..978debf7f 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
@@ -526,29 +526,28 @@ public class Projector {
// noop(IU)-> ~ABS
// IU -> (noop(IU) or ABS)
// Therefore we only need one optional requirement statement per IU
- for (int i = 0; i < reqs.length; i++) {
+ for (IRequirement[] requirement : reqs) {
//The requirement is unchanged
- if (reqs[i][0] == reqs[i][1]) {
- if (reqs[i][0].getMax() == 0) {
- expandNegatedRequirement(reqs[i][0], iu, optionalAbstractRequirements, isRootIu);
+ if (requirement[0] == requirement[1]) {
+ if (requirement[0].getMax() == 0) {
+ expandNegatedRequirement(requirement[0], iu, optionalAbstractRequirements, isRootIu);
return;
}
- if (!isApplicable(reqs[i][0]))
+ if (!isApplicable(requirement[0])) {
continue;
-
- List<IInstallableUnitPatch> patchesAppliedElseWhere = unchangedRequirements.get(reqs[i][0]);
+ }
+ List<IInstallableUnitPatch> patchesAppliedElseWhere = unchangedRequirements.get(requirement[0]);
if (patchesAppliedElseWhere == null) {
patchesAppliedElseWhere = new ArrayList<>();
- unchangedRequirements.put(reqs[i][0], patchesAppliedElseWhere);
+ unchangedRequirements.put(requirement[0], patchesAppliedElseWhere);
}
patchesAppliedElseWhere.add(patch);
continue;
}
-
//Generate dependency when the patch is applied
//P1 -> (A -> D) equiv. (P1 & A) -> D
- if (isApplicable(reqs[i][1])) {
- IRequirement req = reqs[i][1];
+ if (isApplicable(requirement[1])) {
+ IRequirement req = requirement[1];
List<IInstallableUnit> matches = getApplicableMatches(req);
determinePotentialHostsForFragment(iu);
if (req.getMin() > 0) {
@@ -606,9 +605,8 @@ public class Projector {
}
//Generate dependency when the patch is not applied
//-P1 -> (A -> B) ( equiv. A -> (P1 or B) )
- if (isApplicable(reqs[i][0])) {
- IRequirement req = reqs[i][0];
-
+ if (isApplicable(requirement[0])) {
+ IRequirement req = requirement[0];
// Fix: if multiple patches apply to the same IU-req, we need to make sure we list each
// patch as an optional match
Pending pending = nonPatchedRequirements.get(req);
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java
index 8453e9121..8de45dcbb 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java
@@ -104,9 +104,10 @@ public class Slicer {
//This is a shortcut to simplify the error reporting when the filter of the ius we are being asked to install does not pass
private void validateInput(IInstallableUnit[] ius) {
- for (int i = 0; i < ius.length; i++) {
- if (!isApplicable(ius[i]))
- throw new IllegalStateException(NLS.bind(Messages.Explanation_missingRootFilter, ius[i]));
+ for (IInstallableUnit iu : ius) {
+ if (!isApplicable(iu)) {
+ throw new IllegalStateException(NLS.bind(Messages.Explanation_missingRootFilter, iu));
+ }
}
}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/UserDefinedOptimizationFunction.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/UserDefinedOptimizationFunction.java
index 83f506e54..4f699cf25 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/UserDefinedOptimizationFunction.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/UserDefinedOptimizationFunction.java
@@ -9,7 +9,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
+ * Contributors:
* Daniel Le Berre - initial API and implementation
* Red Hat, Inc. - support for remediation page
******************************************************************************/
@@ -41,32 +41,32 @@ public class UserDefinedOptimizationFunction extends OptimizationFunction {
List<WeightedObject<?>> weightedObjects = new ArrayList<>();
List<Object> objects = new ArrayList<>();
BigInteger weight = BigInteger.valueOf(slice.size() + 1);
- String[] criteria = new String[] {"+new", "-notuptodate", "-changed", "-removed"}; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
- BigInteger currentWeight = weight.pow(criteria.length - 1);
+ String[] criterias = new String[] {"+new", "-notuptodate", "-changed", "-removed"}; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
+ BigInteger currentWeight = weight.pow(criterias.length - 1);
boolean maximizes;
Object thing;
- for (int i = 0; i < criteria.length; i++) {
- if (criteria[i].endsWith("new")) { //$NON-NLS-1$
+ for (String criteria : criterias) {
+ if (criteria.endsWith("new")) { //$NON-NLS-1$
weightedObjects.clear();
- newRoots(weightedObjects, criteria[i].startsWith("+") ? currentWeight.negate() : currentWeight, metaIu); //$NON-NLS-1$
+ newRoots(weightedObjects, criteria.startsWith("+") ? currentWeight.negate() : currentWeight, metaIu); //$NON-NLS-1$
currentWeight = currentWeight.divide(weight);
- } else if (criteria[i].endsWith("removed")) { //$NON-NLS-1$
+ } else if (criteria.endsWith("removed")) { //$NON-NLS-1$
weightedObjects.clear();
- removedRoots(weightedObjects, criteria[i].startsWith("+") ? currentWeight.negate() : currentWeight, metaIu); //$NON-NLS-1$
+ removedRoots(weightedObjects, criteria.startsWith("+") ? currentWeight.negate() : currentWeight, metaIu); //$NON-NLS-1$
currentWeight = currentWeight.divide(weight);
- } else if (criteria[i].endsWith("notuptodate")) { //$NON-NLS-1$
+ } else if (criteria.endsWith("notuptodate")) { //$NON-NLS-1$
weightedObjects.clear();
- notuptodate(weightedObjects, criteria[i].startsWith("+") ? currentWeight.negate() : currentWeight, metaIu); //$NON-NLS-1$
+ notuptodate(weightedObjects, criteria.startsWith("+") ? currentWeight.negate() : currentWeight, metaIu); //$NON-NLS-1$
currentWeight = currentWeight.divide(weight);
- } else if (criteria[i].endsWith("changed")) { //$NON-NLS-1$
+ } else if (criteria.endsWith("changed")) { //$NON-NLS-1$
weightedObjects.clear();
- changedRoots(weightedObjects, criteria[i].startsWith("+") ? currentWeight.negate() : currentWeight, metaIu); //$NON-NLS-1$
+ changedRoots(weightedObjects, criteria.startsWith("+") ? currentWeight.negate() : currentWeight, metaIu); //$NON-NLS-1$
currentWeight = currentWeight.divide(weight);
}
objects.clear();
- maximizes = criteria[i].startsWith("+"); //$NON-NLS-1$
- for (Iterator<WeightedObject<?>> it = weightedObjects.iterator(); it.hasNext();) {
- thing = it.next().thing;
+ maximizes = criteria.startsWith("+"); //$NON-NLS-1$
+ for (WeightedObject<?> weightedObject : weightedObjects) {
+ thing = weightedObject.thing;
if (maximizes) {
thing = dependencyHelper.not(thing);
}
@@ -159,7 +159,7 @@ public class UserDefinedOptimizationFunction extends OptimizationFunction {
Projector.AbstractVariable abs = new Projector.AbstractVariable();
Object notlatest = dependencyHelper.not(toSort.get(0));
try {
- // notuptodate <=> not iuvn and (iuv1 or iuv2 or ... iuvn-1)
+ // notuptodate <=> not iuvn and (iuv1 or iuv2 or ... iuvn-1)
dependencyHelper.implication(new Object[] {abs}).implies(notlatest).named(FakeExplanation.getInstance());
Object[] clause = new Object[toSort.size()];
toSort.toArray(clause);

Back to the top