it.unimi.dsi.mg4j.index
Interface PrefixMap

All Known Implementing Classes:
AbstractPrefixMap, ImmutableExternalPrefixDictionary, ImmutableExternalTreePrefixDictionary, ImmutableExternalTriePrefixDictionary, ImmutableTriePrefixTree, TermMaps.SynchronizedPrefixMap, TermMaps.SynchronizedTermPrefixMap, TernaryIntervalSearchTree

Deprecated. As of MG4J 2.1, replaced by PrefixMap.

@Deprecated
public interface PrefixMap

A map from prefixes to term intervals (and possibly viceversa).

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., monitor*) with a brute-force approach, that is, 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.

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 hasPrefixes().

Since:
0.9.2
Author:
Sebastiano Vigna

Method Summary
 Interval getInterval(CharSequence prefix)
          Deprecated. Returns the interval of terms starting with the given prefix.
 CharSequence getPrefix(Interval interval)
          Deprecated. Returns the maximum prefix common to all terms in the given nonempty interval (optional operation).
 MutableString getPrefix(Interval interval, MutableString prefix)
          Deprecated. Writes in the given mutable string the maximum prefix common to all terms in the given nonempty interval (optional operation).
 boolean hasPrefixes()
          Deprecated. Returns true if this prefix map supports prefix retrieval.
 int size()
          Deprecated. Returns the number of terms in this prefix map.
 

Method Detail

getInterval

Interval getInterval(CharSequence prefix)
Deprecated. 
Returns the interval of terms starting with the given prefix.

Parameters:
prefix - a prefix.
Returns:
the interval of terms starting with prefix (Intervals.EMPTY_INTERVAL in case no term starts with prefix).

hasPrefixes

boolean hasPrefixes()
Deprecated. 
Returns true if this prefix map supports prefix retrieval.

Returns:
true if this prefix map supports prefix retrieval.

getPrefix

CharSequence getPrefix(Interval interval)
Deprecated. 
Returns the maximum prefix common to all terms in the given nonempty interval (optional operation).

Parameters:
interval - an interval.
Returns:
the maximum prefix common to all terms in the given nonempty interval.

getPrefix

MutableString getPrefix(Interval interval,
                        MutableString prefix)
Deprecated. 
Writes in the given mutable string the maximum prefix common to all terms in the given nonempty interval (optional operation).

Parameters:
interval - an interval.
prefix - a mutable string that will be filled with the maximum prefix common to all terms in the given nonempty interval.
Returns:
prefix.

size

int size()
Deprecated. 
Returns the number of terms in this prefix map.

Returns:
the number of terms in this prefix map.