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


Java PointerTargetTreeNodeList.contains方法代码示例

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


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

示例1: makeInheritedTreeList

import net.didion.jwnl.data.list.PointerTargetTreeNodeList; //导入方法依赖的package包/类
/**
 * Turn an existing tree list into an inheritance tree list.
 * @param list the tree list to convert
 * @param searchTypes the pointer types to include in the pointer lists
 * @param labelType the <code>PointerType</code> with which to label each pointer
 * @param pointerDepth the depth to which to search for each pointer list
 * @param ancestorDepth the depth to which to go to in <code>tree</code>
 * @param allowRedundancies if true, duplicate items are allowed in the list
 */
public PointerTargetTreeNodeList makeInheritedTreeList(PointerTargetTreeNodeList list,
                                                       PointerType[] searchTypes, PointerType labelType,
                                                       int pointerDepth, int ancestorDepth,
                                                       boolean allowRedundancies) throws JWNLException {
	ancestorDepth--;
	PointerTargetTreeNodeList inherited = new PointerTargetTreeNodeList();
	for (Iterator itr = list.iterator(); itr.hasNext();) {
		PointerTargetTreeNode node = (PointerTargetTreeNode) itr.next();
		if (allowRedundancies || !inherited.contains(node)) {
			if (ancestorDepth == 0) {
				inherited.add(node.getPointerTarget(),
				              null,
				              makePointerTargetTreeList(node.getSynset(), searchTypes, labelType, pointerDepth, allowRedundancies),
				              PointerType.HYPERNYM);
			} else {
				inherited.add(node.getPointerTarget(),
				              makeInheritedTreeList(node.getChildTreeList(), searchTypes, labelType,
				                                    pointerDepth, ancestorDepth, allowRedundancies),
				              makePointerTargetTreeList(node.getSynset(), searchTypes, labelType, pointerDepth, allowRedundancies),
				              PointerType.HYPERNYM);
			}
		}
	}
	return inherited;
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:35,代码来源:PointerUtils.java

示例2: makePointerTargetTreeList

import net.didion.jwnl.data.list.PointerTargetTreeNodeList; //导入方法依赖的package包/类
private PointerTargetTreeNodeList makePointerTargetTreeList(Synset synset, PointerType[] searchTypes,
                                                            PointerType labelType, int depth,
                                                            boolean allowRedundancies,
                                                            PointerTargetTreeNode parent) throws JWNLException {
    depth--;
	PointerTargetTreeNodeList list = new PointerTargetTreeNodeList();
	for (int i = 0; i < searchTypes.length; i++) {
		PointerType type = searchTypes[i];
		PointerTargetNodeList targets = new PointerTargetNodeList(synset.getTargets(type));
		if (targets.size() > 0) {
			for (Iterator itr = targets.iterator(); itr.hasNext();) {
                   PointerTargetNode ptr = (PointerTargetNode)itr.next();
                   ptr.getSynset();
                   PointerTargetTreeNode node =
				    new PointerTargetTreeNode(ptr.getPointerTarget(),
				                              labelType == null ? type : labelType, parent);
				if (allowRedundancies || !list.contains(node)) {
					if (depth != 0) {
						node.setChildTreeList(makePointerTargetTreeList(node.getSynset(), searchTypes, labelType,
						                                                depth, allowRedundancies, node));
					}
         				list.add(node);
				}
			}
		}
	}
	return list;
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:29,代码来源:PointerUtils.java


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