blackboard.platform.plugin
Class Version

java.lang.Object
  |
  +--blackboard.platform.plugin.Version

public class Version
extends java.lang.Object

Class to encapsulate the versioning in a plug-in and within the application. Versions include major, minor, patch, and build numbers, typically represented as "n.n.n.n". Comparisons go from from left to right, i.e., major to build. Since older versions did not include the concept of "build" number, the old style major, minor, patch is still supported. Undefined values for build are not evaluate.

Since:
Blackboard 5.5

Field Summary
static java.lang.String DELIMITER
           
static int EQUALS
           
static int GREATER_THAN
           
static int LESS_THAN
           
static int UNDEFINED
           
 
Constructor Summary
Version(int maj, int min, int p)
           
Version(int maj, int min, int p, int b)
           
 
Method Summary
 int compare(Version v)
          Method to evaluate two versions.
 int getBuild()
           
 int getMajor()
           
 int getMinor()
           
 int getPatch()
           
static Version parse(java.lang.String str)
          Parses a string of the form "n.n.n.n" into a Version object.
 java.lang.String toString()
          Simple method to return version as a string of the form "n.n.n.n".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GREATER_THAN

public static final int GREATER_THAN
See Also:
Constant Field Values

LESS_THAN

public static final int LESS_THAN
See Also:
Constant Field Values

EQUALS

public static final int EQUALS
See Also:
Constant Field Values

UNDEFINED

public static final int UNDEFINED
See Also:
Constant Field Values

DELIMITER

public static final java.lang.String DELIMITER
See Also:
Constant Field Values
Constructor Detail

Version

public Version(int maj,
               int min,
               int p)

Version

public Version(int maj,
               int min,
               int p,
               int b)
Method Detail

getMajor

public int getMajor()

getMinor

public int getMinor()

getPatch

public int getPatch()

getBuild

public int getBuild()

toString

public java.lang.String toString()
Simple method to return version as a string of the form "n.n.n.n". If patch or build are undefined, they are ommitted.

Overrides:
toString in class java.lang.Object

compare

public int compare(Version v)
Method to evaluate two versions. Each version type is checked, in this order: major, minor, patch, and build. Patch and build may be ommitted. If so, then any number is assumed to be a match.

Parameters:
v - Version to compare against

parse

public static Version parse(java.lang.String str)
                     throws VersionException
Parses a string of the form "n.n.n.n" into a Version object. Note that patch and build numbers may be ommitted now. See #compare() for information on the effect this has on comparing two versions.

Parameters:
str - String to parse
Throws:
VersionException - thrown If there are fewer than two version elements, or if any of the elements generates a parse exception


Copyright © 2003 Blackboard, Inc. All Rights Reserved.