Package org.terrier.structures
Class FSADocumentIndexInMem
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<V>
-
- org.terrier.structures.collections.FSArrayFile<V>
-
- org.terrier.structures.collections.FSArrayFileInMem<DocumentIndexEntry>
-
- org.terrier.structures.FSADocumentIndexInMem
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Iterable<DocumentIndexEntry>,java.util.Collection<DocumentIndexEntry>,java.util.List<DocumentIndexEntry>,DocumentIndex
- Direct Known Subclasses:
FSADocumentIndexInMemFields
public class FSADocumentIndexInMem extends FSArrayFileInMem<DocumentIndexEntry> implements DocumentIndex
A DocumentIndex implementation that loads everything in memory. It is not compatible with fields.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.terrier.structures.collections.FSArrayFile
FSArrayFile.ArrayFileIterator<V extends org.apache.hadoop.io.Writable>, FSArrayFile.ArrayFileWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]docLengthsprotected intlastDocidprotected DocumentIndexEntrylastEntry-
Fields inherited from class org.terrier.structures.collections.FSArrayFile
dataFile, dataFilename, entrySize, numberOfEntries, USUAL_EXTENSION, valueFactory
-
-
Constructor Summary
Constructors Constructor Description FSADocumentIndexInMem(IndexOnDisk index, java.lang.String structureName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DocumentIndexEntrygetDocumentEntry(int docid)Return the document index entry based on its docid.intgetDocumentLength(int docid)Return the length of the document.intgetNumberOfDocuments()Return the number of documents.-
Methods inherited from class org.terrier.structures.collections.FSArrayFileInMem
get
-
Methods inherited from class org.terrier.structures.collections.FSArrayFile
close, iterator, size, writeFSArrayFile
-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
-
-
-
Field Detail
-
lastDocid
protected int lastDocid
-
lastEntry
protected DocumentIndexEntry lastEntry
-
docLengths
protected int[] docLengths
-
-
Constructor Detail
-
FSADocumentIndexInMem
public FSADocumentIndexInMem(IndexOnDisk index, java.lang.String structureName) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getDocumentLength
public final int getDocumentLength(int docid) throws java.io.IOExceptionDescription copied from interface:DocumentIndexReturn the length of the document.- Specified by:
getDocumentLengthin interfaceDocumentIndex- Returns:
- the length of the document.
- Throws:
java.io.IOException
-
getDocumentEntry
public DocumentIndexEntry getDocumentEntry(int docid) throws java.io.IOException
Description copied from interface:DocumentIndexReturn the document index entry based on its docid.- Specified by:
getDocumentEntryin interfaceDocumentIndex- Returns:
- the document index entry based on its docid.
- Throws:
java.io.IOException
-
getNumberOfDocuments
public int getNumberOfDocuments()
Description copied from interface:DocumentIndexReturn the number of documents.- Specified by:
getNumberOfDocumentsin interfaceDocumentIndex- Returns:
- the number of documents.
-
-