Class Versions
java.lang.Object
org.nuiton.version.Versions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 booleanTests 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 VersionShortcut method to get a version from his string representation.
-
Constructor Details
-
Versions
public Versions()
-
-
Method Details
-
valueOf
-
equals
-
smallerThan
-
greaterThan
-
addSnapshot
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
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
-
extractVersion
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
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
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
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
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
-