Class VersionComparator

java.lang.Object
alpine.common.util.VersionComparator

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

    • VersionComparator

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

    • 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
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • 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()
    • toString

      public String toString()
      Overrides:
      toString in class Object