📄 abstractscorer.java
字号:
package it.unimi.dsi.mg4j.search.score;/* * MG4J: Managing Gigabytes for Java * * Copyright (C) 2004-2007 Paolo Boldi and Sebastiano Vigna * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITfNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */import java.io.IOException;import it.unimi.dsi.fastutil.ints.AbstractIntIterator;import it.unimi.dsi.fastutil.objects.Reference2DoubleMap;import it.unimi.dsi.mg4j.index.Index;import it.unimi.dsi.mg4j.search.DocumentIterator;/** An abstract implementation of {@link it.unimi.dsi.mg4j.search.score.Scorer}. * It provides internal caching of the underlying * document iterator during {@linkplain #wrap(DocumentIterator) wrapping}, * and a complete implementation of the {@link it.unimi.dsi.fastutil.ints.IntIterator} * methods by delegation to the underlying document iterator (implementing subclasses * that do not alter this behaviour should implement {@link it.unimi.dsi.mg4j.search.score.DelegatingScorer}). * The {@link #setWeights(Reference2DoubleMap)} * method simply returns false. * */public abstract class AbstractScorer extends AbstractIntIterator implements Scorer { /** The current document iterator. */ protected DocumentIterator documentIterator; /** Wraps the given document iterator. * * <p>This method {@linkplain #documentIterator records internally the provided iterator}. * * @param documentIterator the document iterator that will be used in subsequent calls to * {@link #score()} and {@link #score(Index)}. */ public void wrap( final DocumentIterator documentIterator ) throws IOException { this.documentIterator = documentIterator; } /** Returns false. */ public boolean setWeights( final Reference2DoubleMap<Index> index2Weight ) { return false; } @Deprecated public int nextInt() { return documentIterator.nextInt(); } public int nextDocument() throws IOException { return documentIterator.nextDocument(); } public int skip( final int n ) { return documentIterator.skip( n ); } public boolean hasNext() { return documentIterator.hasNext(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -