public class Version extends java.lang.Object implements Immutable, java.lang.Comparable<Version>
This follows the more-or-less classic form of major.minor.release (e.g. 1.2.3). In general major versions indicate substantial platform changes, generally with incompatibilities between them. Minor versions indicate branches of the software. Often odd numbers are used to indicate unstable branches, while even numbers indicate stable branches. The release number is incremented for each release.
Note that these aren't ordinary decimal numbers. They are independent integers separated by periods. Thus versions are ordered 1.1, 1.2... 1.10, 1.11 - 1.1 is different from 1.10 and 1.2 comes before 1.19.
Missing pieces are represented by -1. This is only valid in the trailing versions - you can't have a version with no major version, and you can't have a version with major and release versions and no minor version.
There are a variety of interesting comparisons you can make between versions.
Copyright 2007 Partner Software, Inc.
| Constructor and Description |
|---|
Version(int major)
Creates a new version with the given major version, no minor or release
versions.
|
Version(int major,
int minor)
Creates a new version with the given major version, minor version, and no
release version.
|
Version(int major,
int minor,
int release)
Creates a new version with the given major, minor and release versions.
|
Version(int major,
int minor,
int release,
int subRelease)
Creates a new version with the given major, minor, release and subRelease versions.
|
Version(java.lang.String versionString)
Creates a version from the provided version and build strings.
|
Version(VfsFile versionFile) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Version nother) |
boolean |
equals(java.lang.Object nother) |
int |
getMajor()
Returns the major version number.
|
int |
getMinor()
Returns the minor version number, or -1 if there is none.
|
int |
getRelease()
Returns the release version number, or -1 if there is none.
|
int |
getSubRelease()
Returns the subRelease version number, or -1 if there is none.
|
java.lang.String |
getVersionString()
Returns this version as a string in major.minor.release.subRelease (e.g.
|
int |
hashCode() |
boolean |
majorMatches(Version nother)
Returns true if the version given matches this one's major version.
|
boolean |
minorMatches(Version nother)
Returns true if the version given matches this one's major and minor
versions.
|
boolean |
releaseMatches(Version nother)
Returns true if the version given matches this one's major, minor, and
release versions.
|
boolean |
subReleaseMatches(Version nother)
Returns true if the version given matches this one's major, minor, release,
and subrelease versions.
|
java.lang.String |
toString() |
public Version(java.lang.String versionString)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic Version(int major)
public Version(int major,
int minor)
public Version(int major,
int minor,
int release)
public Version(int major,
int minor,
int release,
int subRelease)
public Version(VfsFile versionFile) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic boolean majorMatches(Version nother)
public boolean minorMatches(Version nother)
public boolean releaseMatches(Version nother)
public boolean subReleaseMatches(Version nother)
public int compareTo(Version nother)
compareTo in interface java.lang.Comparable<Version>public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object nother)
equals in class java.lang.Objectpublic java.lang.String getVersionString()
public int getMajor()
public int getMinor()
public int getRelease()
public int getSubRelease()