• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java InvalidVersionSpecificationException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中cpw.mods.fml.common.versioning.InvalidVersionSpecificationException的典型用法代码示例。如果您正苦于以下问题:Java InvalidVersionSpecificationException类的具体用法?Java InvalidVersionSpecificationException怎么用?Java InvalidVersionSpecificationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InvalidVersionSpecificationException类属于cpw.mods.fml.common.versioning包,在下文中一共展示了InvalidVersionSpecificationException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: networkCheck

import cpw.mods.fml.common.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
@NetworkCheckHandler
public final boolean networkCheck(Map<String, String> remoteVersions, Side side) throws InvalidVersionSpecificationException {

	if (!requiresRemoteFrom(side)) {
		return true;
	}
	Mod mod = getClass().getAnnotation(Mod.class);
	String _modid = mod.modid();
	if (!remoteVersions.containsKey(_modid)) {
		return false;
	}
	String remotes = mod.acceptableRemoteVersions();
	if (!"*".equals(remotes)) {

		String remote = remoteVersions.get(_modid);
		if (Strings.isNullOrEmpty(remotes)) {
			return getModVersion().equalsIgnoreCase(remote);
		}

		return ModRange.createFromVersionSpec(_modid, remotes).containsVersion(new ModVersion(_modid, remote));
	}
	return true;
}
 
开发者ID:AdvancedMods,项目名称:AMCore,代码行数:24,代码来源:BaseMod.java


示例2: isAcceptibleVersion

import cpw.mods.fml.common.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
public boolean isAcceptibleVersion(final String version) {
	try {
		final VersionRange range = VersionRange.createFromVersionSpec(version);
		return range.containsVersion(this.mod.getArtifactVersion());
	} catch (InvalidVersionSpecificationException e) {
		e.printStackTrace();
		return false;
	}
}
 
开发者ID:OreCruncher,项目名称:ThermalRecycling,代码行数:10,代码来源:ModPlugin.java


示例3: createFromVersionSpec

import cpw.mods.fml.common.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
public static VersionRange createFromVersionSpec(String label, String spec) throws InvalidVersionSpecificationException {

		if (spec == null) {
			return null;
		}

		List<Restriction> restrictions = new ArrayList<Restriction>();
		String process = spec;
		ArtifactVersion version = null;
		ArtifactVersion upperBound = null;
		ArtifactVersion lowerBound = null;

		while (process.startsWith("[") || process.startsWith("(")) {

			int index1 = process.indexOf(')');
			int index2 = process.indexOf(']');

			int index = index2;
			if (((index2 < 0) | index1 < index2) & index1 >= 0) {
				index = index1;
			}

			if (index < 0) {
				throw new InvalidVersionSpecificationException("Unbounded range: " + spec);
			}

			Restriction restriction = parseRestriction(label, process.substring(0, index + 1));
			if (lowerBound == null) {
				lowerBound = restriction.getLowerBound();
			}
			if (upperBound != null) {
				if (restriction.getLowerBound() == null || restriction.getLowerBound().compareTo(upperBound) < 0) {
					throw new InvalidVersionSpecificationException("Ranges overlap: " + spec);
				}
			}
			restrictions.add(restriction);
			upperBound = restriction.getUpperBound();

			process = process.substring(index + 1).trim();

			if (process.length() > 0 && process.startsWith(",")) {
				process = process.substring(1).trim();
			}
		}

		if (process.length() > 0) {
			if (restrictions.size() > 0) {
				throw new InvalidVersionSpecificationException("Only fully-qualified sets allowed in multiple set scenario: " + spec);
			} else {
				version = getArtifactVersion(label, process);
				restrictions.add(Restriction.EVERYTHING);
			}
		}

		try {
			return VersionRange.newRange(version, restrictions);
		} catch (Throwable e) {
			e.printStackTrace();
		}
		return null;
	}
 
开发者ID:AdvancedMods,项目名称:AMCore,代码行数:62,代码来源:ModRange.java


示例4: parseRestriction

import cpw.mods.fml.common.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
private static Restriction parseRestriction(String label, String spec) throws InvalidVersionSpecificationException {

		boolean lowerBoundInclusive = spec.startsWith("[");
		boolean upperBoundInclusive = spec.endsWith("]");

		String process = spec.substring(1, spec.length() - 1).trim();

		Restriction restriction;

		int index = process.indexOf(',');

		if (index < 0) {
			if (!lowerBoundInclusive | !upperBoundInclusive) {
				throw new InvalidVersionSpecificationException("Single version must be surrounded by []: " + spec);
			}

			ArtifactVersion version = getArtifactVersion(label, process);

			restriction = new Restriction(version, lowerBoundInclusive, version, upperBoundInclusive);
		} else {
			String lowerBound = process.substring(0, index).trim();
			String upperBound = process.substring(index + 1).trim();
			if (lowerBound.equals(upperBound)) {
				throw new InvalidVersionSpecificationException("Range cannot have identical boundaries: " + spec);
			}

			ArtifactVersion lowerVersion = null;
			if (lowerBound.length() > 0) {
				lowerVersion = getArtifactVersion(label, lowerBound);
			}
			ArtifactVersion upperVersion = null;
			if (upperBound.length() > 0) {
				upperVersion = getArtifactVersion(label, upperBound);
			}

			if (upperVersion != null & lowerVersion != null && upperVersion.compareTo(lowerVersion) < 0) {
				throw new InvalidVersionSpecificationException("Range defies version ordering: " + spec);
			}

			restriction = new Restriction(lowerVersion, lowerBoundInclusive, upperVersion, upperBoundInclusive);
		}

		return restriction;
	}
 
开发者ID:AdvancedMods,项目名称:AMCore,代码行数:45,代码来源:ModRange.java



注:本文中的cpw.mods.fml.common.versioning.InvalidVersionSpecificationException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GeneralDigest类代码示例发布时间:2022-05-22
下一篇:
Java LARImporter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap