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


Java NodeType.getParameterTypes方法代码示例

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


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

示例1: getIterator

import org.galagosearch.core.retrieval.query.NodeType; //导入方法依赖的package包/类
/**
 * Given a query node, generates the corresponding iterator object that can be used
 * for structured retrieval.  This method just calls getClass() on the node,
 * then instantiates the resulting class.
 * 
 * If the class returned by getClass() is a ScoringFunction, it must contain
 * a constructor that takes a single Parameters object.  If the class returned by 
 * getFeatureClass() is some kind of StructuredIterator (either a ScoreIterator,
 * ExtentIterator or CountIterator), it must take a Parameters object and an
 * ArrayList of DocumentDataIterators as parameters.
 */
public StructuredIterator getIterator(Node node, ArrayList<StructuredIterator> childIterators) throws Exception {
    NodeType type = getNodeType(node);
    
    Constructor constructor = type.getConstructor();
    Class[] types = type.getParameterTypes(1 + childIterators.size());
        
    if (!isUsableConstructor(types, childIterators)) {
        throw new Exception("Couldn't find a reasonable constructor.");
    }
    
    Parameters parametersCopy = new Parameters();
    parametersCopy.copy(node.getParameters());
    Object[] args = argsForConstructor(constructor.getParameterTypes(),
                                       parametersCopy,
                                       childIterators);
    RequiredStatistics required =
        type.getIteratorClass().getAnnotation(RequiredStatistics.class);
    if (required != null) {
        for (String statistic : required.statistics()) {
            parametersCopy.add(statistic, parameters.get(statistic, null));
        }
    }
    return (StructuredIterator) constructor.newInstance(args);
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:36,代码来源:FeatureFactory.java

示例2: afterNode

import org.galagosearch.core.retrieval.query.NodeType; //导入方法依赖的package包/类
public Node afterNode(Node node) throws Exception {
    ArrayList<Node> newChildren = new ArrayList<Node>();
    NodeType nodeType = retrieval.getNodeType(node);
    if (nodeType == null) return node;
    ArrayList<Node> children = node.getInternalNodes();
    // Given that we're going to pass children.size() + 1 parameters to
    // this constructor, what types should those parameters have?
    Class[] types = nodeType.getParameterTypes(children.size() + 1);
    if (types == null) return node;

    for (int i = 1; i < types.length; ++i) {
        Node child = children.get(i-1);
        // If the parent will expect a ScoreIterator at this position, but
        // we've got a CountIterator here, we'll perform a conversion step.
        if (ScoreIterator.class.isAssignableFrom(types[i]) &&
            isCountNode(children.get(i-1))) {
            Node feature = createSmoothingNode(child);
            newChildren.add(feature);
        } else {
            newChildren.add(child);
        }
    }

    return new Node(node.getOperator(), node.getParameters(),
                    newChildren, node.getPosition());
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:27,代码来源:ImplicitFeatureCastTraversal.java

示例3: testGetParameterTypes

import org.galagosearch.core.retrieval.query.NodeType; //导入方法依赖的package包/类
public void testGetParameterTypes() throws Exception {
    NodeType n = new NodeType(FakeIterator.class);
    Class[] input = n.getParameterTypes(5);
    assertEquals(5, input.length);
    assertEquals(Parameters.class, input[0]);
    assertEquals(ExtentIterator.class, input[1]);
    assertEquals(StructuredIterator.class, input[2]);
    assertEquals(StructuredIterator.class, input[3]);
    assertEquals(StructuredIterator.class, input[4]);
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:11,代码来源:NodeTypeTest.java


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