diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-03-05 22:58:37 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-03-05 22:58:37 +0800 |
| commit | 467c6d161a72f6b242c9d1c03ba0db43d70f9f67 (patch) | |
| tree | 9a5a609a8a267c8b0655322a7435eebc9e29769b /src/main/java/me/shedaniel/rei/update/Version.java | |
| parent | bcb6c678616bf254c4cc1fa6dbb4859f740955d6 (diff) | |
| download | RoughlyEnoughItems-467c6d161a72f6b242c9d1c03ba0db43d70f9f67.tar.gz RoughlyEnoughItems-467c6d161a72f6b242c9d1c03ba0db43d70f9f67.tar.bz2 RoughlyEnoughItems-467c6d161a72f6b242c9d1c03ba0db43d70f9f67.zip | |
Removed updater
Diffstat (limited to 'src/main/java/me/shedaniel/rei/update/Version.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/update/Version.java | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/main/java/me/shedaniel/rei/update/Version.java b/src/main/java/me/shedaniel/rei/update/Version.java deleted file mode 100644 index a60086fac..000000000 --- a/src/main/java/me/shedaniel/rei/update/Version.java +++ /dev/null @@ -1,49 +0,0 @@ -package me.shedaniel.rei.update; - -public class Version implements Comparable<Version> { - - private String version; - - public Version(String version) { - if (version == null) - throw new IllegalArgumentException("Version can not be null"); - if (!version.matches("[0-9]+(\\.[0-9]+)*")) - throw new IllegalArgumentException("Invalid version format"); - this.version = version; - } - - @Override - public final String toString() { - return this.version; - } - - @Override - public int compareTo(Version other) { - if (other == null) - return 1; - String[] thisParts = this.toString().split("\\."); - String[] thatParts = other.toString().split("\\."); - int length = Math.max(thisParts.length, thatParts.length); - for(int i = 0; i < length; i++) { - int thisPart = i < thisParts.length ? Integer.parseInt(thisParts[i]) : 0; - int thatPart = i < thatParts.length ? Integer.parseInt(thatParts[i]) : 0; - if (thisPart < thatPart) - return -1; - if (thisPart > thatPart) - return 1; - } - return 0; - } - - @Override - public boolean equals(Object that) { - if (this == that) - return true; - if (that == null) - return false; - if (this.getClass() != that.getClass()) - return false; - return this.compareTo((Version) that) == 0; - } - -} |
