Class VersionNumber

  • All Implemented Interfaces:
    java.lang.Comparable<VersionNumber>

    public class VersionNumber
    extends java.lang.Object
    implements java.lang.Comparable<VersionNumber>
    Immutable representation of a version number based on the Mercury version numbering scheme. VersionNumbers are Comparable.

    Special tokens

    We allow a component to be not just a number, but also "ea", "ea1", "ea2". "ea" is treated as "ea0", and eaN < M for any M > 0.

    '*' is also allowed as a component, and '*' > M for any M > 0.

    'SNAPSHOT' is also allowed as a component, and "N.SNAPSHOT" is interpreted as "N-1.*"

     2.0.* > 2.0.1 > 2.0.1-SNAPSHOT > 2.0.0.99 > 2.0.0 > 2.0.ea > 2.0
     
    This class is re-implemented in 1.415. The class was originally introduced in 1.139
    Since:
    1.139
    Author:
    Stephen Connolly (stephenc@apache.org), Kenney Westerhof (kenney@apache.org), Hervé Boutemy (hboutemy@apache.org)
    • Field Detail

      • DESCENDING

        public static final java.util.Comparator<VersionNumber> DESCENDING
    • Constructor Detail

      • VersionNumber

        public VersionNumber​(java.lang.String version)
    • Method Detail

      • compareTo

        public int compareTo​(VersionNumber o)
        Specified by:
        compareTo in interface java.lang.Comparable<VersionNumber>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • isOlderThan

        public boolean isOlderThan​(VersionNumber rhs)
      • isNewerThan

        public boolean isNewerThan​(VersionNumber rhs)
      • digit

        public int digit​(int idx)