{
c = ((Comparable) cap1.getAttributes().get(BundleRevision.BUNDLE_NAMESPACE))
.compareTo(cap2.getAttributes().get(BundleRevision.BUNDLE_NAMESPACE));
if (c == 0)
{
Version v1 = (!cap1.getAttributes().containsKey(Constants.BUNDLE_VERSION_ATTRIBUTE))
? Version.emptyVersion
: (Version) cap1.getAttributes().get(Constants.BUNDLE_VERSION_ATTRIBUTE);
Version v2 = (!cap2.getAttributes().containsKey(Constants.BUNDLE_VERSION_ATTRIBUTE))
? Version.emptyVersion
: (Version) cap2.getAttributes().get(Constants.BUNDLE_VERSION_ATTRIBUTE);
// Compare these in reverse order, since we want
// highest version to have priority.
c = v2.compareTo(v1);
}
}
// Compare package capabilities.
else if ((c == 0) && cap1.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
c = ((Comparable) cap1.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE))
.compareTo(cap2.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE));
if (c == 0)
{
Version v1 = (!cap1.getAttributes().containsKey(BundleCapabilityImpl.VERSION_ATTR))
? Version.emptyVersion
: (Version) cap1.getAttributes().get(BundleCapabilityImpl.VERSION_ATTR);
Version v2 = (!cap2.getAttributes().containsKey(BundleCapabilityImpl.VERSION_ATTR))
? Version.emptyVersion
: (Version) cap2.getAttributes().get(BundleCapabilityImpl.VERSION_ATTR);
// Compare these in reverse order, since we want
// highest version to have priority.
c = v2.compareTo(v1);
}
}
// Finally, compare bundle identity.
if (c == 0)