Class Version
java.lang.Object
de.uni_hildesheim.sse.easy.loader.framework.Version
Represents a version number.
- Author:
- Holger Eichelberger
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCompares two versions and results in: -1 : this is smaller <=> given version and this is bigger.intgetSegment(int index) Returns the version segment specified byindex.intReturns the number of the segments.booleanChecks whether the version is within a certain range of versions.toString()Returns a textual representation of this instance.
-
Field Details
-
SEPARATOR
- See Also:
-
segments
private int[] segments -
suffixes
-
-
Constructor Details
-
Version
Creates a new version by parsing a string.- Parameters:
version- the version string in form i(.i)* with i integer numbers- Throws:
BundleException- in case of format problems
-
-
Method Details
-
toString
Returns a textual representation of this instance. -
getSegmentCount
public int getSegmentCount()Returns the number of the segments.- Returns:
- the number of segments
-
getSegment
public int getSegment(int index) Returns the version segment specified byindex.- Parameters:
index- a 0-based index specifying the segment to be returned- Returns:
- the specified segment
- Throws:
IndexOutOfBoundsException- ifindex<0 || index>=getSegmentCount()
-
compareTo
Compares two versions and results in: -1 : this is smaller <=> given version and this is bigger. 0 : given version and this are equal. +1 : this is bigger <=> given version is smaller.- Parameters:
version- version to compare.- Returns:
- result in {-1, 0, 1}.
-
isInRange
Checks whether the version is within a certain range of versions.- Parameters:
min- Minimal version that is allowed. Can be null to represent no minimum.max- Maximal version that is allowed. Can be null to represent no maximum.- Returns:
- boolean True if version is within the range.
-