Package it.unimi.dsi.util
Class AbstractPrefixMap
- java.lang.Object
-
- it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction<CharSequence>
-
- it.unimi.dsi.util.AbstractPrefixMap
-
- All Implemented Interfaces:
Function<CharSequence,Long>,Object2LongFunction<CharSequence>,PrefixMap<MutableString>,StringMap<MutableString>,Serializable,Function<CharSequence,Long>,ToLongFunction<CharSequence>
- Direct Known Subclasses:
ImmutableExternalPrefixMap,TernaryIntervalSearchTree
public abstract class AbstractPrefixMap extends AbstractObject2LongFunction<CharSequence> implements PrefixMap<MutableString>, Serializable
An abstract implementation of a prefix map.This class provides the full serives of a
PrefixMapby implementing justgetInterval(CharSequence)andgetTerm(int, MutableString)- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ObjectList<MutableString>listprotected Object2ObjectFunction<Interval,MutableString>prefixMapprotected Object2ObjectFunction<CharSequence,Interval>rangeMap-
Fields inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction
defRetValue
-
-
Constructor Summary
Constructors Constructor Description AbstractPrefixMap()
-
Method Summary
Modifier and Type Method Description protected abstract IntervalgetInterval(CharSequence prefix)Returns the range of strings having a given prefix.protected abstract MutableStringgetTerm(int index, MutableString string)Writes a string specified by index into aMutableString.ObjectList<MutableString>list()Returns a list view of the domain of this string map (optional operation).Object2ObjectFunction<Interval,MutableString>prefixMap()Returns a function mapping ranges of strings to common prefixes (optional operation).Object2ObjectFunction<CharSequence,Interval>rangeMap()Returns a function mapping prefixes to ranges of strings.-
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction
defaultReturnValue, defaultReturnValue
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface it.unimi.dsi.fastutil.Function
apply, clear, containsKey, size
-
Methods inherited from interface it.unimi.dsi.fastutil.objects.Object2LongFunction
applyAsLong, defaultReturnValue, defaultReturnValue, get, getLong, put, put, remove, removeLong
-
-
-
-
Field Detail
-
rangeMap
protected Object2ObjectFunction<CharSequence,Interval> rangeMap
-
prefixMap
protected Object2ObjectFunction<Interval,MutableString> prefixMap
-
list
protected ObjectList<MutableString> list
-
-
Method Detail
-
getInterval
protected abstract Interval getInterval(CharSequence prefix)
Returns the range of strings having a given prefix.- Parameters:
prefix- a prefix.- Returns:
- the corresponding range of strings as an interval.
-
getTerm
protected abstract MutableString getTerm(int index, MutableString string)
Writes a string specified by index into aMutableString.- Parameters:
index- the index of a string.string- a mutable string.- Returns:
string.
-
rangeMap
public Object2ObjectFunction<CharSequence,Interval> rangeMap()
Description copied from interface:PrefixMapReturns a function mapping prefixes to ranges of strings.- Specified by:
rangeMapin interfacePrefixMap<MutableString>- Returns:
- a function mapping prefixes to ranges of strings.
-
prefixMap
public Object2ObjectFunction<Interval,MutableString> prefixMap()
Description copied from interface:PrefixMapReturns a function mapping ranges of strings to common prefixes (optional operation).- Specified by:
prefixMapin interfacePrefixMap<MutableString>- Returns:
- a function mapping ranges of strings to common prefixes, or
nullif this map does not support prefixes.
-
list
public ObjectList<MutableString> list()
Description copied from interface:StringMapReturns a list view of the domain of this string map (optional operation).Note that the list view acts as an inverse of the mapping implemented by this map.
- Specified by:
listin interfaceStringMap<MutableString>- Returns:
- a list view of the domain of this string map, or
nullif this map does not support this operation.
-
-