当前位置: 首页>>代码示例>>Java>>正文


Java Version.greaterThan方法代码示例

本文整理汇总了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;
}
 
开发者ID:reddr,项目名称:LibScout,代码行数:23,代码来源:LibProfile.java

示例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;
}
 
开发者ID:RWTH-i5-IDSG,项目名称:steve-plugsurfing,代码行数:16,代码来源:GithubReleaseCheckService.java

示例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);
}
 
开发者ID:westerwave,项目名称:livestreamer_twitch_gui,代码行数:11,代码来源:GithubUpdateService.java

示例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);
}
 
开发者ID:urandom,项目名称:gearshift,代码行数:38,代码来源:GearShiftApplication.java

示例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);
}
 
开发者ID:Kurento,项目名称:kurento-module-creator,代码行数:13,代码来源:Greater.java


注:本文中的com.github.zafarkhaja.semver.Version.greaterThan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。