Put your logo here!

TOC PREV NEXT



compareTo

Compares the version information specified in this object to the version information specified in the version parameter.

Method of

InstallVersion

Syntax

compareTo (
InstallVersion version);

compareTo (
String version);

compareTo (
int major,
int minor,
int release,
int build);

Parameters

The compareTo method has the following parameters:

maj The major version number.
min Minor version number.
rev Revision number.
bld Build number.
version An InstallVersion object or a String representing version information in the format "4.1.2.1234".

Returns

If the versions are the same, this method returns 0. If this version object represents a smaller (earlier) version than that represented by the version parameter, this method returns a negative number. Otherwise, it returns a positive number. In particular, this method returns one of the following values:

· -4: This version object has a smaller (earlier) major number than version.
· -3: This version object has a smaller (earlier) minor number than version.
· -2: This version object has a smaller (earlier) release number than version.
· -1: This version object has a smaller (earlier) build number than version.
· 0: The version numbers are the same; both objects represent the same version.
· 1: This version object has a larger (newer) build number than version.
· 2: This version object has a larger (newer) release number than version.
· 3: This version object has a larger (newer) minor number than version.
· 4: This version object has a larger (newer) major number than version.

The following constants are defined and available for checking the value returned by compareTo:

InstallVersion.MAJOR_DIFF
InstallVersion.MINOR_DIFF
InstallVersion.REL_DIFF
InstallVersion.BLD_DIFF
InstallVersion.EQUAL
InstallVersion.MAJOR_DIFF_MINUS
InstallVersion.MINOR_DIFF_MINUS
InstallVersion.REL_DIFF_MINUS
InstallVersion.BLD_DIFF_MINUS

Example

This code uses the compareTo method to determine whether or not version 3.2.1 of the Royal Airways software has been previously installed:

existingVI = InstallTrigger.getVersion("/royalairways/royalsw");

if ( existingVI.compareTo("3.2.1") <= 0 ) {
// ... proceed to update ...
}


Netscape Communications
devedge.netscape.com
TOC PREV NEXT