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


Java Utils.parseInt方法代码示例

本文整理汇总了Java中localhost.iillyyaa2033.nmud.core.utils.Utils.parseInt方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.parseInt方法的具体用法?Java Utils.parseInt怎么用?Java Utils.parseInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在localhost.iillyyaa2033.nmud.core.utils.Utils的用法示例。


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

示例1: setColor

import localhost.iillyyaa2033.nmud.core.utils.Utils; //导入方法依赖的package包/类
private void setColor(Entity entity) {
	String color = entity.getParam(Entity.P.EDITOR_COLOR);
	if (color != null) {
		if (!color.equals("null")) {
			this.color = Color.parseColor(color);
		}
	}
	
	String alpha = entity.getParam("editorOpacity");
	if (alpha != null) {
		if (!alpha.equals("null")) {
			this.alpha = Utils.parseInt(alpha, 50);
		}
	}
}
 
开发者ID:nmud,项目名称:nmud,代码行数:16,代码来源:DrawingEntity.java

示例2: getEntityAlpha

import localhost.iillyyaa2033.nmud.core.utils.Utils; //导入方法依赖的package包/类
private int getEntityAlpha(Entity e) {
	if (e.opacity < 0) {
		e.opacity = Utils.parseInt(e.getParam("editorOpacity"), 50);
	}

	return e.opacity;
}
 
开发者ID:nmud,项目名称:nmud,代码行数:8,代码来源:EntityView.java

示例3: load

import localhost.iillyyaa2033.nmud.core.utils.Utils; //导入方法依赖的package包/类
public static void load(String path) throws Exception {
	File file = new File(path);

	if (!file.exists())
		throw new FileNotFoundException("File " + path + " doesnt exists!");

	BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));

	HashMap<Integer, Word> result = new HashMap<Integer, Word>();

	String line = null;
	while ((line = br.readLine()) != null) {
		int ind = line.indexOf(SEPARATOR);
		if (ind > 0) {
			int num = Utils.parseInt(line.substring(0, ind), -1);
			int type = 0;
			int gen = 0;
			String[] data = Utils.stringToStringArray(line.substring(ind), SEPARATOR);

			ArrayList<String> pdata = new ArrayList<String>();
			HashMap<String,Boolean> pparams = new HashMap<String,Boolean>();
			for (int i = 0; i < data.length; i++) {
				if (data[i] != null) {
					if (data[i].startsWith(Word.PREFIX_FLAGS)) {
						pparams.putAll(WordUtils.parseParams(data[i]));
					} else {
						pdata.add(data[i]);
					}
				}
			}

			result.put(num, new Word(type, gen, pdata.toArray(new String[pdata.size()]), pparams));
		}
	}

	br.close();

	Dictionary.set(result);
}
 
开发者ID:nmud,项目名称:nmud-core,代码行数:40,代码来源:DictionaryLoader.java

示例4: recursiveEntityReading

import localhost.iillyyaa2033.nmud.core.utils.Utils; //导入方法依赖的package包/类
public static Entity recursiveEntityReading(org.xmlpull.v1.XmlPullParser xpp) 
throws XmlPullParserException, IOException {
	int depth = xpp.getDepth();

	Entity result = new Entity();

	switch (xpp.getName()) {
		case "ContainerEntity":
			result = new ContainerEntity();
			break;
		case "DomainEntity":
			result = new DomainEntity();
			break;
		case "Creature":
			result = new Creature();
			break;
	}

	for (int i = 0; i < xpp.getAttributeCount(); i++) {
		switch (xpp.getAttributeName(i)) {
			case "id":
				result.setId(xpp.getAttributeValue(i));
				break;
			case "shape":
				result.setShape(parseCoords(xpp.getAttributeValue(i),
											Entity.COORDS_COUNT_SHAPE));
				break;
			case "position":
				result.setPosition(parseCoords(xpp.getAttributeValue(i),
											   Entity.COORDS_COUNT_POSITION));
				break;
			case "depthrange":
				int[] depthr = parseDepth(xpp.getAttributeValue(i));
				result.setDeepnessRange(depthr[0], depthr[1]);
				break;
			case "name":
				result.nameId = Utils.parseInt(xpp.getAttributeValue(i), Word.UNKNOWN);
				break;
			case "params":
				result.params = parseParams(xpp.getAttributeValue(i));
				break;
			case "tags":
				result.tags = parseTags(xpp.getAttributeValue(i));
				break;
			case "material":
				result.setMaterial(parseMaterial(xpp.getAttributeValue(i)));
				break;
			case "script":
				result.setScript(parseScript(xpp.getAttributeValue(i)));
				break;
		}
	}

	while ((xpp.getDepth()) >= depth) {
		xpp.next();

		switch (xpp.getEventType()) {
			case XmlPullParser.START_TAG:
				switch (xpp.getName()) {
					case "parts":
						result.parts = Collections.synchronizedList(
							recursiveEntityListReading(xpp));
						break;
					case "content":
						((ContainerEntity) result).content = 
							recursiveEntityListReading(xpp);
						break;
					case "aidata":
						((Creature) result).aiPart = readAiPart(xpp);
						break;
				}
				break;
				// case XmlPullParser.END_TAG:
				// case XmlPullParser.END_DOCUMENT:
		}
	}
	return result;
}
 
开发者ID:nmud,项目名称:nmud-core,代码行数:79,代码来源:DomainUtils.java


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