|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object it.unimi.di.mg4j.document.AbstractDocumentSequence it.unimi.di.mg4j.document.CompositeDocumentSequence
public class CompositeDocumentSequence
A document sequence composing a list of underlying sequences.
An instance of this class exposes documents formed by juxtaposition of the content
of the underlying document sequences. In particular, it instantiates a CompositeDocumentFactory
using the provided optional array of field names.
For instance, by composing a document sequence whose documents have a single text field and a document sequence whose documents have a single integer field we obtain a new sequence whose documents have two fields.
The title and uri of composed documents are those of the documents returned by the first underlying sequence.
Constructor Summary | |
---|---|
CompositeDocumentSequence(DocumentSequence... sequence)
Creates a new composite document sequence using the provided underlying document sequences, which must possess distinct field names. |
|
CompositeDocumentSequence(DocumentSequence[] sequence,
String[] fieldName)
Creates a new composite document sequence using the provided underlying document sequences. |
Method Summary | |
---|---|
void |
close()
Closes this document sequence, releasing all resources. |
DocumentFactory |
factory()
Returns the factory used by this sequence. |
DocumentIterator |
iterator()
Returns an iterator over the sequence of documents. |
Methods inherited from class it.unimi.di.mg4j.document.AbstractDocumentSequence |
---|
filename, finalize, load |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CompositeDocumentSequence(DocumentSequence... sequence)
sequence
- an array of underlying document sequences (they must
return the same number of documents).public CompositeDocumentSequence(DocumentSequence[] sequence, String[] fieldName)
sequence
- an array of underlying document sequences (they must
return the same number of documents).fieldName
- an array of field names for all fields resulting from the composition of the
document factories of the underlying sequences: it will be passed to
CompositeDocumentFactory.CompositeDocumentFactory(DocumentFactory[], String[])
(so in particular it may be null
if all fields have distinct names).Method Detail |
---|
public void close() throws IOException
DocumentSequence
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.
close
in interface DocumentSequence
close
in interface Closeable
close
in class AbstractDocumentSequence
IOException
public DocumentFactory factory()
DocumentSequence
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.
public DocumentIterator iterator() throws IOException
DocumentSequence
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.
IOException
DocumentCollection
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |