Class Version

  • All Implemented Interfaces:
    java.lang.Comparable

    
    public class Version
     implements Comparable<T>
                        

    Created by Sebastien_Tosello on 10/08/2016.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Version(String version)
      Version(int version)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static boolean isValidVersion(String version)
      final String get()
      int compareTo(Version that) Compares this object with the specified object for order.
      static int compare(String pVersion1, String pVersion2) If pVersion1 >pVersion2 return 1 If pVersion1 <pVersion2 return -1 If pVersion1 == pVersion2 return 0
      boolean equals(Object that)
      int 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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Version

        Version(String version)
      • Version

        Version(int version)
    • Method Detail

      • 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

         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