net.sf.doolin.util
Class Version

java.lang.Object
  extended by net.sf.doolin.util.Version
All Implemented Interfaces:
Comparable<Version>

public class Version
extends Object
implements Comparable<Version>

Definition of a version on one or more numbers.

Author:
Damien Coraboeuf

Field Summary
static int MAJOR
          Position of the major version number
static int MINOR
          Position of the minor version number
static int PATCH
          Position of the patch version number
 
Constructor Summary
Version()
          0.0.0 version
Version(int... numbers)
          Constructor
Version(String value)
          Parsing of a version number
 
Method Summary
 int compareTo(Version v)
          Compares two versions
 boolean equals(Object obj)
           
 int getDimension()
          Returns the number of versions numbers
 int getMajor()
           
 int getMinor()
           
 int getNumber(int position)
           
 int getPatch()
           
 int hashCode()
           
 int[] toArray()
          Gets a copy of the version array.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAJOR

public static final int MAJOR
Position of the major version number

See Also:
Constant Field Values

MINOR

public static final int MINOR
Position of the minor version number

See Also:
Constant Field Values

PATCH

public static final int PATCH
Position of the patch version number

See Also:
Constant Field Values
Constructor Detail

Version

public Version(int... numbers)
Constructor

Parameters:
numbers - Version numbers, from the most major to the most minor

Version

public Version(String value)
Parsing of a version number

Parameters:
value - String to parse.

Version

public Version()
0.0.0 version

Method Detail

getNumber

public int getNumber(int position)
Parameters:
position - Position to get (must be >= 0)
Returns:
Returns the version number at the specified position. If this position is not defined, returns 0.

getMajor

public int getMajor()
Returns:
Returns the major.

getMinor

public int getMinor()
Returns:
Returns the minor.

getPatch

public int getPatch()
Returns:
Returns the patch.

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

getDimension

public int getDimension()
Returns the number of versions numbers

Returns:
Number of version numbers

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

toArray

public int[] toArray()
Gets a copy of the version array.

Returns:
Version numbers

compareTo

public int compareTo(Version v)
Compares two versions

Specified by:
compareTo in interface Comparable<Version>
Parameters:
v - Version to compare to.
Returns:
Result of comparison.


Copyright © 2011. All Rights Reserved.