r2687 - trunk/src/main/java/org/nuiton/util/version
Author: tchemit Date: 2014-09-13 08:34:31 +0200 (Sat, 13 Sep 2014) New Revision: 2687 Url: http://forge.nuiton.org/projects/nuiton-utils/repository/revisions/2687 Log: fixes #3511: Add Version#afterOrEquals and Version#beforeOrEquals methods Modified: trunk/src/main/java/org/nuiton/util/version/Version.java Modified: trunk/src/main/java/org/nuiton/util/version/Version.java =================================================================== --- trunk/src/main/java/org/nuiton/util/version/Version.java 2014-09-11 16:03:49 UTC (rev 2686) +++ trunk/src/main/java/org/nuiton/util/version/Version.java 2014-09-13 06:34:31 UTC (rev 2687) @@ -303,6 +303,15 @@ /** * @param o the other version to test + * @return {@code true} if current version is before or equals the given one + */ + public boolean beforeOrequals(Version o) { + int result = compareTo(o); + return result <= 0; + } + + /** + * @param o the other version to test * @return <code>true</code> if current version is before the given one */ public boolean before(Version o) { @@ -312,6 +321,15 @@ /** * @param o the other version to test + * @return {@code true} if current version is after or equals the given one + */ + public boolean afterOrEquals(Version o) { + int result = compareTo(o); + return result >= 0; + } + + /** + * @param o the other version to test * @return <code>true</code> if current version is after the given one */ public boolean after(Version o) {
participants (1)
-
tchemit@users.nuiton.org