本文整理汇总了Java中net.sf.extjwnl.data.list.PointerTargetNodeList.size方法的典型用法代码示例。如果您正苦于以下问题:Java PointerTargetNodeList.size方法的具体用法?Java PointerTargetNodeList.size怎么用?Java PointerTargetNodeList.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.extjwnl.data.list.PointerTargetNodeList
的用法示例。
在下文中一共展示了PointerTargetNodeList.size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findAsymmetricRelationship
import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入方法依赖的package包/类
/**
* This is directly copied from extJWNL's RelationshipFinder class. It
* iterates over the list of source nodes and checks to see if any of the
* target nodes share a common index. If a node is found, its added to the
* pointer target node list and returned as a Relationship.
*
* @param sourceNodes
* @param targetNodes
* @param type
* @param sourceSynset
* @param targetSynset
* @return
* @throws CloneNotSupportedException
*/
private static Relationship findAsymmetricRelationship(
PointerTargetNodeList sourceNodes,
PointerTargetNodeList targetNodes, PointerType type,
Synset sourceSynset, Synset targetSynset)
throws CloneNotSupportedException {
PointerTargetNode sourceRoot = (PointerTargetNode) sourceNodes.get(0);
PointerTargetNode targetRoot = (PointerTargetNode) targetNodes.get(0);
// If the deepest ancestor of both trees is not common,
// there is no relationship between them
if (!sourceRoot.getSynset().equals(targetRoot.getSynset())) {
return null;
}
PointerTargetNodeList relationship = new PointerTargetNodeList();
int targetStart = 0;
int commonParentIndex = 0;
for (int i = sourceNodes.size() - 1; i >= 0; i--) {
PointerTargetNode testNode = (PointerTargetNode) sourceNodes.get(i);
int idx = targetNodes.indexOf(testNode);
if (idx >= 0) {
targetStart = idx;
break;
}
relationship.add(testNode.clone());
commonParentIndex++;
}
for (int i = targetStart; i < targetNodes.size(); i++) {
PointerTargetNode node = ((PointerTargetNode) targetNodes.get(i))
.clone();
node.setType(type.getSymmetricType());
relationship.add(node);
}
return new AsymmetricRelationship(type, relationship,
commonParentIndex, sourceSynset, targetSynset);
}
示例2: reverse
import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入方法依赖的package包/类
public Relationship reverse() throws CloneNotSupportedException {
PointerTargetNodeList list = getNodeList().deepClone().reverse();
int commonParentIndex = (list.size() - 1) - getCommonParentIndex();
for (int i = 0; i < list.size(); i++) {
if (i != commonParentIndex) {
list.get(i).setType(getType().getSymmetricType());
}
}
return new AsymmetricRelationship(getType(), list, commonParentIndex, getSourceSynset(), getTargetSynset());
}