summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormikaelpeltier <mikaelpeltier@google.com>2015-06-25 17:24:44 +0200
committerMikael Peltier <mikaelpeltier@google.com>2015-06-25 15:32:52 +0000
commit572a6facb459a7ac02c4f3ba1d71fa02e09a5060 (patch)
tree0dd21cb4da21773d7fbfeacefb3ef95852f25de2
parent5b4a0d8e4b7f813d6d6ccc52f6479dd663bf91bc (diff)
downloadtoolchain_jack-572a6facb459a7ac02c4f3ba1d71fa02e09a5060.zip
toolchain_jack-572a6facb459a7ac02c4f3ba1d71fa02e09a5060.tar.gz
toolchain_jack-572a6facb459a7ac02c4f3ba1d71fa02e09a5060.tar.bz2
Add isComparable method into Version
Change-Id: I81863d5114f5387836af233bd7c1ba1c4f4b9ba5 (cherry picked from commit d9718e9f061321bd7f8e24383793f7d027183fd9)
-rw-r--r--sched/src/com/android/sched/util/Version.java13
1 files 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());
}