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


Java VTDNavHuge.pop方法代码示例

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


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

示例1: isPTNet

import com.ximpleware.extended.VTDNavHuge; //导入方法依赖的package包/类
private boolean isPTNet(AutoPilotHuge ap, VTDNavHuge vn) throws XPathParseExceptionHuge, XPathEvalExceptionHuge,
		NavExceptionHuge {
	boolean result = true;
	ap.selectXPath(PNMLPaths.NETS_PATH);
	while ((ap.evalXPath()) != -1) {
		vn.push();
		String netType = vn.toString(vn.getAttrVal(PNMLPaths.TYPE_ATTR));
		log.info("Discovered net type: {}", netType);
		if (!netType.endsWith(PNMLPaths.PTNET_TYPE)) {
			result = false;
			break;
		}
		vn.pop();
	}
	ap.resetXPath();
	vn.toElement(VTDNavHuge.ROOT);
	return result;
}
 
开发者ID:lip6,项目名称:pnml2nupn,代码行数:19,代码来源:PNML2NUPNExporter.java

示例2: isNet1Safe

import com.ximpleware.extended.VTDNavHuge; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private boolean isNet1Safe(AutoPilotHuge ap, VTDNavHuge vn) throws XPathParseExceptionHuge, NavExceptionHuge,
		NumberFormatException, XPathEvalExceptionHuge {
	boolean result = true;
	long count = 0L;
	String mkg;
	ap.selectXPath(PNMLPaths.MARKED_PLACES);
	while ((ap.evalXPath()) != -1) {
		vn.push();
		mkg = vn.toString(vn.getText());
		if (Long.valueOf(mkg) == 1) {
			count++;
		} else {
			break;
		}
		vn.pop();
	}
	ap.resetXPath();
	vn.toElement(VTDNavHuge.ROOT);
	if (count != 1L) {
		result = false;
	}
	return result;
}
 
开发者ID:lip6,项目名称:pnml2nupn,代码行数:25,代码来源:PNML2NUPNExporter.java

示例3: checkHasUnsafeArcs

import com.ximpleware.extended.VTDNavHuge; //导入方法依赖的package包/类
private void checkHasUnsafeArcs(File inFile, File outFile, Logger journal) throws InvalidPNMLTypeException,
		IOException, PNMLImportExportException {
	XMLMemMappedBuffer xb = new XMLMemMappedBuffer();
	VTDGenHuge vg = new VTDGenHuge();
	long nbUnsArcs = 0L;
	initLog(journal);
	try {
		xb.readFile(inFile.getCanonicalPath());
		vg.setDoc(xb);
		vg.parse(true);
		VTDNavHuge vn = vg.getNav();
		AutoPilotHuge ap = new AutoPilotHuge(vn);
		log.info("Checking it is a PT Net.");
		if (!isPTNet(ap, vn)) {
			throw new InvalidPNMLTypeException(
					"The contained Petri net(s) in the following file is not a P/T Net. Only P/T Nets are supported: "
							+ inFile.getCanonicalPath());
		}
		outUAFile = new File(PNML2NUPNUtils.extractBaseName(outFile.getCanonicalPath()) + UNSAFE_ARC);
		ocbUA = PNML2NUPNUtils.openOutChannel(outUAFile);
		uaQueue = initQueue();
		Thread uaWriter = startWriter(ocbUA, uaQueue);

		// Check inscriptions > 1
		ap.resetXPath();
		vn.toElement(VTDNavHuge.ROOT);
		ap.selectXPath(PNMLPaths.UNSAFE_ARCS);
		StringBuilder unsafeArcsId = new StringBuilder();
		long val;
		String id, src, trg;
		while ((ap.evalXPath()) != -1) {
			vn.push();
			vn.toElement(VTDNavHuge.FIRST_CHILD);
			while (!vn.matchElement(TEXT)) {
				vn.toElement(VTDNavHuge.NEXT_SIBLING);
			}
			val = Long.parseLong(vn.toString(vn.getText()).trim());
			vn.toElement(VTDNavHuge.PARENT);
			vn.toElement(VTDNavHuge.PARENT);
			id = vn.toString(vn.getAttrVal(PNMLPaths.ID_ATTR));
			if (id != null) {
				src = vn.toString(vn.getAttrVal(PNMLPaths.SRC_ATTR));
				trg = vn.toString(vn.getAttrVal(PNMLPaths.TRG_ATTR));
				unsafeArcsId.append(src + WS + id + WS + trg + WS + HK + val + NL);
				uaQueue.put(unsafeArcsId.toString());
				nbUnsArcs++;
			}
			vn.pop();
			unsafeArcsId.delete(0, unsafeArcsId.length());
		}
		if (nbUnsArcs > 0) {
			journal.warn("There are {} unsafe arcs in this net.", nbUnsArcs);
		} else {
			log.info("There are no unsafe arcs in this net.");
		}
		stopWriter(uaQueue);
		uaWriter.join();
		closeChannel(ocbUA);
		if (nbUnsArcs > 0) {
			log.info("See unsafe arcs files: {}", outUAFile.getCanonicalPath());
		} else {
			outUAFile.delete();
		}
	} catch (ParseExceptionHuge | XPathParseExceptionHuge | XPathEvalExceptionHuge | NavExceptionHuge
			| InterruptedException e) {
		try {
			emergencyStop(outFile);
		} catch (InterruptedException e1) {
			e1.printStackTrace();
		}
		throw new PNMLImportExportException(e);
	}
}
 
开发者ID:lip6,项目名称:pnml2nupn,代码行数:74,代码来源:PNML2NUPNExporter.java


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