diff options
Diffstat (limited to 'src/main/java/org/openslx/virtualization/Version.java')
-rw-r--r-- | src/main/java/org/openslx/virtualization/Version.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/virtualization/Version.java b/src/main/java/org/openslx/virtualization/Version.java index 698e22e..fbd1bda 100644 --- a/src/main/java/org/openslx/virtualization/Version.java +++ b/src/main/java/org/openslx/virtualization/Version.java @@ -201,6 +201,28 @@ public class Version implements Comparable<Version> } /** + * Checks if this version is smaller than a specified {@code version}. + * + * @param version for comparison. + * @return state whether this version is smaller than the specified {@code version} or not. + */ + public boolean isSmallerThan( Version version ) + { + return ( this.compareTo( version ) < 0 ) ? true : false; + } + + /** + * Checks if this version is greater than a specified {@code version}. + * + * @param version for comparison. + * @return state whether this version is greater than the specified {@code version} or not. + */ + public boolean isGreaterThan( Version version ) + { + return ( this.compareTo( version ) > 0 ) ? true : false; + } + + /** * Creates a new version parsed from a {@link String}. * * The version consists of a major and a minor version parsed from the specified {@link String}. @@ -238,6 +260,16 @@ public class Version implements Comparable<Version> } @Override + public String toString() + { + if ( this.getName() == null || this.getName().isEmpty() ) { + return String.format( "%d.%d", this.getMajor(), this.getMinor() ); + } else { + return String.format( "%d.%d %s", this.getMajor(), this.getMinor(), this.getName() ); + } + } + + @Override public boolean equals( Object obj ) { if ( obj == null ) { |