korat.utils.cv
Class CVWriterDelta
java.lang.Object
korat.utils.cv.CVWriterDelta
- All Implemented Interfaces:
- ICVWriter
public class CVWriterDelta
- extends Object
- implements ICVWriter
Writes candidate vectors using deltas. Every N
th 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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
CVWriterDelta
protected CVWriterDelta(String fileName,
int numElemsPerCV,
int maxElem)
throws IOException
- Throws:
IOException
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 filepredicateOK
- 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)