Class VersionNum

    • Constructor Detail

      • VersionNum

        public VersionNum​(long versionNumber)
        Creates a new VersionNum. Zero-padding is not used.
        Parameters:
        versionNumber - the version number, must be greater than -1
      • VersionNum

        public VersionNum​(long versionNumber,
                          int zeroPaddingWidth)
        Creates a new VersionNum
        Parameters:
        versionNumber - the version number, must be greater than -1
        zeroPaddingWidth - the width of zero-padding, or 0 if the version is not zero-padded
    • Method Detail

      • fromString

        public static VersionNum fromString​(String value)
        Creates a new VersionNum from a version string in the format of "vN" where "N" is an integer greater than -1. Zero-padded values are supported.
        Parameters:
        value - version string
        Returns:
        version number
      • fromInt

        public static VersionNum fromInt​(int versionNumber)
        Creates a new VersionNum from an integer.
        Parameters:
        versionNumber - the version number, must be greater than -1
        Returns:
        version number
      • nextVersionNum

        public VersionNum nextVersionNum()
        Returns a new VersionNum that is one more than this. If the version number is zero-padded, versions higher than the max number are now allowed.
        Returns:
        a new VersionNum with an incremented version number
        Throws:
        InvalidVersionException - if the next version is higher than the max allowed value
      • previousVersionNum

        public VersionNum previousVersionNum()
        Returns a new VersionNum that is one less than this. Version numbers lower than 0 are not allowed.
        Returns:
        a new VersionNum with a decremented version number
        Throws:
        InvalidVersionException - if the previous version is lower than 1
      • getZeroPaddingWidth

        public int getZeroPaddingWidth()
        Returns:
        the zero-padding width, 0 when not padded
      • getVersionNum

        public long getVersionNum()
        Returns:
        the numeric version number
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object