Package org.nuiton.version
Class Versions
- java.lang.Object
 - 
- org.nuiton.version.Versions
 
 
- 
- 
Constructor Summary
Constructors Constructor Description Versions() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static VersionaddSnapshot(Version version)Create a version from the given one and set to it thesnapshotstate totrue.static Versiondecrements(Version version, int componantPosition)Creates a new version from this one with the number componant decremented at the given position.static booleanequals(String version0, String version1)Tests if two versions are equals.static VersionextractVersion(Version version, int component)Create a new version containing a single component from a given version.static VersionextractVersion(Version version, int firstComponent, int lastComponent)Create a new version containing a sub set of component from a given version.static booleangreaterThan(String version0, String version1)Tests if the first version is greater than the second version.static Versionincrements(Version version)Creates a new version from this one incremented.static Versionincrements(Version version, char componantSeperator)Creates a new version from this one incremented.static Versionincrements(Version version, int componantPosition)Creates a new version from this one with the number componant incremented at the given position.static VersionremoveSnapshot(Version version)Create a version from the given one and set to it thesnapshotstate tofalse.static booleansmallerThan(String version0, String version1)Tests if the first version is smaller than the second version.static VersionvalueOf(String version)Shortcut method to get a version from his string representation. 
 - 
 
- 
- 
Method Detail
- 
valueOf
public static Version valueOf(String version)
Shortcut method to get a version from his string representation.- Parameters:
 version- string representation of the version- Returns:
 - converted version from the string representation
 
 
- 
equals
public static boolean equals(String version0, String version1)
Tests if two versions are equals.- Parameters:
 version0- the first versionversion1- the second version- Returns:
 trueif versions are equals,falseotherwise.
 
- 
smallerThan
public static boolean smallerThan(String version0, String version1)
Tests if the first version is smaller than the second version.- Parameters:
 version0- the first versionversion1- the second version- Returns:
 trueifversion0is beforeversion1,falseotherwise.
 
- 
greaterThan
public static boolean greaterThan(String version0, String version1)
Tests if the first version is greater than the second version.- Parameters:
 version0- the first versionversion1- the second version- Returns:
 trueifversion0is afterversion1,falseotherwise.
 
- 
addSnapshot
public static Version addSnapshot(Version version)
Create a version from the given one and set to it thesnapshotstate totrue.- Parameters:
 version- version to clone- Returns:
 - the cloned version with the 
snapshotstate totrue - Throws:
 IllegalArgumentException- ifsnapshotstate is already set totrueon the givenversion.
 
- 
removeSnapshot
public static Version removeSnapshot(Version version)
Create a version from the given one and set to it thesnapshotstate tofalse.- Parameters:
 version- version to clone- Returns:
 - the cloned version with the 
snapshotstate totrue - Throws:
 IllegalArgumentException- ifsnapshotstate is already set tofalseon the givenversion
 
- 
extractVersion
public static Version extractVersion(Version version, int component)
Create a new version containing a single component from a given version.- Parameters:
 version- original versioncomponent- component index to extract- Returns:
 - new 
Versionwith a single component 
 
- 
extractVersion
public static Version extractVersion(Version version, int firstComponent, int lastComponent)
Create a new version containing a sub set of component from a given version.- Parameters:
 version- original versionfirstComponent- first component indexlastComponent- last component index- Returns:
 - new 
Versionwith a components sub set 
 
- 
increments
public static Version increments(Version version)
Creates a new version from this one incremented.If the last componant is a number, then just increments this number; otherwise add a new number componant with value 1.
Example:
- 1 → 2
 - 1-a → 1-a.1
 
- Parameters:
 version- FIXME- Returns:
 - the incremented version
 
 
- 
increments
public static Version increments(Version version, char componantSeperator)
Creates a new version from this one incremented.If the last componant is a number, then just increments this number; otherwise add a new number componant with value 1.
Example:
- 1 → 2
 - 1-a → 1-a.1
 
- Parameters:
 version- FIXMEcomponantSeperator- the componant separator to use the last componant is a classifier- Returns:
 - the incremented version
 
 
- 
increments
public static Version increments(Version version, int componantPosition)
Creates a new version from this one with the number componant incremented at the given position.Note: Will fail if the componant at the required position is not a number.
- Parameters:
 version- FIXMEcomponantPosition- position of the version componant to increment- Returns:
 - the incremented version
 
 
- 
decrements
public static Version decrements(Version version, int componantPosition)
Creates a new version from this one with the number componant decremented at the given position.Note: Will fail if the componant at the required position is not a number, or his value is 0.
- Parameters:
 version- FIXMEcomponantPosition- position of the version componant to increment- Returns:
 - the decremented version
 
 
 - 
 
 -