jas.util.pluginmanager
Class VersionNumberCompare

java.lang.Object
  |
  +--jas.util.pluginmanager.VersionNumberCompare

public class VersionNumberCompare
extends java.lang.Object

This class is used to compare version numbers. The only method in this class converts both the currentversion and the latest version (method arguments) strings into string chunks (i.e. if string = 2.0.4, then ints are 2,0,4). The string chunks are then converted to ints and compared one at a time. If a latest version chunk is > than a current version chunk an update is available and UPDATEVERSION is returned. If all chunks are equal then NOUPDATEVERSION is available. If a latest chunk is < current chunk or Strings can't be converted to ints an Exception is thrown.


Field Summary
static int NOUPDATEVERSION
           
static int UPDATEVERSION
           
static int VERSIONCHECKERROR
           
 
Constructor Summary
VersionNumberCompare()
           
 
Method Summary
 int compareVersions(java.lang.String currentversion, java.lang.String latestversion, boolean throwexception)
          This method converts both the currentversion and the latest version (method arguments) strings into string chunks (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSIONCHECKERROR

public static final int VERSIONCHECKERROR

UPDATEVERSION

public static final int UPDATEVERSION

NOUPDATEVERSION

public static final int NOUPDATEVERSION
Constructor Detail

VersionNumberCompare

public VersionNumberCompare()
Method Detail

compareVersions

public int compareVersions(java.lang.String currentversion,
                           java.lang.String latestversion,
                           boolean throwexception)
                    throws jas.util.pluginmanager.VersionNumberCompare.VersionCompareException
This method converts both the currentversion and the latest version (method arguments) strings into string chunks (i.e. if string = 2.0.4, then ints are 2,0,4). The string chunks are then converted to ints and compared one at a time. If a latest version chunk is > than a current version chunk an update is available and UPDATEVERSION is returned. If all chunks are equal then NOUPDATEVERSION is available. The boolean throw exception controls whether the VersionNumberCompare exception will be thrown when a latestversion chunk is less than a current version chunk.