Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2009-12-30 17:33:36 +0000
committerPascal Rapicault2009-12-30 17:33:36 +0000
commit49a32611e5aee368aae03a6a63b15110703b7b02 (patch)
tree149ff46ffff3ef5f8cf024d7acebf498de4c7bb8
parenta6f2bfc8f21f15787d058ca212b1968d06994544 (diff)
downloadrt.equinox.p2-49a32611e5aee368aae03a6a63b15110703b7b02.tar.gz
rt.equinox.p2-49a32611e5aee368aae03a6a63b15110703b7b02.tar.xz
rt.equinox.p2-49a32611e5aee368aae03a6a63b15110703b7b02.zip
change from List to Collection
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java25
12 files changed, 48 insertions, 44 deletions
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 d9fe35362..82b43b2ec 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
@@ -428,7 +428,7 @@ public class Projector {
if (!considerMetaRequirements)
return rqs;
- List<IRequirement> metaRqs = iu.getMetaRequiredCapabilities();
+ Collection<IRequirement> metaRqs = iu.getMetaRequiredCapabilities();
if (metaRqs.isEmpty())
return rqs;
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 5c482733a..925c94505 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
@@ -153,7 +153,7 @@ public class Slicer {
if (!considerMetaRequirements)
return iuRequirements;
- List<IRequirement> iuMetaRequirements = iu.getMetaRequiredCapabilities();
+ Collection<IRequirement> iuMetaRequirements = iu.getMetaRequiredCapabilities();
int metaSize = iuMetaRequirements.size();
if (metaSize == 0)
return iuRequirements;
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java
index 461cdece5..8393a1c5a 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java
@@ -121,22 +121,22 @@ public abstract class MetadataWriter extends XMLWriter implements XMLConstants {
}
}
- protected void writeMetaRequiredCapabilities(List<IRequirement> capabilities) {
- if (capabilities != null && capabilities.size() > 0) {
+ protected void writeMetaRequiredCapabilities(Collection<IRequirement> metaRequirements) {
+ if (metaRequirements != null && metaRequirements.size() > 0) {
start(META_REQUIRED_CAPABILITIES_ELEMENT);
- attribute(COLLECTION_SIZE_ATTRIBUTE, capabilities.size());
- for (int i = 0; i < capabilities.size(); i++) {
- writeRequiredCapability(capabilities.get(i));
+ attribute(COLLECTION_SIZE_ATTRIBUTE, metaRequirements.size());
+ for (IRequirement req : metaRequirements) {
+ writeRequiredCapability(req);
}
end(META_REQUIRED_CAPABILITIES_ELEMENT);
}
}
- protected void writeRequiredCapabilities(Collection<IRequirement> capabilities) {
- if (capabilities != null && capabilities.size() > 0) {
+ protected void writeRequiredCapabilities(Collection<IRequirement> requirements) {
+ if (requirements != null && requirements.size() > 0) {
start(REQUIRED_CAPABILITIES_ELEMENT);
- attribute(COLLECTION_SIZE_ATTRIBUTE, capabilities.size());
- for (IRequirement req : capabilities) {
+ attribute(COLLECTION_SIZE_ATTRIBUTE, requirements.size());
+ for (IRequirement req : requirements) {
writeRequiredCapability(req);
}
end(REQUIRED_CAPABILITIES_ELEMENT);
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java
index 2e50fbb2a..c198f411b 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java
@@ -292,7 +292,7 @@ public class InstallableUnit implements IInstallableUnit {
return false;
}
- public List<IRequirement> getMetaRequiredCapabilities() {
+ public Collection<IRequirement> getMetaRequiredCapabilities() {
return CollectionUtils.unmodifiableList(metaRequires);
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java
index 5f3fe8448..05f995693 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java
@@ -92,8 +92,8 @@ public class ResolvedInstallableUnit implements IInstallableUnit {
return result;
}
- public List<IRequirement> getMetaRequiredCapabilities() {
- List<IRequirement> originalCapabilities = original.getMetaRequiredCapabilities();
+ public Collection<IRequirement> getMetaRequiredCapabilities() {
+ Collection<IRequirement> originalCapabilities = original.getMetaRequiredCapabilities();
if (fragments.length == 0)
return originalCapabilities;
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java
index 3e3907a97..a65d13749 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java
@@ -98,7 +98,7 @@ public class MetadataFactory {
return unit().getRequiredCapabilities();
}
- public List<IRequirement> getMetaRequiredCapabilities() {
+ public Collection<IRequirement> getMetaRequiredCapabilities() {
return unit().getMetaRequiredCapabilities();
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java
index 6b4e3a9f1..c6048dba3 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java
@@ -152,7 +152,7 @@ public interface IInstallableUnit extends IVersionedId, Comparable<IInstallableU
public Collection<IRequirement> getRequiredCapabilities();
- public List<IRequirement> getMetaRequiredCapabilities();
+ public Collection<IRequirement> getMetaRequiredCapabilities();
public List<ITouchpointData> getTouchpointData();
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java
index 14953a67e..70ee2844a 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java
@@ -328,12 +328,11 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
//process meta required capabilities
IRequirement[] metaRequiredAdvice = entry.getMetaRequiredCapabilities(iu);
if (metaRequiredAdvice != null) {
- List<IRequirement> current = iu.getMetaRequiredCapabilities();
+ Collection<IRequirement> current = iu.getMetaRequiredCapabilities();
Set<IRequirement> resultMetaRequiredCapabilities = new HashSet<IRequirement>(current);
// remove current meta-required capabilities that match (same name and namespace) advice.
- for (int j = 0; j < current.size(); j++) {
- IRequirement curr = current.get(j);
+ for (IRequirement curr : current) {
IRequiredCapability currentMetaRequiredCapability = null;
if (curr instanceof IRequiredCapability)
currentMetaRequiredCapability = (IRequiredCapability) curr;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java
index c7c863ef6..e70c5e82b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java
@@ -365,11 +365,12 @@ public class IUPatchPersistenceTest extends AbstractProvisioningTest {
}
private static String[][] extractMetaRequires(IInstallableUnit iu) {
- List<IRequirement> requyres = iu.getMetaRequiredCapabilities();
+ Collection<IRequirement> requyres = iu.getMetaRequiredCapabilities();
String[][] tuples = new String[requyres.size()][4];
- for (int i = 0; i < requyres.size(); i++) {
- IRequiredCapability next = (IRequiredCapability) requyres.get(i);
- tuples[i] = new String[] {next.getNamespace(), next.getName(), next.getRange().toString(), Boolean.valueOf(next.getMin() == 0).toString()};
+ int i = 0;
+ for (Iterator iterator = requyres.iterator(); iterator.hasNext();) {
+ IRequiredCapability next = (IRequiredCapability) iterator.next();
+ tuples[i++] = new String[] {next.getNamespace(), next.getName(), next.getRange().toString(), Boolean.valueOf(next.getMin() == 0).toString()};
}
return tuples;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java
index 5fcacad2f..241eb1de0 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java
@@ -253,11 +253,12 @@ public class IUPersistenceTest extends AbstractProvisioningTest {
}
private static String[][] extractMetaRequires(IInstallableUnit iu) {
- List<IRequirement> requyres = iu.getMetaRequiredCapabilities();
+ Collection<IRequirement> requyres = iu.getMetaRequiredCapabilities();
String[][] tuples = new String[requyres.size()][4];
- for (int i = 0; i < requyres.size(); i++) {
- IRequiredCapability next = (IRequiredCapability) requyres.get(i);
- tuples[i] = new String[] {next.getNamespace(), next.getName(), next.getRange().toString(), Boolean.valueOf(next.getMin() == 0).toString()};
+ int i = 0;
+ for (Iterator iterator = requyres.iterator(); iterator.hasNext();) {
+ IRequiredCapability next = (IRequiredCapability) iterator.next();
+ tuples[i++] = new String[] {next.getNamespace(), next.getName(), next.getRange().toString(), Boolean.valueOf(next.getMin() == 0).toString()};
}
return tuples;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java
index 59e8c6f65..0f405cef4 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java
@@ -88,9 +88,9 @@ public class AbstractPublisherActionTest extends AbstractProvisioningTest {
TestAction action = new TestAction();
action.testProcessCapabilityAdvice(iu, info);
- assertEquals("name1", ((IRequiredCapability) iu.getRequiredCapabilities().get(0)).getName());
+ assertEquals("name1", ((IRequiredCapability) iu.getRequiredCapabilities().iterator().next()).getName());
assertEquals("name2", iu.getProvidedCapabilities().get(0).getName());
- assertEquals("name3", ((IRequiredCapability) iu.getMetaRequiredCapabilities().get(0)).getName());
+ assertEquals("name3", ((IRequiredCapability) iu.getMetaRequiredCapabilities().iterator().next()).getName());
}
public void testAddCapabilitiesIdentityCounts() {
@@ -147,8 +147,8 @@ public class AbstractPublisherActionTest extends AbstractProvisioningTest {
iu.setMetaRequiredCapabilities(createRequiredCapabilities("ns3", "name3", null, ""));
assertNotSame(9, Version.toOSGiVersion(iu.getProvidedCapabilities().get(0).getVersion()).getMajor());
- assertTrue(iu.getRequiredCapabilities().get(0).isGreedy());
- assertTrue(iu.getMetaRequiredCapabilities().get(0).isGreedy());
+ assertTrue(iu.getRequiredCapabilities().iterator().next().isGreedy());
+ assertTrue(iu.getMetaRequiredCapabilities().iterator().next().isGreedy());
IPublisherInfo info = new PublisherInfo();
IRequiredCapability testRequiredCapability = MetadataFactory.createRequiredCapability("ns1", "name1", null, null, false, false, false);
@@ -160,8 +160,8 @@ public class AbstractPublisherActionTest extends AbstractProvisioningTest {
action.testProcessCapabilityAdvice(iu, info);
assertEquals(9, Version.toOSGiVersion(iu.getProvidedCapabilities().get(0).getVersion()).getMajor());
- assertFalse(iu.getRequiredCapabilities().get(0).isGreedy());
- assertFalse(iu.getMetaRequiredCapabilities().get(0).isGreedy());
+ assertFalse(iu.getRequiredCapabilities().iterator().next().isGreedy());
+ assertFalse(iu.getMetaRequiredCapabilities().iterator().next().isGreedy());
}
public void testReplaceCapabilitiesIdentityCounts() {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java
index baee83552..002f65d7d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java
@@ -330,18 +330,21 @@ public class AdviceFileParserTest extends TestCase {
assertEquals("testName2", provided.get(1).getName());
assertEquals(Version.emptyVersion, provided.get(1).getVersion());
- List<IRequirement> metarequirements = iu1.getMetaRequiredCapabilities();
+ Collection<IRequirement> metarequirements = iu1.getMetaRequiredCapabilities();
assertEquals(2, metarequirements.size());
- assertEquals("testNamespace1", ((IRequiredCapability) metarequirements.get(0).getMatches()).getNamespace());
- assertEquals("testName1", ((IRequiredCapability) metarequirements.get(0).getMatches()).getName());
- assertEquals(new VersionRange("[1.2.3, 2)"), ((IRequiredCapability) metarequirements.get(0).getMatches()).getRange());
- assertEquals(true, metarequirements.get(0).isGreedy());
- assertEquals(0, metarequirements.get(0).getMin());
- assertEquals("testNamespace2", ((IRequiredCapability) metarequirements.get(1).getMatches()).getNamespace());
- assertEquals("testName2", ((IRequiredCapability) metarequirements.get(1).getMatches()).getName());
- assertEquals(new VersionRange(Version.emptyVersion.toString()), ((IRequiredCapability) metarequirements.get(1).getMatches()).getRange());
- assertEquals(false, metarequirements.get(1).isGreedy());
- assertEquals(1, metarequirements.get(1).getMin());
+ Iterator it3 = metarequirements.iterator();
+ IRequirement metaReq0 = (IRequirement) it3.next();
+ IRequirement metaReq1 = (IRequirement) it3.next();
+ assertEquals("testNamespace1", ((IRequiredCapability) metaReq0.getMatches()).getNamespace());
+ assertEquals("testName1", ((IRequiredCapability) metaReq0.getMatches()).getName());
+ assertEquals(new VersionRange("[1.2.3, 2)"), ((IRequiredCapability) metaReq0.getMatches()).getRange());
+ assertEquals(true, metaReq0.isGreedy());
+ assertEquals(0, metaReq0.getMin());
+ assertEquals("testNamespace2", ((IRequiredCapability) metaReq1.getMatches()).getNamespace());
+ assertEquals("testName2", ((IRequiredCapability) metaReq1.getMatches()).getName());
+ assertEquals(new VersionRange(Version.emptyVersion.toString()), ((IRequiredCapability) metaReq1.getMatches()).getRange());
+ assertEquals(false, metaReq1.isGreedy());
+ assertEquals(1, metaReq1.getMin());
assertEquals(1, iu1.getTouchpointData().size());
ITouchpointInstruction configure = iu1.getTouchpointData().get(0).getInstruction("configure");

Back to the top