Interface PrefixMap<S extends java.lang.CharSequence>

  • All Superinterfaces:
    it.unimi.dsi.fastutil.Function<java.lang.CharSequence,​java.lang.Long>, java.util.function.Function<java.lang.CharSequence,​java.lang.Long>, it.unimi.dsi.fastutil.objects.Object2LongFunction<java.lang.CharSequence>, java.io.Serializable, StringMap<S>, java.util.function.ToLongFunction<java.lang.CharSequence>
    All Known Implementing Classes:
    AbstractPrefixMap, ImmutableExternalPrefixMap, StringMaps.SynchronizedPrefixMap, TernaryIntervalSearchTree

    public interface PrefixMap<S extends java.lang.CharSequence>
    extends StringMap<S>
    A map from prefixes to string intervals (and possibly vice versa).

    Instances of this class provide the services of a StringMap, but by assuming the strings are lexicographically ordered, they can provide further information by exposing a function from string prefixes to intervals and a function from intervals to string prefixes.

    In the first case, given a prefix, we can ask for the range of strings starting with that prefix, expressed as an Interval. This information is very useful to satisfy prefix queries (e.g., monitor*) with a brute-force approach.

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

    Since:
    0.9.2
    Author:
    Sebastiano Vigna
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      it.unimi.dsi.fastutil.objects.Object2ObjectFunction<Interval,​S> prefixMap()
      Returns a function mapping ranges of strings to common prefixes (optional operation).
      it.unimi.dsi.fastutil.objects.Object2ObjectFunction<java.lang.CharSequence,​Interval> rangeMap()
      Returns a function mapping prefixes to ranges of strings.
      • Methods inherited from interface it.unimi.dsi.fastutil.Function

        apply, clear, containsKey, size
      • Methods inherited from interface java.util.function.Function

        compose
      • Methods inherited from interface it.unimi.dsi.fastutil.objects.Object2LongFunction

        andThen, andThenByte, andThenChar, andThenDouble, andThenFloat, andThenInt, andThenLong, andThenObject, andThenReference, andThenShort, applyAsLong, composeByte, composeChar, composeDouble, composeFloat, composeInt, composeLong, composeObject, composeReference, composeShort, defaultReturnValue, defaultReturnValue, get, getLong, getOrDefault, getOrDefault, put, put, remove, removeLong
    • Method Detail

      • rangeMap

        it.unimi.dsi.fastutil.objects.Object2ObjectFunction<java.lang.CharSequence,​Interval> rangeMap()
        Returns a function mapping prefixes to ranges of strings.
        Returns:
        a function mapping prefixes to ranges of strings.
      • prefixMap

        it.unimi.dsi.fastutil.objects.Object2ObjectFunction<Interval,​S> prefixMap()
        Returns a function mapping ranges of strings to common prefixes (optional operation).
        Returns:
        a function mapping ranges of strings to common prefixes, or null if this map does not support prefixes.