From 7aa0387ef4a48838180f6219b26ab15d99c10fc8 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Tue, 31 Jan 2017 12:10:49 +0100 Subject: add usage comments to checkVersion() --- src/main/java/de/pixart/messenger/ui/UpdaterActivity.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main/java/de/pixart') diff --git a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java index 548313c6c..b24958a43 100644 --- a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java +++ b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java @@ -162,6 +162,18 @@ public class UpdaterActivity extends Activity { alert.show(); } + /** + * Use this instead of String.compareTo() for a non-lexicographical + * comparison that works for version strings. e.g. "1.10".compareTo("1.6"). + * + * @note It does not work if "1.10" is supposed to be equal to "1.10.0". + * + * @param str1 a string of ordinal numbers separated by decimal points. + * @param str2 a string of ordinal numbers separated by decimal points. + * @return The result is a negative integer if str1 is _numerically_ less than str2. + * The result is a positive integer if str1 is _numerically_ greater than str2. + * The result is zero if the strings are _numerically_ equal. + */ private int checkVersion(String remoteVersion, String installedVersion) { String[] remote = null; String[] installed = null; -- cgit v1.2.3