marf
Class Version

java.lang.Object
  extended by marf.Version

public class Version
extends java.lang.Object

Responsible for providing and validating version information of MARF. A version should be bumped here at the beginning of every release cycle according to the versioning guidelines outlined in the manual.

$Id: Version.java,v 1.6 2007/12/31 00:17:05 mokhov Exp $

Since:
0.3.0.5
Author:
Serguei Mokhov

Field Summary
static int MAJOR_VERSION
          Indicates major MARF version, like 1.x.x.
static int MINOR_REVISION
          Indicates MARF minor development revision, like 1.1.1.1.
static int MINOR_VERSION
          Indicates minor MARF version, like 1.1.x.
private static java.lang.String PACKAGE
          Should be automatically replaced through scripting when compiling smaller binaries of MARF, e.g.
static int REVISION
          Indicates MARF revision, like 1.1.1.
 
Constructor Summary
Version()
           
 
Method Summary
private static void errorOut(java.lang.String pstrStringVersion, boolean pbExactMatch)
          Just a helper method for code reuse to throw an exception with the version validation error message given parameters.
static double getDoubleVersion()
          Retrieves double version of MARF.
static int getIntVersion()
          Returns an integer representation of the MARF version.
static java.lang.String getMARFSourceCodeRevision()
          Retrieves class' revision.
private static java.lang.String getPackageInfo()
          Helper method to append package information.
static java.lang.String getStringVersion()
          Returns a string representation of the MARF version.
static java.lang.String getStringVersion(double pdDoubleVersion)
          Returns a string representation of the MARF version given its floating point equivalent.
static java.lang.String getStringVersion(int piIntVersion)
          Returns a string representation of the MARF version given its integer equivalent.
static void validateVersions(double pdDoubleVersion)
          Makes sure the applications aren't run against older MARF version.
static void validateVersions(double pdDoubleVersion, boolean pbExactMatch)
          Makes sure the applications aren't run against an older MARF or exact matching library version.
static void validateVersions(int piIntVersion)
          Makes sure the applications aren't run against older MARF version.
static void validateVersions(int piIntVersion, boolean pbExactMatch)
          Makes sure the applications aren't run against an older MARF or exact matching library version.
static void validateVersions(java.lang.String pstrStringVersion)
          Makes sure the applications aren't run against older MARF version.
static void validateVersions(java.lang.String pstrStringVersion, boolean pbExactMatch)
          Makes sure the applications aren't run against an older MARF or exact matching library version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAJOR_VERSION

public static final int MAJOR_VERSION
Indicates major MARF version, like 1.x.x.

See Also:
Constant Field Values

MINOR_VERSION

public static final int MINOR_VERSION
Indicates minor MARF version, like 1.1.x.

See Also:
Constant Field Values

REVISION

public static final int REVISION
Indicates MARF revision, like 1.1.1.

See Also:
Constant Field Values

MINOR_REVISION

public static final int MINOR_REVISION
Indicates MARF minor development revision, like 1.1.1.1. This is primarily for development releases. On the final release the counting stops and is reset to 0 every minor version.

See Also:
MINOR_VERSION, Constant Field Values

PACKAGE

private static final java.lang.String PACKAGE
Should be automatically replaced through scripting when compiling smaller binaries of MARF, e.g. marf-util, marf-math, or marf-nlp, etc. packages, the corresponding suffix (i.e. "util", "nlp", ...) should end up being in this constant and then compiled. This suffix is appended all string variants of the version. The default fat MARF should not contain anything.

See Also:
Constant Field Values
Constructor Detail

Version

public Version()
Method Detail

getStringVersion

public static final java.lang.String getStringVersion()
Returns a string representation of the MARF version.

Returns:
version String
See Also:
MINOR_REVISION

getStringVersion

public static final java.lang.String getStringVersion(double pdDoubleVersion)
Returns a string representation of the MARF version given its floating point equivalent. E.g. 30.5 becomes "0.3.0.5".

Parameters:
pdDoubleVersion - the floating point equivalent of the version
Returns:
version String

