本文整理汇总了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);
}
示例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>();
}