/** * Returns {@code true} if this version is a later version than the argument, * on the basis of comparing the major and minor versions. For the purposes of * comparison, a value of {@link #ANY} is considered to be * {@link Integer#MAX_VALUE}, so no finite version number may come after it. * * @param v version to compare against * @return {@code true} if this version is later than the argument * @throws IllegalArgumentException if the provided version is not for the * same service as this version or for one implied by this version. */ public final boolean isAfter(Version v) { Version serviceVersion = findServiceVersion(impliedVersions, v.getServiceClass()); Preconditions.checkArgument(serviceVersion != null, "No relationship between versions"); int serviceMajor = raiseAny(serviceVersion.major); int vMajor = raiseAny(v.major); if (serviceMajor != vMajor) { return serviceMajor > vMajor; } else { return raiseAny(serviceVersion.minor) > raiseAny(v.minor); } }
/** * Returns {@code true} if this version is a later version than the argument, * on the basis of comparing the major and minor versions. For the purposes of * comparison, a value of {@link #ANY} is considered to be * {@link Integer#MAX_VALUE}, so no finite version number may come after it. * * @param v version to compare against * @return {@code true} if this version is later than the argument * @throws IllegalArgumentException if the provided version is not for the * same service as this version or for one implied by this version. */ public final boolean isAfter(Version v) { Version serviceVersion = findServiceVersion(impliedVersions, v.getServiceClass()); Preconditions.checkArgument(serviceVersion != null, "No relationship between versions"); int serviceMajor = raiseAny(serviceVersion.major); int vMajor = raiseAny(v.major); if (serviceMajor != vMajor) { return serviceMajor > vMajor; } else { return raiseAny(serviceVersion.minor) > raiseAny(v.minor); } }
/** * Returns {@code true} if this version is a later version than the argument, * on the basis of comparing the major and minor versions. For the purposes of * comparison, a value of {@link #ANY} is considered to be * {@link Integer#MAX_VALUE}, so no finite version number may come after it. * * @param v version to compare against * @return {@code true} if this version is later than the argument * @throws IllegalArgumentException if the provided version is not for the * same service as this version or for one implied by this version. */ public final boolean isAfter(Version v) { Version serviceVersion = findServiceVersion(impliedVersions, v.getServiceClass()); Preconditions.checkArgument(serviceVersion != null, "No relationship between versions"); int serviceMajor = raiseAny(serviceVersion.major); int vMajor = raiseAny(v.major); if (serviceMajor != vMajor) { return serviceMajor > vMajor; } else { return raiseAny(serviceVersion.minor) > raiseAny(v.minor); } }