本文整理汇总了Java中com.github.zafarkhaja.semver.Version.greaterThan方法的典型用法代码示例。如果您正苦于以下问题:Java Version.greaterThan方法的具体用法?Java Version.greaterThan怎么用?Java Version.greaterThan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.zafarkhaja.semver.Version
的用法示例。
在下文中一共展示了Version.greaterThan方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUniqueLibraries
import com.github.zafarkhaja.semver.Version; //导入方法依赖的package包/类
/**
* Given a number of profiles, return distinct libraries with their highest version
* @param profiles
* @return a {@link Map} containing unique library names -> highest version
*/
public static Map<String,String> getUniqueLibraries(Collection<LibProfile> profiles) {
HashMap<String,String> result = new HashMap<String,String>();
for (LibProfile p: profiles) {
if (!result.containsKey(p.description.name))
result.put(p.description.name, p.description.version);
else {
try {
Version v1 = VersionWrapper.valueOf(result.get(p.description.name));
Version v2 = VersionWrapper.valueOf(p.description.version);
if (v2.greaterThan(v1))
result.put(p.description.name, p.description.version);
} catch (Exception e) { /* if at least one version is not semver compliant */ }
}
}
return result;
}
示例2: getReport
import com.github.zafarkhaja.semver.Version; //导入方法依赖的package包/类
private static ReleaseReport getReport(ReleaseResponse response) {
String githubVersion = extractVersion(response);
Version build = Version.valueOf(SteveConfiguration.CONFIG.getSteveVersion());
Version github = Version.valueOf(githubVersion);
boolean isGithubMoreRecent = github.greaterThan(build);
String downloadUrl = decideDownloadUrl(response);
ReleaseReport ur = new ReleaseReport(isGithubMoreRecent);
ur.setGithubVersion(githubVersion);
ur.setDownloadUrl(downloadUrl);
ur.setHtmlUrl(response.getHtmlUrl());
return ur;
}
示例3: isVersionNewer
import com.github.zafarkhaja.semver.Version; //导入方法依赖的package包/类
private static boolean isVersionNewer(final String tag) {
String currentVersionTag = LsGuiUtils.readVersionProperty();
final Version currentVersion = Version.valueOf(currentVersionTag);
final String realVersionTag = tag.substring(1);
final Version newVersion = Version.valueOf(realVersionTag);
if (currentVersion.getPreReleaseVersion().toLowerCase(Locale.ENGLISH).contains("snapshot")) {
LOGGER.info("Running development version!");
}
return newVersion.greaterThan(currentVersion);
}
示例4: checkForUpdates
import com.github.zafarkhaja.semver.Version; //导入方法依赖的package包/类
public void checkForUpdates(final OnUpdateCheck onUpdateCheck) {
JsonArrayRequest request = new JsonArrayRequest(UPDATE_URL, response -> {
try {
String version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
if (response.length() > 0) {
JSONObject latest = response.getJSONObject(0);
String url = latest.getString("html_url");
String tag = latest.getString("tag_name");
String name = latest.getString("name");
String description = latest.getString("body");
String downloadUrl = latest.getJSONArray("assets").getJSONObject(0).getString("browser_download_url");
Version current = Version.valueOf(version);
Version remote = Version.valueOf(tag);
if (remote.greaterThan(current)) {
G.logD("New update available at " + url);
onUpdateCheck.onNewRelease(name, description, url, downloadUrl);
} else {
onUpdateCheck.onCurrentRelease();
}
}
} catch (Exception e) {
e.printStackTrace();
onUpdateCheck.onUpdateCheckError(e);
return;
}
}, error -> {
G.logD("Error fetching releases feed: " + error.toString());
onUpdateCheck.onUpdateCheckError(error);
});
requestQueue.add(request);
}
示例5: interpret
import com.github.zafarkhaja.semver.Version; //导入方法依赖的package包/类
/**
* Checks if the current version is greater than the parsed version.
*
* @param version
* the version to compare to, the left-hand operand of the "greater than" operator
* @return {@code true} if the version is greater than the parsed version or {@code false}
* otherwise
*/
@Override
public boolean interpret(Version version) {
return version.greaterThan(parsedVersion);
}