Package qupath.lib.common
Class Version
java.lang.Object
qupath.lib.common.Version
- All Implemented Interfaces:
Comparable<Version>
Helper class for working with semantic versioning.
This should be in the form major.minor.patch
.
An optional suffix is also permitted to indicate a pre-release, alpha, beta or milestone version,
in the form major.minor.patch-suffix
, where the suffix may contain any alphanumeric characters or periods.
Implementation note: No checking is currently performed to ensure any suffix conforms to semantic versioning standards - however this behavior may change.
- Author:
- Pete Bankhead
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Comparator
<Version> Compare full version, including any suffixes.static final Comparator
<Version> Compare major versions only.static final Comparator
<Version> Compare major then minor versions.static final Comparator
<Version> Compare major then minor then patch versions (ignoring suffixes).static final Version
Constant representing any unknown version. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
int
getMajor()
Get the major version number (X.0.0).int
getMinor()
Get the minor version number (0.X.0).int
getPatch()
Get the patch version number (0.0.X).Get the (optional) suffix, which may be appended at the end of the version number to indicate a pre-release (0.0.0-X).int
hashCode()
boolean
Returns true if the version has a suffix, which typically indicates that it does not refer to a final stable version.static Version
Parse aVersion
object representing a semantic version number from a String.toString()
-
Field Details
-
COMPARATOR_MAJOR
Compare major versions only. -
COMPARATOR_MAJOR_MINOR
Compare major then minor versions. -
COMPARATOR_MAJOR_MINOR_PATCH
Compare major then minor then patch versions (ignoring suffixes). -
COMPARATOR_FULL
Compare full version, including any suffixes. -
UNKNOWN
Constant representing any unknown version.
-
-
Method Details
-
getMajor
public int getMajor()Get the major version number (X.0.0).- Returns:
-
getMinor
public int getMinor()Get the minor version number (0.X.0).- Returns:
-
getPatch
public int getPatch()Get the patch version number (0.0.X).- Returns:
-
getSuffix
Get the (optional) suffix, which may be appended at the end of the version number to indicate a pre-release (0.0.0-X).- Returns:
-
hasSuffix
public boolean hasSuffix()Returns true if the version has a suffix, which typically indicates that it does not refer to a final stable version.- Returns:
-
toString
-
parse
Parse aVersion
object representing a semantic version number from a String.The version should be in the form
x.y.z
orx.y.z-additional
, whereadditional
should be a dot-separated patch version identifier. In the case that it is hyphen-separated, the hyphens will be replaced by dots.- Parameters:
versionString
- the version String to be parsed- Returns:
- a Version parsed from this string, or
UNKNOWN
if the string is null or blank. - Throws:
IllegalArgumentException
- if no version could be parsed from the String
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Version>
-
hashCode
public int hashCode() -
equals
-