Author: tchemit Date: 2010-03-10 19:24:09 +0100 (Wed, 10 Mar 2010) New Revision: 1799 Log: add usefull methods on VersionUtil Modified: trunk/src/main/java/org/nuiton/util/VersionUtil.java Modified: trunk/src/main/java/org/nuiton/util/VersionUtil.java =================================================================== --- trunk/src/main/java/org/nuiton/util/VersionUtil.java 2010-03-10 15:18:38 UTC (rev 1798) +++ trunk/src/main/java/org/nuiton/util/VersionUtil.java 2010-03-10 18:24:09 UTC (rev 1799) @@ -347,6 +347,50 @@ } /** + * Tests if two versions are equals. + * + * @param version0 the first version + * @param version1 the second version + * @return {@code true} if versions are equals, {@code false} otherwise. + */ + public static boolean equals(String version0, String version1) { + Version v0 = valueOf(version0); + Version v1 = valueOf(version1); + boolean result = v0.equals(v1); + return result; + } + + /** + * Tests if the first version is smaller than the second version. + * + * @param version0 the first version + * @param version1 the second version + * @return {@code true} if {@code version0} is before {@code version1}, + * {@code false} otherwise. + */ + public static boolean smallerThan(String version0, String version1) { + Version v0 = valueOf(version0); + Version v1 = valueOf(version1); + boolean result = v0.before(v1); + return result; + } + + /** + * Tests if the first version is greater than the second version. + * + * @param version0 the first version + * @param version1 the second version + * @return {@code true} if {@code version0} is after {@code version1}, + * {@code false} otherwise. + */ + public static boolean greaterThan(String version0, String version1) { + Version v0 = valueOf(version0); + Version v1 = valueOf(version1); + boolean result = v0.after(v1); + return result; + } + + /** * Trier un ensemble de versions données en entrees * * On affiche le resultat dans la console