Package alpine.util
Class VersionComparator
- java.lang.Object
-
- alpine.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 Summary
Constructors Constructor Description VersionComparator(String version)Constructs a new VersionComparator using the specified semantic version.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object object)intgetMajor()intgetMinor()intgetPrereleaseNumber()intgetRevision()inthashCode()booleanisNewerThan(VersionComparator comparator)Determines if the specified VersionComparator is newer than this instance.booleanisOlderThan(VersionComparator comparator)Determines if the specified VersionComparator is older than this instance.booleanisSnapshot()StringtoString()
-
-
-
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
-
getMajor
public int getMajor()
-
getMinor
public int getMinor()
-
getRevision
public int getRevision()
-
isSnapshot
public boolean isSnapshot()
-
getPrereleaseNumber
public int getPrereleaseNumber()
-
-