You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SimplixCore offers a class called Version for comparing version strings. This is mainly used by the builtin automatic update checker.
Usage
Parsing
SimplixCore is able to parse standard sequence version strings like "v#.#.#" or "#.#.#" with a maximum of three number levels (major, minor and patch values).
Versionversion = Version.parse("1.2.3");
If you are using a different versioning scheme, you can provide your own regular expression for parsing your version strings.
The Version class is implementing Comparable<Version> so it can be used in many ways for comparing versions. This class is also providing simple newerThen and olderThen methods to directly compare two versions.
Versionv1 = Version.parse("1.2.3");
Versionv2 = Version.parse("1.4");
if (v1.olderThen(v2)) {
// Expected since 1.2.3 is older then 1.4
}
if (v2.newerThen(v1)) {
// Expected since 1.4 is newer then 1.2.3
}
Restrictions
You can only compare versions against each other that are using the same versioning scheme. Otherwise an IllegalArgumentException will occur.