|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.mg4j.util.ImmutableBinaryTrie
it.unimi.dsi.mg4j.util.ImmutableTriePrefixTree
dsiutils
.
@Deprecated public class ImmutableTriePrefixTree
A class adapter from immutable binary tries to prefix trees.
Instances of this class map transparently strings into a binary trie. For this to happen, however, the character-to-symbol map provided at construction time must contain all characters with which the trie will be ever queried.
Depending on the default return value of the map,
character sequences containing extraneous
characters will cause an IndexOutOfBoundsException
, or will behave as if
the extraneous characters are mapped to the symbol returned as default value.
This class implements both TermMap
, and PrefixMap
,
albeit no optional operation is supported.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class it.unimi.dsi.mg4j.util.ImmutableBinaryTrie |
---|
ImmutableBinaryTrie.Node |
Field Summary | |
---|---|
static long |
serialVersionUID
Deprecated. |
Fields inherited from class it.unimi.dsi.mg4j.util.ImmutableBinaryTrie |
---|
root |
Constructor Summary | |
---|---|
ImmutableTriePrefixTree(List<? extends CharSequence> words,
PrefixCoder prefixCoder,
Char2IntMap char2symbol)
Deprecated. Creates a new prefix tree. |
Method Summary | |
---|---|
Interval |
getApproximatedInterval(CharSequence word)
Deprecated. Returns an approximated prefix interval around the specified word. |
int |
getIndex(CharSequence s)
Deprecated. |
Interval |
getInterval(CharSequence prefix)
Deprecated. Returns the interval of terms starting with the given prefix. |
int |
getNumber(CharSequence term)
Deprecated. Returns the ordinal number corresponding to the given term, or possibly (but not necessarily) -1 if the term was not indexed. |
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). |
CharSequence |
getTerm(int index)
Deprecated. Returns the term corresponding to the given ordinal number (optional operation). |
MutableString |
getTerm(int index,
MutableString term)
Deprecated. Writes in the given mutable string the term corresponding to the given ordinal number (optional operation). |
boolean |
hasPrefixes()
Deprecated. Returns true if this prefix map supports prefix retrieval. |
boolean |
hasTerms()
Deprecated. Returns true if this prefix map supports term retrieval. |
Methods inherited from class it.unimi.dsi.mg4j.util.ImmutableBinaryTrie |
---|
get, get, getApproximatedInterval, getApproximatedInterval, getInterval, getInterval, size, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface it.unimi.dsi.mg4j.index.TermMap |
---|
size |
Methods inherited from interface it.unimi.dsi.mg4j.index.PrefixMap |
---|
size |
Field Detail |
---|
public static final long serialVersionUID
Constructor Detail |
---|
public ImmutableTriePrefixTree(List<? extends CharSequence> words, PrefixCoder prefixCoder, Char2IntMap char2symbol)
words
- a lexicographically ordered list of words.prefixCoder
- a (lexicographic-order preserving) coder used to encoding words.char2symbol
- the map from characters to symbols in the coder.Method Detail |
---|
public Interval getApproximatedInterval(CharSequence word)
ImmutableExternalPrefixDictionary.IntervalApproximator
getApproximatedInterval
in interface ImmutableExternalPrefixDictionary.IntervalApproximator
word
- a word.
word
@Deprecated public int getIndex(CharSequence s)
public int getNumber(CharSequence term)
TermMap
We intentionally prefer “ordinal number” to “index” because of the obvious confusion that the latter term can cause.
getNumber
in interface TermMap
term
- a term.
public CharSequence getTerm(int index)
TermMap
getTerm
in interface TermMap
index
- a term ordinal number.
null
if the term was not indexed.public MutableString getTerm(int index, MutableString term)
TermMap
getTerm
in interface TermMap
index
- a term ordinal number.term
- a mutable string that will be filled with the corresponding term.
term
, or possibly (but not necessarily) null
if the term was not indexed.public Interval getInterval(CharSequence prefix)
PrefixMap
getInterval
in interface PrefixMap
prefix
- a prefix.
prefix
(Intervals.EMPTY_INTERVAL
in case no term starts with prefix
).public CharSequence getPrefix(Interval interval)
PrefixMap
getPrefix
in interface PrefixMap
interval
- an interval.
public MutableString getPrefix(Interval interval, MutableString prefix)
PrefixMap
getPrefix
in interface PrefixMap
interval
- an interval.prefix
- a mutable string that will be filled with the maximum prefix common to all terms in the given nonempty interval.
prefix
.public boolean hasTerms()
TermMap
hasTerms
in interface TermMap
public boolean hasPrefixes()
PrefixMap
hasPrefixes
in interface PrefixMap
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |