com.synopsys.integration.blackduck.version.BlackDuckVersion Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of blackduck-common Show documentation
Show all versions of blackduck-common Show documentation
A library for using various capabilities of Black Duck, notably the REST API and signature scanning.
/*
* blackduck-common
*
* Copyright (c) 2023 Synopsys, Inc.
*
* Use subject to the terms and conditions of the Synopsys End User Software License and Maintenance Agreement. All rights reserved worldwide.
*/
package com.synopsys.integration.blackduck.version;
import com.synopsys.integration.util.Stringable;
public class BlackDuckVersion extends Stringable {
private final int major;
private final int minor;
private final int patch;
public BlackDuckVersion(int major, int minor, int patch) {
this.major = major;
this.minor = minor;
this.patch = patch;
}
public int getMajor() {
return major;
}
public int getMinor() {
return minor;
}
public int getPatch() {
return patch;
}
/**
* Compares this version of BlackDuck with the one in the other parameter.
*
* @param other the BlackDuck version to compare to this one.
* @return returns true if the other BlackDuck version is equal to (has the same
* major, minor, and patch) or later (is a greater version according to
* SemVer). Returns false otherwise.
*/
public boolean isAtLeast(BlackDuckVersion other) {
if (major > other.getMajor()) {
return true;
}
if (major < other.getMajor()) {
return false;
}
if (minor > other.getMinor()) {
return true;
}
if (minor < other.getMinor()) {
return false;
}
if (patch > other.getPatch()) {
return true;
}
if (patch < other.getPatch()) {
return false;
}
return true;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy