Class ConcatenatedDocumentSequence
- java.lang.Object
-
- it.unimi.di.big.mg4j.document.AbstractDocumentSequence
-
- it.unimi.di.big.mg4j.document.ConcatenatedDocumentSequence
-
- All Implemented Interfaces:
DocumentSequence,SafelyCloseable,Closeable,AutoCloseable
public class ConcatenatedDocumentSequence extends AbstractDocumentSequence
A document sequence exhibiting a list of underlying document sequences, called segments, as a single sequence. The underlying sequences are (virtually) concatenated—that is, the first document of the second sequence is renumbered to the size of the first sequence, and so on. All underlying sequences must use the same factory class.- Author:
- Paolo Boldi, Sebastiano Vigna
-
-
Constructor Summary
Constructors Modifier Constructor Description ConcatenatedDocumentSequence(DocumentSequence... sequence)Creates a new concatenated document sequence using giving component sequences.ConcatenatedDocumentSequence(String... sequenceName)Creates a new concatenated document sequence using giving serialised component sequences.protectedConcatenatedDocumentSequence(String[] sequenceName, DocumentSequence[] sequence)Creates a new concatenated document sequence using giving component sequences.
-
Method Summary
Modifier and Type Method Description voidclose()Closes this document sequence, releasing all resources.DocumentFactoryfactory()Returns the factory used by this sequence.voidfilename(CharSequence filename)Does nothing.DocumentIteratoriterator()Returns an iterator over the sequence of documents.-
Methods inherited from class it.unimi.di.big.mg4j.document.AbstractDocumentSequence
finalize, load
-
-
-
-
Constructor Detail
-
ConcatenatedDocumentSequence
public ConcatenatedDocumentSequence(DocumentSequence... sequence) throws IOException
Creates a new concatenated document sequence using giving component sequences.- Parameters:
sequence- a list of component sequences.- Throws:
IOException
-
ConcatenatedDocumentSequence
public ConcatenatedDocumentSequence(String... sequenceName) throws IOException
Creates a new concatenated document sequence using giving serialised component sequences.- Parameters:
sequenceName- a list of serialised component sequences.- Throws:
IOException
-
ConcatenatedDocumentSequence
protected ConcatenatedDocumentSequence(String[] sequenceName, DocumentSequence[] sequence) throws IOException
Creates a new concatenated document sequence using giving component sequences.- Parameters:
sequenceName-sequence- a list of component sequences.- Throws:
IOException
-
-
Method Detail
-
filename
public void filename(CharSequence filename)
Description copied from class:AbstractDocumentSequenceDoes nothing.- Specified by:
filenamein interfaceDocumentSequence- Overrides:
filenamein classAbstractDocumentSequence- Parameters:
filename- the filename of this document sequence.
-
factory
public DocumentFactory factory()
Description copied from interface:DocumentSequenceReturns the factory used by this sequence.Every document sequence is based on a document factory that transforms raw bytes into a sequence of characters. The factory contains useful information such as the number of fields.
- Returns:
- the factory used by this sequence.
-
close
public void close() throws IOExceptionDescription copied from interface:DocumentSequenceCloses this document sequence, releasing all resources.You should always call this method after having finished with this document sequence. Implementations are invited to call this method in a finaliser as a safety net (even better, implement
SafelyCloseable), but since there is no guarantee as to when finalisers are invoked, you should not depend on this behaviour.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceDocumentSequence- Overrides:
closein classAbstractDocumentSequence- Throws:
IOException
-
iterator
public DocumentIterator iterator() throws IOException
Description copied from interface:DocumentSequenceReturns an iterator over the sequence of documents.Warning: this method can be safely called just one time. For instance, implementations based on standard input will usually throw an exception if this method is called twice.
Implementations may decide to override this restriction (in particular, if they implement
DocumentCollection). Usually, however, it is not possible to obtain two iterators at the same time on a collection.- Returns:
- an iterator over the sequence of documents.
- Throws:
IOException- See Also:
DocumentCollection
-
-