Class Version
-
- All Implemented Interfaces:
-
java.lang.Comparable
public class Version implements Comparable<T>
Created by Sebastien_Tosello on 10/08/2016.
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringVERSION_NORDIC_0_13_13public final static StringVERSION_ZERO_0_0_0
-
Method Summary
Modifier and Type Method Description static booleanisValidVersion(String version)final Stringget()intcompareTo(Version that)Compares this object with the specified object for order. static intcompare(String pVersion1, String pVersion2)If pVersion1 >pVersion2 return 1 If pVersion1 <pVersion2 return -1 If pVersion1 == pVersion2 return 0 booleanequals(Object that)inttoVersionCode()static inttoVersionCode(String thatVersion)Converts a string representing a version in the form x.y.z into a version code in the form xxyyzz. static StringtoVersionName(int versionCode)Converts a version code in the form xxyyzz into a string representing a version in the form xx.yy.zz. -
-
Constructor Detail
-
Version
Version(String version)
-
Version
Version(int version)
-
-
Method Detail
-
isValidVersion
static boolean isValidVersion(String version)
-
compareTo
int compareTo(Version that)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
- Parameters:
that- the Version to be compared.- Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
compare
static int compare(String pVersion1, String pVersion2)
If pVersion1 >pVersion2 return 1 If pVersion1 <pVersion2 return -1 If pVersion1 == pVersion2 return 0
- Parameters:
pVersion1- format "X.Y.pVersion2- format "X.Y.
-
toVersionCode
int toVersionCode()
-
toVersionCode
static int toVersionCode(String thatVersion)
Converts a string representing a version in the form x.y.z into a version code in the form xxyyzz.
- Parameters:
thatVersion- The version String to convert.- Returns:
the version code (xxyyzz) computed from version string "x.y.z", 0 if version string is unknown or -dirty
-
toVersionName
static String toVersionName(int versionCode)
Converts a version code in the form xxyyzz into a string representing a version in the form xx.yy.zz.
- Parameters:
versionCode- the integer version code (xxyyzz) computed from version string "x.y.- Returns:
version in the form xx.yy.zz, "" if integer version code is unknown
-
-
-
-