com.aragost.javahg
Class HgVersion

java.lang.Object
  extended by com.aragost.javahg.HgVersion
All Implemented Interfaces:
Comparable<HgVersion>

public class HgVersion
extends Object
implements Comparable<HgVersion>

Representing a Mercurial version.

The version has the format [major].[minor]{.[release]}{-rc}{+[suffix]} where parts enclosed in {...} is optional. The major, minor, and release part can at most be 2 digits, the suffix part can be any string.


Method Summary
 int compareTo(HgVersion that)
          Compare this to the other version.
static HgVersion fromString(String versionString)
          Factory method to create a HgVersion from a version string from Mercurial
 int getMajor()
           
 int getMinor()
           
 Integer getRelease()
           
 String getSuffix()
           
 String getVersionString()
           
 boolean isBefore(HgVersion ver)
           
 boolean isReleaseCandidate()
           
 boolean isUnknown()
           
 String toString()
           
static HgVersion unknown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

fromString

public static HgVersion fromString(String versionString)
Factory method to create a HgVersion from a version string from Mercurial

Examples of valid input:


unknown

public static HgVersion unknown()
Returns:
a HgVersion representing the unknow version

getVersionString

public String getVersionString()
Returns:
the String that this HgVersion was created from

getMajor

public int getMajor()
Returns:
the major (i.e. first) version number

getMinor

public int getMinor()
Returns:
the minor (i.e. second) version number

getRelease

public Integer getRelease()
Returns:
the release (i.e. third and last) version number

isReleaseCandidate

public boolean isReleaseCandidate()
Returns:
true if the version number is a relase candidate, otherwise false

getSuffix

public String getSuffix()
Returns:
the suffix part

isUnknown

public boolean isUnknown()
Returns:
true if the receiver is a unknown instance.

compareTo

public int compareTo(HgVersion that)
Compare this to the other version.

All parts of the version is used except the suffix part.

Specified by:
compareTo in interface Comparable<HgVersion>

isBefore

public boolean isBefore(HgVersion ver)
Parameters:
ver -
Returns:
true if the receiver is strictly an earlier version than the argument

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011-2013 aragost Trifork ag. All Rights Reserved.