|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwpi.associations.arminerSequence.DBWriter
Used to write itemsets into a database.
Field Summary | |
private static int |
ATTRIB_INDEX_SIZE
|
private long |
attribIndexOffset
|
private static int |
CHAR_SIZE
|
private static int |
COLUMN_LENGTH
|
private static int |
COLUMN_NAME_OFFSET
|
private static int |
COLUMN_SIZE
|
private int |
CRC
|
private static int |
CRC_SIZE
|
private java.lang.String |
description
|
private static int |
DESCRIPTION_LENGTH
|
private static int |
DESCRIPTION_SIZE
|
private long |
descriptionOffset
|
private static int |
HEAD_SIZE_OFFSET
|
private static int |
HEADER_SIZE
|
private long |
headerSize
|
private static java.lang.String |
ID
|
private static int |
ID_SIZE
|
private static int |
INT_SIZE
|
private long |
lastPosition
|
private static int |
LONG_SIZE
|
private boolean |
needReposition
|
private long |
numAttribs
|
private static int |
NUMATTRIBS_OFFSET
|
private static int |
NUMATTRIBS_SIZE
|
private long |
numColumns
|
private static int |
NUMCOLUMNS_OFFSET
|
private static int |
NUMCOLUMNS_SIZE
|
private long |
numRows
|
private static int |
NUMROWS_OFFSET
|
private static int |
NUMROWS_SIZE
|
private java.io.RandomAccessFile |
outStream
|
private boolean |
rowsWritten
|
private static int |
VERSION_OFFSET
|
private static int |
VERSION_SIZE
|
private boolean |
wroteAttribIndexes
|
private boolean |
wroteColumnNames
|
Constructor Summary | |
DBWriter(java.lang.String fileName)
Create a new DBWriter according to the input file name. |
Method Summary | |
void |
addRow(ARMinerItemset itemset)
Add a new row to the database. |
private void |
checkID()
|
void |
close()
Close the I/O stream and save any unsaved data. |
static void |
main(java.lang.String[] args)
|
void |
setAttributeIndexes(java.util.Vector indexes)
Set the indexes of the attributes. |
void |
setColumnNames(java.util.Vector names)
Set the column names for the database. |
void |
setDescription(java.lang.String description)
Set the description of the database. |
static int |
updateCRC(int crc,
int value)
Update a CRC-16 value. |
private void |
writeAttributeIndexes(java.util.Vector indexes)
|
private void |
writeColumnNames(java.util.Vector names)
|
private void |
writeDescription()
|
private void |
writeVersion()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final int CHAR_SIZE
private static final int INT_SIZE
private static final int LONG_SIZE
private static final int CRC_SIZE
private static final int COLUMN_LENGTH
private static final int DESCRIPTION_LENGTH
private static final int ID_SIZE
private static final int VERSION_SIZE
private static final int HEADER_SIZE
private static final int NUMROWS_SIZE
private static final int NUMCOLUMNS_SIZE
private static final int COLUMN_SIZE
private static final int DESCRIPTION_SIZE
private static final int NUMATTRIBS_SIZE
private static final int ATTRIB_INDEX_SIZE
private static final int VERSION_OFFSET
private static final int HEAD_SIZE_OFFSET
private static final int NUMROWS_OFFSET
private static final int NUMCOLUMNS_OFFSET
private static final int NUMATTRIBS_OFFSET
private static final int COLUMN_NAME_OFFSET
private static final java.lang.String ID
private java.io.RandomAccessFile outStream
private java.lang.String description
private long numRows
private long numColumns
private long numAttribs
private int CRC
private long headerSize
private boolean wroteColumnNames
private boolean wroteAttribIndexes
private boolean needReposition
private boolean rowsWritten
private long lastPosition
private long descriptionOffset
private long attribIndexOffset
Constructor Detail |
public DBWriter(java.lang.String fileName) throws java.io.IOException
fileName
- the name of the file
java.io.FileNotFoundException
- from library call
java.io.IOException
- from library call or if file is corruptedMethod Detail |
private void checkID() throws java.io.IOException
java.io.IOException
private void writeVersion() throws java.io.IOException
java.io.IOException
private void writeColumnNames(java.util.Vector names) throws java.io.IOException
java.io.IOException
private void writeDescription() throws java.io.IOException
java.io.IOException
private void writeAttributeIndexes(java.util.Vector indexes) throws java.io.IOException
java.io.IOException
public void setColumnNames(java.util.Vector names) throws java.io.IOException, DBException
names
- the column names
java.io.IOException
- from library call
DBException
- size of names
does not match
number of columnspublic void setAttributeIndexes(java.util.Vector indexes) throws java.io.IOException, DBException
indexes
- a Vector of Longs - the indexes of the attributes
java.io.IOException
- from library call
DBException
public void setDescription(java.lang.String description) throws java.io.IOException
description
- the description of the database
java.io.IOException
- from library callpublic void addRow(ARMinerItemset itemset) throws java.io.IOException, DBException
itemset
- the new row to be added to the data file
java.io.IOException
- from library call
DBException
- column names have not been set
or an invalid item was contained in the itemsetpublic void close() throws java.io.IOException
java.io.IOException
- from library callpublic static int updateCRC(int crc, int value)
crc
- the previous CRC valuevalue
- the value for which we update the CRC
public static void main(java.lang.String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |