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


Java Version.compareTo方法代码示例

本文整理汇总了Java中org.eclipse.equinox.p2.metadata.Version.compareTo方法的典型用法代码示例。如果您正苦于以下问题:Java Version.compareTo方法的具体用法?Java Version.compareTo怎么用?Java Version.compareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.equinox.p2.metadata.Version的用法示例。


在下文中一共展示了Version.compareTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkIfFeatureExist

import org.eclipse.equinox.p2.metadata.Version; //导入方法依赖的package包/类
private boolean checkIfFeatureExist(String featureID, Iterator<IInstallableUnit> iterator) {
	System.out.println("Received Feature ID with Version : " + featureID);
	String[] featureInfo = featureID.split("_");
	String updatedFeatureID = featureInfo[0];
	System.out.println("The version being tested : " + featureInfo[1]);
	Version featureVersion = generateOSGIVersion(featureInfo[1]);
	updatedFeatureID = updatedFeatureID + "." + FEATURE_JAR_IU_ID_SFX;
	System.out.println("Checking Availability of " + updatedFeatureID + "Version  : " + featureVersion
			+ " in the given repository");
	while (iterator.hasNext()) {
		IInstallableUnit iu = iterator.next();
		String featureIuId = iu.getId();
		Version IUVersion = iu.getVersion();
		if (featureIuId != null && featureIuId.startsWith(WSO2_FEATURE_PREFIX)
				&& featureIuId.endsWith(FEATURE_JAR_IU_ID_SFX)) {
			if (featureIuId.equals(updatedFeatureID)) {
				if (IUVersion.compareTo(featureVersion) == 0) {
					System.out.println(
							"\n===========================xxxxxxxxxxxxxxxxxxx==================================\n");
					System.out.println("-------------------------P2 Structure is valid----------------- \n \n ");
					System.out.println("\n=====================================================================\n");
					System.out.println("\n=====================================================================\n");
					System.out.println("===========          " + featureID + " Version  : " + featureVersion
							+ "   is Available in the Updates Repository          =============\n");
					System.out.println("\n=====================================================================\n");
					return true;
				}
			}
		}
	}
	System.out.println("\n=====================================================================\n");
	System.out.println("\n=====================================================================\n");
	System.out.println("=========== " + updatedFeatureID + "Version  : " + featureVersion
			+ " is not available in the given repository, Exiting system with error code ======================");
	return false;
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:37,代码来源:CheckUpdatesManager.java

示例2: checkIfUpdatesAvailable

import org.eclipse.equinox.p2.metadata.Version; //导入方法依赖的package包/类
private IStatus checkIfUpdatesAvailable(IProgressMonitor monitor) {
	SubMonitor progress = SubMonitor.convert(monitor, Messages.UpdateCheckerJob_1, SUB_MONITOR_INDEX);
	Collection<IInstallableUnit> installedWSO2Features = updateManager
			.getInstalledWSO2Features(progress.newChild(1));
	BufferedReader buffReader = downloadMetaFile();
	// read the meta file
	if (buffReader == null) {
		promptUserError(Messages.UpdateMetaFileReaderJob_3, ERROR_TITLE);
		return Status.CANCEL_STATUS;
	}
	Map<String, String> availaleDevStudioFeatureVerions = new HashMap<String, String>();
	availaleDevStudioFeatureVerions = readMetaDataFiletoMap(buffReader);
	deleteDownloadedTempFile();
	if (availaleDevStudioFeatureVerions.isEmpty()) {
		log.error(Messages.UpdateCheckerJob_4);
		return Status.CANCEL_STATUS;
	}
	for (IInstallableUnit iInstallableUnit : installedWSO2Features) {
		if (availaleDevStudioFeatureVerions.containsKey(iInstallableUnit.getId())) {
			Version availableVersion = generateVersionFromString(
					availaleDevStudioFeatureVerions.get(iInstallableUnit.getId()));
			Version upperLimit = generateUpperLimitforUpdates(iInstallableUnit.getVersion());
			if (availableVersion != null
					&& availableVersion.compareTo(iInstallableUnit.getVersion()) == AVAILABLE_VERSION_GREATER
					&& availableVersion.compareTo(upperLimit) == AVAILABLE_VERSION_LESS) {
				updateCount = updateCount + 1;
			} else if (availableVersion == null) {
				log.error(Messages.UpdateCheckerJob_4);
				promptUserError(ERROR_MESSAGE, ERROR_TITLE);
				return Status.CANCEL_STATUS;
			}
		}
	}
	if (updateCount > 0) {
		return Status.OK_STATUS; // OK if there are updates
	}
	return Status.CANCEL_STATUS;
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:39,代码来源:UpdateMetaFileReaderJob.java

示例3: isNewVersionCompatible

import org.eclipse.equinox.p2.metadata.Version; //导入方法依赖的package包/类
private boolean isNewVersionCompatible(String currVersion, Version availableVerion) {
	Version upperLimit = generateUpperLimitforUpdates(currVersion);
	if (availableVerion.compareTo(upperLimit) == LESS_THAN) {
		return true;
	}
	return false;
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:8,代码来源:UpdateManager.java


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