it.unipd.dei.ims.circo.indexing
Class BaseDocumentEmitter<D>

java.lang.Object
  extended by it.unipd.dei.ims.circo.indexing.AbstractDocumentEmitter<D>
      extended by it.unipd.dei.ims.circo.indexing.BaseDocumentEmitter<D>
Type Parameters:
D - the actual type of document used by the information retrieval system.
All Implemented Interfaces:
DocumentEmitter<D>, java.lang.Iterable<D>, java.util.Iterator<D>
Direct Known Subclasses:
CircoDocumentEmitter

public abstract class BaseDocumentEmitter<D>
extends AbstractDocumentEmitter<D>
implements DocumentEmitter<D>

Provides a base for the implementation of the DocumentEmitter interface.

Since:
0.10
Version:
0.10
Author:
Nicola Ferro

Field Summary
 
Fields inherited from class it.unipd.dei.ims.circo.indexing.AbstractDocumentEmitter
logger
 
Constructor Summary
protected BaseDocumentEmitter(java.io.File inputDirectory, boolean compressed)
          Creates a new document emitter.
protected BaseDocumentEmitter(java.lang.String inputDirectory, boolean compressed)
          Creates a new document emitter.
 
Method Summary
protected  void endStreamChunk()
          Ends the current stream chunk.
protected  java.io.File getCurrentInputFile()
          Returns the input file where the current chunk is being read.
protected  Stream getCurrentStreamChunk()
          Returns the current stream chunk which is being processed.
 java.lang.String getInputDirectory()
          Returns the directory where stream chunks are stored.
protected  boolean hasNextResource()
          Checks whether there is one more resource to be read.
 boolean isCompressed()
          Checks whether the emitter is reading compressed the stream chunks.
protected  Resource nextResource()
          Reads the next resource in the current stream chunk.
protected  boolean startStreamChunk()
          Starts a new stream chunk.
 
Methods inherited from class it.unipd.dei.ims.circo.indexing.AbstractDocumentEmitter
equals, getIdentifier, hashCode, iterator, remove, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unipd.dei.ims.circo.indexing.DocumentEmitter
close, getIdentifier
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Constructor Detail

BaseDocumentEmitter

protected BaseDocumentEmitter(java.io.File inputDirectory,
                              boolean compressed)
Creates a new document emitter.

Parameters:
inputDirectory - the directory where stream chunks are stored.
compressed - indicates whether the stream chunks are compressed or not.

BaseDocumentEmitter

protected BaseDocumentEmitter(java.lang.String inputDirectory,
                              boolean compressed)
Creates a new document emitter.

Parameters:
inputDirectory - the directory where stream chunks are stored.
compressed - indicates whether the stream chunks are compressed or not.
Method Detail

getInputDirectory

public final java.lang.String getInputDirectory()
Description copied from interface: DocumentEmitter
Returns the directory where stream chunks are stored.

Specified by:
getInputDirectory in interface DocumentEmitter<D>
Returns:
the directory where stream chunks are stored.

isCompressed

public final boolean isCompressed()
Description copied from interface: DocumentEmitter
Checks whether the emitter is reading compressed the stream chunks.

Specified by:
isCompressed in interface DocumentEmitter<D>
Returns:
true if he emitter is reading compressed the stream chunks; false otherwise.

getCurrentInputFile

protected final java.io.File getCurrentInputFile()
Returns the input file where the current chunk is being read.

Returns:
the input file where the current chunk is being read.

getCurrentStreamChunk

protected final Stream getCurrentStreamChunk()
Returns the current stream chunk which is being processed.

Returns:
the current stream chunk which is being processed.

startStreamChunk

protected final boolean startStreamChunk()
                                  throws it.unipd.dei.ims.ici.component.ComponentException
Starts a new stream chunk.

Returns:
true if a new stream chunk has started; false otherwise.
Throws:
it.unipd.dei.ims.ici.component.ComponentException - if something goes wrong while starting the chunk.

endStreamChunk

protected final void endStreamChunk()
                             throws it.unipd.dei.ims.ici.component.ComponentException
Ends the current stream chunk.

Throws:
it.unipd.dei.ims.ici.component.ComponentException - if something goes wrong while ending the chunk.

hasNextResource

protected final boolean hasNextResource()
Checks whether there is one more resource to be read.

Returns:
true if there is one more resource to be read; false otherwise.

nextResource

protected final Resource nextResource()
                               throws it.unipd.dei.ims.ici.component.ComponentException
Reads the next resource in the current stream chunk.

Returns:
the next resource, if any, or null otherwise.
Throws:
it.unipd.dei.ims.ici.component.ComponentException - if something goes wrong while starting the resource.

Copyright © 2008-2009 Information Management Systems (IMS) research group,
Department of Information Engineering, University of Padua, Italy.