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[]
docLengths
protected int
lastDocid
protected DocumentIndexEntry
lastEntry
-
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 DocumentIndexEntry
getDocumentEntry(int docid)
Return the document index entry based on its docid.int
getDocumentLength(int docid)
Return the length of the document.int
getNumberOfDocuments()
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.IOException
Description copied from interface:DocumentIndex
Return the length of the document.- Specified by:
getDocumentLength
in 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:DocumentIndex
Return the document index entry based on its docid.- Specified by:
getDocumentEntry
in interfaceDocumentIndex
- Returns:
- the document index entry based on its docid.
- Throws:
java.io.IOException
-
getNumberOfDocuments
public int getNumberOfDocuments()
Description copied from interface:DocumentIndex
Return the number of documents.- Specified by:
getNumberOfDocuments
in interfaceDocumentIndex
- Returns:
- the number of documents.
-
-