com.tensegrity.generic.util
Class VersionNumber

java.lang.Object
  extended bycom.tensegrity.generic.util.VersionNumber

public class VersionNumber
extends java.lang.Object

As the name implies the VersionNumber class represents a version number and follows the rules of the most commonly used numeric software versioning scheme. This scheme expresses a version number as a concatenation of four single numbers seperated by periods. So the structure of a version number looks like:

    Version.Subversion.Revision.Build
The following table explains the meaning of each of the single numbers.
Number Description
Version The major version number.
This number is normally increased when significant changes or jumps in funtionality have taken place.
Subversion The minor version number.
This number is increased when minor changes to functionality have been applied.
Revision The number for the revision. Sometimes it is also called the service pack.
This number is increased for releases due to major bug fix or the like.
Build The number of the build.
This number is increased for internal releases due to minor bug fixes or the like.
*

*

An instance of this class can be created either by giving each of the single numbers or by giving the complete version number in its string representation.

* * *

Instances of VersionNumber can be compared to each other. The methods provided to support comparison are listed below.

* *

Version:
$Id: VersionNumber.java,v 1.3 2006/02/10 10:09:45 MichaelKegel Exp $
Author:
MKegel
See Also:
VersionInfo

Constructor Summary
VersionNumber(int version, int subversion, int revision, int build)
          Constructor with each single number.
VersionNumber(java.lang.String completeVersionNumber)
          Constructor with given version number in its string representation.
 
Method Summary
 int getBuild()
          Returns the build of the version number
 int getRevision()
          Return the revision of the version number.
 int getServicepack()
          Deprecated. make use of getRevision() instead
 int getSubversion()
          Returns the minor version number
 int getVersion()
          Returns the major version number.
 boolean lessOrEqual(java.lang.String completeVersionNumber)
          Compares this instance of VersionNumber against the given version number and returns a boolean that indicates whether the given version number is less, equal or higher than this instance of VersionNumber.
 boolean lessOrEqual(VersionNumber other)
          Compares this instance of VersionNumber against the given instance of VersionNumber and returns a boolean that indicates whether the given instance is less, equal or higher than this instance of VersionNumber.
 java.lang.String toString()
          Returns the string representation of this instance of VersionNumber.
 java.lang.String toStringLong()
          Returns a long string representation of this instance of VersionNumber.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VersionNumber

public VersionNumber(int version,
                     int subversion,
                     int revision,
                     int build)
Constructor with each single number.

Parameters:
version - the major version number
subversion - the minor version number
revision - the servicepack of the version number
build - the build of the version number

VersionNumber

public VersionNumber(java.lang.String completeVersionNumber)
              throws VersionNumberParseException
Constructor with given version number in its string representation.

Parameters:
completeVersionNumber - the complete version number in its string representation
Throws:
VersionNumberParseException - is thrown when the given string representation is malformed
Method Detail

getVersion

public final int getVersion()
Returns the major version number.

Returns:
int the major version number

getSubversion

public final int getSubversion()
Returns the minor version number

Returns:
int the minor version number

getRevision

public final int getRevision()
Return the revision of the version number.

Returns:
int the revision number

getServicepack

public final int getServicepack()
Deprecated. make use of getRevision() instead

Return the servicepack of the version number.

Returns:
int the servicepack number

getBuild

public final int getBuild()
Returns the build of the version number

Returns:
int the build number

lessOrEqual

public boolean lessOrEqual(java.lang.String completeVersionNumber)
                    throws VersionNumberParseException
Compares this instance of VersionNumber against the given version number and returns a boolean that indicates whether the given version number is less, equal or higher than this instance of VersionNumber. Whereas a return value of true indicates that this instance is less than or equal to the given version number.

Parameters:
completeVersionNumber - the version number to compare to
Returns:
boolean a flag that indicates which version number is greater
Throws:
VersionNumberParseException - is thrown in case the given String represetation is malformed

lessOrEqual

public boolean lessOrEqual(VersionNumber other)
Compares this instance of VersionNumber against the given instance of VersionNumber and returns a boolean that indicates whether the given instance is less, equal or higher than this instance of VersionNumber. Whereas a return value of true indicates that this instance is less than or equal to the given instance.

Parameters:
other - the VersionNumber instance to compare to
Returns:
boolean a flag that indicates which version number is greater

toString

public java.lang.String toString()
Returns the string representation of this instance of VersionNumber.

Returns:
String the string representation

toStringLong

public java.lang.String toStringLong()
Returns a long string representation of this instance of VersionNumber.

Returns:
String the long string representation


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.