📄 prefixmap.java
字号:
package it.unimi.dsi.mg4j.index;import it.unimi.dsi.mg4j.search.Interval;import it.unimi.dsi.mg4j.util.MutableString;/* * MG4J: Managing Gigabytes for Java * * Copyright (C) 2004-2007 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 FITNESS 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. * *//** A map from prefixes to term intervals (and possibly viceversa). * * <P>Given a list of terms in lexicographic order numbered from 0, we can ask, given a prefix, * which interval of terms starts with the given prefix. This information is very useful to * satisfy prefix queries (e.g., <samp>monitor*</samp>) with a brute-force approach, that is, * {@linkplain it.unimi.dsi.mg4j.search.OrDocumentIterator or-ing the document iterators} corresponding * to each term. The interval is more useful than the actual list of terms starting with the prefix, * as it allows to build directly the composed iterator. * * <P>Optionally, a prefix map may provide the opposite service: given an interval of terms, it * may provide the maximum common prefix. This feature can be checked for by calling {@link #hasPrefixes()}. * * @author Sebastiano Vigna * @since 0.9.2 * @deprecated As of MG4J 2.1, replaced by {@link it.unimi.dsi.util.PrefixMap}. */@Deprecatedpublic interface PrefixMap { /** Returns the interval of terms starting with the given prefix. * * @param prefix a prefix. * @return the interval of terms starting with <code>prefix</code> * ({@link it.unimi.dsi.mg4j.search.Intervals#EMPTY_INTERVAL} in case no term starts with <code>prefix</code>). */ public Interval getInterval( CharSequence prefix ); /** Returns true if this prefix map supports {@linkplain #getPrefix(Interval) prefix retrieval}. * * @return true if this prefix map supports {@linkplain #getPrefix(Interval) prefix retrieval}. */ public boolean hasPrefixes(); /** Returns the maximum prefix common to all terms in the given nonempty interval (optional operation). * * @param interval an interval. * @return the maximum prefix common to all terms in the given nonempty interval. */ public CharSequence getPrefix( Interval interval ); /** Writes in the given mutable string the maximum prefix common to all terms in the given nonempty interval (optional operation). * * @param interval an interval. * @param prefix a mutable string that will be filled with the maximum prefix common to all terms in the given nonempty interval. * @return <code>prefix</code>. */ public MutableString getPrefix( Interval interval, MutableString prefix ); /** Returns the number of terms in this prefix map. * @return the number of terms in this prefix map. */ public int size();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -