Package alpine.util

Class VersionComparator


  • public class VersionComparator
    extends Object
    A class that compares semantic versions from one to another.
    Since:
    1.0.0
    Author:
    Steve Springett
    • Constructor Detail

      • VersionComparator

        public VersionComparator​(String version)
        Constructs a new VersionComparator using the specified semantic version.
        Parameters:
        version - the semantic version
    • Method Detail

      • isNewerThan

        public boolean isNewerThan​(VersionComparator comparator)
        Determines if the specified VersionComparator is newer than this instance.
        Parameters:
        comparator - a VersionComparator to compare to
        Returns:
        true if specified version if newer, false if not
      • isOlderThan

        public boolean isOlderThan​(VersionComparator comparator)
        Determines if the specified VersionComparator is older than this instance.
        Parameters:
        comparator - a VersionComparator to compare to
        Returns:
        true if specified version if older, false if not
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getMajor

        public int getMajor()
      • getMinor

        public int getMinor()
      • getRevision

        public int getRevision()
      • isSnapshot

        public boolean isSnapshot()
      • getPrereleaseNumber

        public int getPrereleaseNumber()