edu.cmu.sphinx.util
Class SimpleBatchManager

java.lang.Object
  extended byedu.cmu.sphinx.util.SimpleBatchManager
All Implemented Interfaces:
BatchManager

public class SimpleBatchManager
extends java.lang.Object
implements BatchManager

A simple implementation of the batch manager suitable for single threaded batch processing


Constructor Summary
SimpleBatchManager(java.lang.String filename, int skip, int whichBatch, int totalBatches)
          Constructs a SimpleBatchManager object.
 
Method Summary
 java.lang.String getFilename()
          Returns the name of the file
 BatchItem getNextItem()
          Gets the next available batch item or null if no more are available
 void start()
          Starts processing the batch
 void stop()
          Stops processing the batch
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleBatchManager

public SimpleBatchManager(java.lang.String filename,
                          int skip,
                          int whichBatch,
                          int totalBatches)
Constructs a SimpleBatchManager object.

Parameters:
filename - the name of the batch file
skip - number of records to skip between items
whichBatch - which chunk of the batch should we process
totalBatches - the total number of chuncks that the batch is divided into.
Method Detail

start

public void start()
           throws java.io.IOException
Starts processing the batch

Specified by:
start in interface BatchManager
Throws:
java.io.IOException - if an error occurs while processing the batch file

getNextItem

public BatchItem getNextItem()
                      throws java.io.IOException
Gets the next available batch item or null if no more are available

Specified by:
getNextItem in interface BatchManager
Returns:
the next available batch item
Throws:
java.io.IOException - if an I/O error occurs while getting the next item from the batch file.

stop

public void stop()
          throws java.io.IOException
Stops processing the batch

Specified by:
stop in interface BatchManager
Throws:
java.io.IOException - if an error occurs while processing the batch file

getFilename

public java.lang.String getFilename()
Returns the name of the file

Specified by:
getFilename in interface BatchManager
Returns:
the filename