Package org.osgi.framework

Examples of org.osgi.framework.Version.compareTo()


                }
                else if ((v != null) && (v instanceof Version))
                {
                    // If there is no best version or if the current
                    // resource's version is lower, then select it.
                    if ((bestVersion == null) || (bestVersion.compareTo((Version) v) < 0))
                    {
                        best = current;
                        bestLocal = isCurrentLocal;
                        bestVersion = (Version) v;
                    }
View Full Code Here


                        bestLocal = isCurrentLocal;
                        bestVersion = (Version) v;
                    }
                    // If the current resource version is equal to the
                    // best
                    else if ((bestVersion != null) && (bestVersion.compareTo((Version) v) == 0))
                    {
                        // If the symbolic name is the same, use the highest
                        // bundle version.
                        if ((best.getResource().getSymbolicName() != null)
                            && best.getResource().getSymbolicName().equals(
View Full Code Here

                v = resources[i].getVersion();
            }
            else
            {
                Version vtmp = resources[i].getVersion();
                if (vtmp.compareTo(v) > 0)
                {
                    idx = i;
                    v = vtmp;
                }
            }
View Full Code Here

            if ( va != null && vb != null ) {
                hasVersion = true;
                isSnapshot = va.toString().contains("SNAPSHOT");
                // higher version has more priority, must come first so invert comparison
                result = vb.compareTo(va);
            }

            // Then by priority, higher values first
            if (result == 0) {
                result = Integer.valueOf(b.getPriority()).compareTo(a.getPriority());
View Full Code Here

                    matchingBundles.add(bundle);
                }
            }
            if ( matchingBundles.size() > 0 ) {
                final Version searchVersion = (version == null ? null : new Version(version));
                if ( searchVersion == null || searchVersion.compareTo(getBundleVersion(matchingBundles.get(0))) == 0 ) {
                    match = matchingBundles.get(0);
                }
                for(int i=1; i<matchingBundles.size(); i++) {
                    final Bundle current = matchingBundles.get(i);
                    if ( searchVersion == null ) {
View Full Code Here

                    if ( searchVersion == null ) {
                        if ( getBundleVersion(match).compareTo(getBundleVersion(current)) < 0 ) {
                            match = current;
                        }
                    } else {
                        if ( searchVersion.compareTo(getBundleVersion(current)) == 0 ) {
                            match = current;
                            break;
                        }
                    }
                }
View Full Code Here

            if (feature == null) {
                if (FeatureImpl.DEFAULT_VERSION.equals(version)) {
                    Version latest = new Version(cleanupVersion(version));
                    for (String available : versions.keySet()) {
                        Version availableVersion = new Version(cleanupVersion(available));
                        if (availableVersion.compareTo(latest) > 0) {
                            feature = versions.get(available);
                            latest = availableVersion;
                        }
                    }
                } else {
View Full Code Here

                } else {
                    Version latest = new Version(cleanupVersion(FeatureImpl.DEFAULT_VERSION));
                    VersionRange versionRange = new VersionRange(version, true, true);
                    for (String available : versions.keySet()) {
                        Version availableVersion = new Version(cleanupVersion(available));
                        if (availableVersion.compareTo(latest) > 0 && versionRange.contains(availableVersion)) {
                            feature = versions.get(available);
                            latest = availableVersion;
                        }
                    }
                }
View Full Code Here

        continue;
      else if (maxVersion == null) {
        maxVersion = range.getMaximumVersion();
        maxExclusive = range.isMaximumExclusive();
      } else {
        int maxComparison = maxVersion.compareTo(range.getMaximumVersion());
       
        //We have a new, lower maximum
        if(maxComparison > 0) {
          maxVersion = range.getMaximumVersion();
          maxExclusive = range.isMaximumExclusive();
View Full Code Here

            if (i == 0) {
                idx = 0;
                v = resources[i].getVersion();
            } else {
                Version vtmp = resources[i].getVersion();
                if (vtmp.compareTo(v) > 0) {
                    idx = i;
                    v = vtmp;
                }
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.