From 572a6facb459a7ac02c4f3ba1d71fa02e09a5060 Mon Sep 17 00:00:00 2001 From: mikaelpeltier Date: Thu, 25 Jun 2015 17:24:44 +0200 Subject: Add isComparable method into Version Change-Id: I81863d5114f5387836af233bd7c1ba1c4f4b9ba5 (cherry picked from commit d9718e9f061321bd7f8e24383793f7d027183fd9) --- sched/src/com/android/sched/util/Version.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sched/src/com/android/sched/util/Version.java b/sched/src/com/android/sched/util/Version.java index 3128edd..0586680 100644 --- a/sched/src/com/android/sched/util/Version.java +++ b/sched/src/com/android/sched/util/Version.java @@ -201,13 +201,14 @@ public class Version { ^ (codeBase != null ? codeBase.hashCode() : 0); } - int compareTo(@Nonnull Version other) throws UncomparableVersion { - if (subReleaseKind == SubReleaseKind.ENGINEERING + public boolean isComparable() { + return !(subReleaseKind == SubReleaseKind.ENGINEERING || releaseCode <= 0 - || subReleaseCode <= 0 - || other.getSubReleaseKind() == SubReleaseKind.ENGINEERING - || other.getReleaseCode() <= 0 - || other.getSubReleaseCode() <= 0) { + || subReleaseCode <= 0); + } + + int compareTo(@Nonnull Version other) throws UncomparableVersion { + if (!isComparable() || !other.isComparable()) { throw new UncomparableVersion( getVerboseVersion() + " is not comparable with " + other.getVerboseVersion()); } -- cgit v1.1