本文整理匯總了Java中net.didion.jwnl.data.list.PointerTargetTreeNodeList.add方法的典型用法代碼示例。如果您正苦於以下問題:Java PointerTargetTreeNodeList.add方法的具體用法?Java PointerTargetTreeNodeList.add怎麽用?Java PointerTargetTreeNodeList.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.didion.jwnl.data.list.PointerTargetTreeNodeList
的用法示例。
在下文中一共展示了PointerTargetTreeNodeList.add方法的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;
}
示例2: makePointerTargetTreeList
import net.didion.jwnl.data.list.PointerTargetTreeNodeList; //導入方法依賴的package包/類
/**
* Make a nested list of pointer targets to depth <var>depth</var>, starting at each <code>synset</code> in
* <var>list</var>. Each level of the list is related to the previous level by one of the pointer types specified
* by <var>searchTypes</var>.
* @param labelType the type used to label each pointer target in the tree
* @param allowRedundancies if true, duplicate items will be included in the tree
*/
public PointerTargetTreeNodeList makePointerTargetTreeList(PointerTargetNodeList list, PointerType[] searchTypes,
PointerType labelType, int depth,
boolean allowRedundancies) throws JWNLException {
PointerTargetTreeNodeList treeList = new PointerTargetTreeNodeList();
for (Iterator itr = list.iterator(); itr.hasNext();) {
PointerTargetNode node = (PointerTargetNode) itr.next();
treeList.add(node.getPointerTarget(),
makePointerTargetTreeList(node.getSynset(), searchTypes, labelType, depth, allowRedundancies),
labelType);
}
return treeList;
}