korat.utils.cv
Class CVReader

java.lang.Object
  extended by korat.utils.cv.CVReader
All Implemented Interfaces:
ICVReader

public class CVReader
extends Object
implements ICVReader

Utility for reading candidate vector files written according to CVWriter's format.

Author:
Aleksandar Milicevic

Field Summary
private  BitInputStream bis
           
private  int numBitsPerElem
           
private  long numCVs
           
private  long numCVsRead
           
private  int numElemsPerCV
           
private  boolean predicateOK
           
 
Constructor Summary
protected CVReader(InputStream in)
           
protected CVReader(String fileName)
           
 
Method Summary
 void close()
          Closes underlying files, streams, etc.
 long getNumCVs()
          Returns number of candidate vectors in the file
 long getNumCVsLeftToRead()
           
 long getNumCVsRead()
          Returns how many vectors have been read already.
 int getNumElemsPerCV()
          Returns number of elements per candidate vector
 boolean hasNext()
          Returns are there more vectors to be read.
 boolean isPredicateOK()
          Call this method immediately after calling readCV to find out if the read vector passes predicate check or not
static void main(String[] args)
           
 int[] readCV()
          Reads next candidate vector from file.
private  void readHeader()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bis

private BitInputStream bis

numCVs

private long numCVs

numElemsPerCV

private int numElemsPerCV

numBitsPerElem

private int numBitsPerElem

numCVsRead

private long numCVsRead

predicateOK

private boolean predicateOK
Constructor Detail

CVReader

protected CVReader(String fileName)
            throws IOException
Throws:
IOException

CVReader

protected CVReader(InputStream in)
            throws IOException
Throws:
IOException
Method Detail

readHeader

private void readHeader()
                 throws IOException
Throws:
IOException

readCV

public int[] readCV()
             throws IOException
Description copied from interface: ICVReader
Reads next candidate vector from file.

Specified by:
readCV in interface ICVReader
Returns:
next candidate vector from file
Throws:
IOException - if an I/O error occurs

close

public void close()
           throws IOException
Description copied from interface: ICVReader
Closes underlying files, streams, etc.

Specified by:
close in interface ICVReader
Throws:
IOException - if an I/O error occurs

hasNext

public boolean hasNext()
Description copied from interface: ICVReader
Returns are there more vectors to be read.

Specified by:
hasNext in interface ICVReader
Returns:
are there more vector to be read

getNumCVs

public long getNumCVs()
Description copied from interface: ICVReader
Returns number of candidate vectors in the file

Specified by:
getNumCVs in interface ICVReader
Returns:
number of candidate vectors in the file

getNumElemsPerCV

public int getNumElemsPerCV()
Description copied from interface: ICVReader
Returns number of elements per candidate vector

Specified by:
getNumElemsPerCV in interface ICVReader
Returns:
number of elements per candidate vector

getNumCVsRead

public long getNumCVsRead()
Description copied from interface: ICVReader
Returns how many vectors have been read already.

Specified by:
getNumCVsRead in interface ICVReader
Returns:
how many vectors have been read already

getNumCVsLeftToRead

public long getNumCVsLeftToRead()

isPredicateOK

public boolean isPredicateOK()
Description copied from interface: ICVReader
Call this method immediately after calling readCV to find out if the read vector passes predicate check or not

Specified by:
isPredicateOK in interface ICVReader
Returns:
is predicate ok or not for the last read candidate vector

main

public static void main(String[] args)