korat.utils.cv
Class CVReaderDelta

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

public class CVReaderDelta
extends Object
implements ICVReader

Author:
Aleksandar Milicevic

Field Summary
private  BitInputStream bis
           
private  BitInputStream bisDelta
           
private  int cnt
           
private  int fullFormatRatio
           
private  int[] lastCV
           
private  int numBitsPerCVIndex
           
private  int numBitsPerElem
           
private  long numCVs
           
private  long numCVsRead
           
private  int numElemsPerCV
           
private  boolean predicateOK
           
 
Constructor Summary
protected CVReaderDelta(InputStream isFull, InputStream isDelta)
           
protected CVReaderDelta(String fileName)
           
 
Method Summary
 void close()
          Closes underlying files, streams, etc.
 long getNumCVs()
          Returns number of candidate vectors in the file
 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
 int[] readCV()
          Reads next candidate vector from file.
protected static boolean readDelta(int[] cv, int[] lastCV, IBitReader bisDelta, int numBitsPerCVIndex, int numBitsPerElem)
           
protected static Pair<Long,Boolean> readFullFormatVector(int[] cv, IBitReader br, int numBitsPerElem)
           
private  void readHeader()
           
protected  void skipDeltaBits(long bits)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bis

private BitInputStream bis

bisDelta

private BitInputStream bisDelta

numCVs

private long numCVs

numElemsPerCV

private int numElemsPerCV

numBitsPerElem

private int numBitsPerElem

numBitsPerCVIndex

private int numBitsPerCVIndex

fullFormatRatio

private int fullFormatRatio

numCVsRead

private long numCVsRead

predicateOK

private boolean predicateOK

lastCV

private int[] lastCV

cnt

private int cnt
Constructor Detail

CVReaderDelta

protected CVReaderDelta(String fileName)
                 throws IOException
Throws:
IOException

CVReaderDelta

protected CVReaderDelta(InputStream isFull,
                        InputStream isDelta)
                 throws IOException
Throws:
IOException
Method Detail

readHeader

private void readHeader()
                 throws IOException
Throws:
IOException

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

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

readFullFormatVector

protected static Pair<Long,Boolean> readFullFormatVector(int[] cv,
                                                         IBitReader br,
                                                         int numBitsPerElem)
                                                  throws IOException
Throws:
IOException

readDelta

protected static boolean readDelta(int[] cv,
                                   int[] lastCV,
                                   IBitReader bisDelta,
                                   int numBitsPerCVIndex,
                                   int numBitsPerElem)
                            throws IOException
Throws:
IOException

skipDeltaBits

protected void skipDeltaBits(long bits)
                      throws IOException
Throws:
IOException

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

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

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

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

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