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


Java Parameters.copy方法代码示例

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


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

示例1: getIterator

import org.galagosearch.tupleflow.Parameters; //导入方法依赖的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: IndexWriter

import org.galagosearch.tupleflow.Parameters; //导入方法依赖的package包/类
/**
 * Creates a new instance of IndexWriter
 */
public IndexWriter(String outputFilename, Parameters parameters)
        throws FileNotFoundException, IOException {
    // Create the parent directory:
    new File(outputFilename).getParentFile().mkdirs();

    blockSize = (int) parameters.get("blockSize", 32768);
    isCompressed = parameters.get("isCompressed", false);
    output = new DataOutputStream(new BufferedOutputStream(
                                  new FileOutputStream(outputFilename)));
    vocabulary = new VocabularyWriter();
    manifest = new Parameters();
    manifest.copy(parameters);
    lists = new ArrayList<IndexElement>();
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:18,代码来源:IndexWriter.java


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