FileDocCategorySizeDatePackage
SanityChecker.javaAPI DocApache Poi 3.0.112407Mon Jan 01 12:39:46 GMT 2007org.apache.poi.hssf.usermodel

SanityChecker

public class SanityChecker extends Assert
Designed to check wither the records written actually make sense.

Fields Summary
CheckRecord[]
workbookRecords
CheckRecord[]
sheetRecords
Constructors Summary
Methods Summary
public voidcheckHSSFWorkbook(org.apache.poi.hssf.usermodel.HSSFWorkbook wb)

        checkWorkbookRecords(wb.getWorkbook());
        for (int i = 0; i < wb.getNumberOfSheets(); i++)
            checkSheetRecords(wb.getSheetAt(i).getSheet());

    
voidcheckRecordOrder(java.util.List records, org.apache.poi.hssf.usermodel.SanityChecker$CheckRecord[] check)

        int recordIdx = 0;
        for ( int checkIdx = 0; checkIdx < check.length; checkIdx++ )
        {
            recordIdx = check[checkIdx].match(records, recordIdx);
        }
    
private voidcheckSheetRecords(org.apache.poi.hssf.model.Sheet sheet)

        List records = sheet.getRecords();
        assertTrue(records.get(0) instanceof BOFRecord);
        assertTrue(records.get(records.size() - 1) instanceof EOFRecord);

        checkRecordOrder(records, sheetRecords);
//        checkRecordsTogether(records, sheetRecords);
    
private voidcheckWorkbookRecords(org.apache.poi.hssf.model.Workbook workbook)


       
    
        List records = workbook.getRecords();
        assertTrue(records.get(0) instanceof BOFRecord);
        assertTrue(records.get(records.size() - 1) instanceof EOFRecord);

        checkRecordOrder(records, workbookRecords);
//        checkRecordsTogether(records, workbookRecords);
    
private static intfindFirstRecord(java.util.List records, java.lang.Class record, int startIndex)

        for (int i = startIndex; i < records.size(); i++)
        {
            if (record.getName().equals(records.get(i).getClass().getName()))
                return i;
        }
        return -1;