webfunds.utils
Class VersionNumbers

java.lang.Object
  |
  +--webfunds.utils.VersionNumbers

public class VersionNumbers
extends java.lang.Object

Work out version numbers embedded in file names. A version number is a series of {dash number} where there is a leading dash and all numbers are separated by dash. -1 -1-2-3 The version number must be the last component in the string. Note that plugins and wallets use this code.


Constructor Summary
VersionNumbers()
           
 
Method Summary
static void check(boolean result, java.lang.String one, java.lang.String two)
          throws an Ex if false.
static void checkEx(java.lang.String one, java.lang.String two)
          Must throw an exception.
protected static void checkOutDirectory(java.io.File dir)
           
protected static java.lang.String[] getList(java.io.File dir)
           
static java.lang.String[] getListOfAddOns(java.io.File dir)
          Note that plugins and wallets use this code.
static java.lang.String[] getListOfAddOns(java.io.File dir, java.io.PrintWriter callerBug)
          Note that plugins and wallets use this code.
static int[] getVersionsFromString(java.lang.String versionString)
          Looks for the first dash '-' and then looks for a triplet of numbers after that, something like 1.2.3 or 3-2-1.
static boolean isGreater(java.lang.String one, java.lang.String two)
          is one greater than two? Empty string or null counts as version -1.
static void main(java.lang.String[] arg)
          Test the comparisons.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionNumbers

public VersionNumbers()
Method Detail

getListOfAddOns

public static java.lang.String[] getListOfAddOns(java.io.File dir)
Note that plugins and wallets use this code.
Returns:
a list of latest-version plugin directories.

getListOfAddOns

public static java.lang.String[] getListOfAddOns(java.io.File dir,
                                                 java.io.PrintWriter callerBug)
Note that plugins and wallets use this code.
Returns:
a list of latest-version plugin directories.

checkOutDirectory

protected static void checkOutDirectory(java.io.File dir)

getList

protected static java.lang.String[] getList(java.io.File dir)

isGreater

public static boolean isGreater(java.lang.String one,
                                java.lang.String two)
                         throws java.lang.NumberFormatException
is one greater than two? Empty string or null counts as version -1.
Returns:
true if one is a more recent version than two, else false

getVersionsFromString

public static int[] getVersionsFromString(java.lang.String versionString)
                                   throws java.lang.NumberFormatException
Looks for the first dash '-' and then looks for a triplet of numbers after that, something like 1.2.3 or 3-2-1.
Returns:
list of ints that correspond to this version

main

public static void main(java.lang.String[] arg)
Test the comparisons.

check

public static void check(boolean result,
                         java.lang.String one,
                         java.lang.String two)
throws an Ex if false.

checkEx

public static void checkEx(java.lang.String one,
                           java.lang.String two)
Must throw an exception.