public abstract class MapLexicon<K1,K2 extends org.apache.hadoop.io.WritableComparable> extends Lexicon<K1> implements Closeable
Modifier and Type | Class and Description |
---|---|
protected static interface |
MapLexicon.Id2EntryIndexLookup
Interface for getting the lexicon term index for a given term id
|
protected static class |
MapLexicon.IdIsIndex
Lexicon map where the termid is the term index
|
Lexicon.LexiconFileEntry<KEY2>
Modifier and Type | Field and Description |
---|---|
protected WriteableFactory<K2> |
keyFactory |
protected Map<K2,LexiconEntry> |
map |
protected Object |
modificationLock |
Constructor and Description |
---|
MapLexicon(Map<K2,LexiconEntry> backingMap)
Construct an instance of the class with
|
MapLexicon(Map<K2,LexiconEntry> backingMap,
MapLexicon.Id2EntryIndexLookup idlookupobject)
Construct an instance of the class with
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
Map.Entry<K1,LexiconEntry> |
getIthLexiconEntry(int index)
Get the term and LexiconEntry (contains statistics and a pointer) for
the entry in the lexicon with the specified index.
|
Map.Entry<K1,LexiconEntry> |
getLexiconEntry(int termid)
Get the term and LexiconEntry (contains statistics and a pointer) for
a given term id.
|
LexiconEntry |
getLexiconEntry(K1 term)
Get the LexiconEntry (contains statistics and a pointer) for the given term.
|
Iterator<Map.Entry<K1,LexiconEntry>> |
getLexiconEntryRange(K1 from,
K1 to)
Returns an iterator over a set of LexiconEntries within a range of
entries in the lexicon.
|
int |
numberOfEntries()
Return the number of entries in the lexicon
|
protected abstract void |
setK2(K1 key,
K2 instance) |
protected void |
setTermIdLookup(MapLexicon.Id2EntryIndexLookup idlookupobject) |
protected abstract K1 |
toK1(K2 key) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, iterator, spliterator
protected WriteableFactory<K2 extends org.apache.hadoop.io.WritableComparable> keyFactory
protected Object modificationLock
protected final Map<K2 extends org.apache.hadoop.io.WritableComparable,LexiconEntry> map
public MapLexicon(Map<K2,LexiconEntry> backingMap)
backingMap
- public MapLexicon(Map<K2,LexiconEntry> backingMap, MapLexicon.Id2EntryIndexLookup idlookupobject)
backingMap
- idlookupobject
- protected void setTermIdLookup(MapLexicon.Id2EntryIndexLookup idlookupobject)
public LexiconEntry getLexiconEntry(K1 term)
getLexiconEntry
in class Lexicon<K1>
term
- key to lookup the lexicon withpublic Map.Entry<K1,LexiconEntry> getIthLexiconEntry(int index)
getIthLexiconEntry
in class Lexicon<K1>
index
- the entry number to lookup in the lexiconpublic Iterator<Map.Entry<K1,LexiconEntry>> getLexiconEntryRange(K1 from, K1 to)
getLexiconEntryRange
in class Lexicon<K1>
from
- low endpoint term in the subset, inclusive.to
- high endpoint term in the subset, exclusive.public Map.Entry<K1,LexiconEntry> getLexiconEntry(int termid)
getLexiconEntry
in class Lexicon<K1>
termid
- the term id to lookup in the lexiconpublic int numberOfEntries()
numberOfEntries
in class Lexicon<K1>
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Terrier Information Retrieval Platform 5.1. Copyright © 2004-2019, University of Glasgow