korat.utils.cv
Class CVWriterDelta

java.lang.Object
  extended by korat.utils.cv.CVWriterDelta
All Implemented Interfaces:
ICVWriter

public class CVWriterDelta
extends Object
implements ICVWriter

Writes candidate vectors using deltas. Every Nth candidate vector is written in full format (as with CVWriter) in a file that contains only full-format vectors. Vectors in between are stored in a separate file that contains only the difference (delta) comparing to the last vector.

Author:
Aleksandar Milicevic

Field Summary
private  BitOutputStream bos
           
private  BitOutputStream bosDelta
           
private  int cnt
           
protected static int CODE_LEN
           
private  long deltaOffset
           
private  String fileName
           
protected static int FOLLOWING_SAME_CODE
           
protected static int FOLLOWING_SAME_INC_CODE
           
protected static int FOLLOWING_ZEROS_CODE
           
protected static int FOLLOWING_ZEROS_INC_CODE
           
private  int[] lastCV
           
protected static int MANY_BITS_CHANGED
          Per how many vectors one should be stored in full format (ratio of all vectors and full format vectors)
private  int numBitsPerCVIndex
           
private  int numBitsPerElem
           
private  long numCVs
           
private  int numElemsPerCV
           
protected static int ONE_BIT_CHANGED
           
 
Constructor Summary
protected CVWriterDelta(String fileName, int numElemsPerCV, int maxElem)
           
 
Method Summary
 void close()
          Closes underlying files, streams, etc.
protected static String getDeltaFileName(String fileName)
           
static void main(String[] args)
           
 void writeCV(int[] cv, boolean predicateOK)
          Writes given candidate vector and its predicateOK flag to file.
private  boolean writeDeltaCV(int[] cv, boolean predicateOK)
           
private  void writeFullFormatCV(int[] cv, boolean predicateOK)
           
private  void writeHeader()
           
private  void writePredicateBit(boolean predicateOK, BitOutputStream os)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MANY_BITS_CHANGED

protected static final int MANY_BITS_CHANGED
Per how many vectors one should be stored in full format (ratio of all vectors and full format vectors)

See Also:
Constant Field Values

ONE_BIT_CHANGED

protected static final int ONE_BIT_CHANGED
See Also:
Constant Field Values

CODE_LEN

protected static final int CODE_LEN
See Also:
Constant Field Values

FOLLOWING_ZEROS_INC_CODE

protected static final int FOLLOWING_ZEROS_INC_CODE
See Also:
Constant Field Values

FOLLOWING_ZEROS_CODE

protected static final int FOLLOWING_ZEROS_CODE
See Also:
Constant Field Values

FOLLOWING_SAME_CODE

protected static final int FOLLOWING_SAME_CODE
See Also:
Constant Field Values

FOLLOWING_SAME_INC_CODE

protected static final int FOLLOWING_SAME_INC_CODE
See Also:
Constant Field Values

fileName

private String fileName

numCVs

private long numCVs

numBitsPerElem

private int numBitsPerElem

numElemsPerCV

private int numElemsPerCV

numBitsPerCVIndex

private int numBitsPerCVIndex

lastCV

private int[] lastCV

bos

private BitOutputStream bos

bosDelta

private BitOutputStream bosDelta

cnt

private int cnt

deltaOffset

private long deltaOffset
Constructor Detail

CVWriterDelta

protected CVWriterDelta(String fileName,
                        int numElemsPerCV,
                        int maxElem)
                 throws IOException
Throws:
IOException
Method Detail

writeHeader

private void writeHeader()
                  throws IOException
Throws:
IOException

close

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

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

writeCV

public void writeCV(int[] cv,
                    boolean predicateOK)
             throws IOException
Description copied from interface: ICVWriter
Writes given candidate vector and its predicateOK flag to file.

Specified by:
writeCV in interface ICVWriter
Parameters:
cv - candidate vector to be written to file
predicateOK - if the given candidate vector passes predicate check or not
Throws:
IOException - if an I/O error occurs

writeFullFormatCV

private void writeFullFormatCV(int[] cv,
                               boolean predicateOK)
                        throws IOException
Throws:
IOException

writeDeltaCV

private boolean writeDeltaCV(int[] cv,
                             boolean predicateOK)
                      throws IOException
Throws:
IOException

writePredicateBit

private void writePredicateBit(boolean predicateOK,
                               BitOutputStream os)
                        throws IOException
Throws:
IOException

getDeltaFileName

protected static String getDeltaFileName(String fileName)

main

public static void main(String[] args)