/** * Checks if the given version is in this range. * @param v the version to check * @return {@code true} if the given version is in this range. */ public boolean isInRange(Version v) { if (low != null) { int comp = v.compareTo(low); if (comp < 0 || comp == 0 && !lowIncl) { return false; } } if (high != null) { int comp = v.compareTo(high); if (comp > 0 || comp == 0 && !highIncl) { return false; } } return true; }
/** * Same as with {@link #compareTo(Version)}. * * @param o the other version * @return a negative integer, zero, or a positive integer as this version is less than, equal to, or greater than the specified version. * @deprecated since 3.1.32. use {@link #compareTo(Version)}. See JCRVLT-146 */ @Deprecated public int osgiCompareTo(Version o) { return compareTo(o); } }
int comp = low.compareTo(high); if (comp > 0) { throw new IllegalArgumentException("lower bound must be less or equal to upper bound.");
/** * {@inheritDoc} * * Compares this id with the given one. */ public int compareTo(PackageId o) { int comp = group.compareTo(o.getGroup()); if (comp != 0) { return comp; } comp = name.compareTo(o.getName()); if (comp != 0) { return comp; } return version.compareTo(o.getVersion()); }
+ " = " + packageVersion.compareTo(latestVersion)); if (packageVersion.compareTo(latestVersion) >= 1) { latestVersion = packageVersion; log.debug("Found a new latest version: {}", latestVersion.toString()); } else if (packageVersion.compareTo(configVersion) == 0) { configVersionEligible = false; log.debug("Found a package with the same version as the config version");
if (bestId == null || id.getVersion().compareTo(bestId.getVersion()) > 0) { bestId = id;
public int compareTo(PackId o) { if (o == null) { return -1; } if (this.getGroup().equals(o.getGroup())) { if (this.getName().equals(o.getName())) { if (this.getVersion().equals(o.getVersion())) { return 0; } else { return Version.create(this.getVersion()).compareTo(Version.create(o.getVersion())); } } else { return this.getName().compareTo(o.getName()); } } else { return this.getGroup().compareTo(o.getGroup()); } }
/** * {@inheritDoc} */ @Override public PackageId resolve(Dependency dependency, boolean onlyInstalled) throws IOException { PackageId bestId = null; for (PackageId id : packages()) { if (!onlyInstalled || isInstalled(id)) { if (dependency.matches(id)) { if (bestId == null || id.getVersion().compareTo(bestId.getVersion()) > 0) { bestId = id; } } } } return bestId; }
&& listedPackageId.getVersion().compareTo(pVersion) > 0) { newerPackageIdPerSubPackage.put(pId, listedPackageId); break;