diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java index 34015e6c6..51050fb7c 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2018 Rapicorp Inc. and others. + * Copyright (c) 2013, 2018 Rapicorp Inc. and others. * * This * program and the accompanying materials are made available under the terms of @@ -9,7 +9,7 @@ * * SPDX-License-Identifier: EPL-2.0 * - * Contributors: + * Contributors: * Rapicorp, Inc. - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.internal.p2.director; @@ -110,12 +110,10 @@ public class OptimizationFunction { //Now we deal the optional IUs, long countOptional = 1; List<IInstallableUnit> requestedPatches = new ArrayList<>(); - Collection<IRequirement> reqs = metaIu.getRequirements(); - for (IRequirement req : reqs) { + for (IRequirement req : metaIu.getRequirements()) { if (req.getMin() > 0 || !req.isGreedy()) continue; - IQueryResult<IInstallableUnit> matches = picker.query(QueryUtil.createMatchQuery(req.getMatches()), null); - for (IInstallableUnit match : matches) { + for (IInstallableUnit match : picker.query(QueryUtil.createMatchQuery(req.getMatches()), null)) { if (match instanceof IInstallableUnitPatch) { requestedPatches.add(match); countOptional = countOptional + 1; @@ -125,8 +123,8 @@ public class OptimizationFunction { // and we make sure that patches are always favored BigInteger patchWeight = maxWeight.multiply(POWER).multiply(BigInteger.valueOf(countOptional)).negate(); - for (Iterator<IInstallableUnit> iterator = requestedPatches.iterator(); iterator.hasNext();) { - weightedObjects.add(WeightedObject.newWO(iterator.next(), patchWeight)); + for (IInstallableUnit iu : requestedPatches) { + weightedObjects.add(WeightedObject.newWO(iu, patchWeight)); } return weightedObjects; } |