diff options
author | Manuel Bentele | 2021-05-10 09:51:43 +0200 |
---|---|---|
committer | Manuel Bentele | 2021-05-10 09:51:43 +0200 |
commit | 15b7fb9f9e6770696f568b0239d2ffec34000e56 (patch) | |
tree | f7c8f178bc1a3056b3a682c26d18ada2aa72616b /src/main/java/org/openslx/virtualization/Version.java | |
parent | Optimize OS detection for Libvirt/QEMU virtualization configurations (diff) | |
download | master-sync-shared-15b7fb9f9e6770696f568b0239d2ffec34000e56.tar.gz master-sync-shared-15b7fb9f9e6770696f568b0239d2ffec34000e56.tar.xz master-sync-shared-15b7fb9f9e6770696f568b0239d2ffec34000e56.zip |
Fix HDD detection in VirtualBox configurations newer or equal than v1.17
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 ) { |