getStringVersion

public static final java.lang.String getStringVersion(int piIntVersion)
Returns a string representation of the MARF version given its integer equivalent. E.g. 1306 becomes "0.3.0.6".

Parameters:
piIntVersion - the integer equivalent of the version
Returns:
version String
Since:
0.3.0.6

getIntVersion

public static final int getIntVersion()
Returns an integer representation of the MARF version. As of 0.3.0.3, MINOR_REVISION is included into calculations and the formula changed to begin with 1000 as a MAJOR_VERSION coefficient.

Returns:
integer version as MAJOR_VERSION * 1000 + MINOR_VERSION * 100 + REVISION * 10 + MINOR_REVISION
See Also:
MAJOR_VERSION, MINOR_VERSION, REVISION, MINOR_REVISION

getDoubleVersion

public static final double getDoubleVersion()
Retrieves double version of MARF. Unlike the integer version, the double one begins with 100 and the minor revision is returned after the point, e.g. 123.4 for 1.2.3.4.

Returns:
double version as MAJOR_VERSION * 100 + MINOR_VERSION * 10 + REVISION + MINOR_REVISION / 10
See Also:
MAJOR_VERSION, MINOR_VERSION, REVISION, MINOR_REVISION

validateVersions

public static final void validateVersions(double pdDoubleVersion)
                                   throws MARFException
Makes sure the applications aren't run against older MARF version.

Parameters:
pdDoubleVersion - floating point version representation to validate
Throws:
MARFException - if the MARF's version is too old

validateVersions

public static final void validateVersions(double pdDoubleVersion,
                                          boolean pbExactMatch)
                                   throws MARFException
Makes sure the applications aren't run against an older MARF or exact matching library version.

Parameters:
pdDoubleVersion - floating point version representation to validate
pbExactMatch - if set to true the exact version match will be required
Throws:
MARFException - if the MARF's version is too old or isn't matching
Since:
0.3.0.6

validateVersions

public static final void validateVersions(int piIntVersion)
                                   throws MARFException
Makes sure the applications aren't run against older MARF version.

Parameters:
piIntVersion - integer version representation to validate
Throws:
MARFException - if the MARF library's version is too old
Since:
0.3.0.6

validateVersions

public static final void validateVersions(int piIntVersion,
                                          boolean pbExactMatch)
                                   throws MARFException
Makes sure the applications aren't run against an older MARF or exact matching library version.

Parameters:
piIntVersion - integer version representation to validate
pbExactMatch - if set to true the exact version match will be required
Throws:
MARFException - if the MARF library's version is too old or isn't matching
Since:
0.3.0.6

validateVersions

public static final void validateVersions(java.lang.String pstrStringVersion)
                                   throws MARFException
Makes sure the applications aren't run against older MARF version.

Parameters:
pstrStringVersion - String representation of the required version
Throws:
MARFException - if the MARF's version is too old
java.lang.NullPointerException - if the parameter is null

validateVersions

public static final void validateVersions(java.lang.String pstrStringVersion,
                                          boolean pbExactMatch)
                                   throws MARFException
Makes sure the applications aren't run against an older MARF or exact matching library version.

Parameters:
pstrStringVersion - String version representation to validate
pbExactMatch - if set to true the exact version match will be required
Throws:
MARFException - if the MARF's version is too old or isn't matching
Since:
0.3.0.6

errorOut

private static void errorOut(java.lang.String pstrStringVersion,
                             boolean pbExactMatch)
                      throws MARFException
Just a helper method for code reuse to throw an exception with the version validation error message given parameters.

Parameters:
pstrStringVersion - expected version
pbExactMatch - if true modifies the error message to require exactly the mentioned version and if false, simply says this version or above.
Throws:
MARFException - with the error message of the version mismatch
Since:
0.3.0.6

getPackageInfo

private static java.lang.String getPackageInfo()
Helper method to append package information.

Returns:
package string if it is not empty preceded with a dash.
Since:
0.3.0.6

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Retrieves class' revision.

Returns:
revision string


SourceForge Logo