Package org.jboss.logging.processor.util
Class VersionComparator
- java.lang.Object
-
- org.jboss.logging.processor.util.VersionComparator
-
- All Implemented Interfaces:
java.util.Comparator<java.lang.String>
public class VersionComparator extends java.lang.Object implements java.util.Comparator<java.lang.String>
Compares 2 different version strings. The version strings must be valid integers separated by.
(dots). Date: 09.11.2011
-
-
Field Summary
Fields Modifier and Type Field Description static VersionComparator
INSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description private
VersionComparator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(java.lang.String o1, java.lang.String o2)
static int
compareVersion(java.lang.String version1, java.lang.String version2)
Compares the first version to the second version and returns, 0 if they are equal, a value less than 0 if the first version is less than the second version or a value greater than 0 if the first version is greater than the second version.private static java.util.List<java.lang.Integer>
convert(java.lang.String[] version, int len)
-
-
-
Field Detail
-
INSTANCE
public static VersionComparator INSTANCE
-
-
Method Detail
-
compareVersion
public static int compareVersion(java.lang.String version1, java.lang.String version2)
Compares the first version to the second version and returns, 0 if they are equal, a value less than 0 if the first version is less than the second version or a value greater than 0 if the first version is greater than the second version.- Parameters:
version1
- the first version to compare.version2
- the second version to compare.- Returns:
- a value of 0 if the versions are equal, less than 0 if
version1
is less thanversion2
, a value greater than 0 ifversion1
is greater thanversion2
.
-
compare
public int compare(java.lang.String o1, java.lang.String o2)
- Specified by:
compare
in interfacejava.util.Comparator<java.lang.String>
-
convert
private static java.util.List<java.lang.Integer> convert(java.lang.String[] version, int len)
-
-