Lots of documentation updates, to make it clearer how the code actually works

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@617156 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2008-01-31 16:41:53 +00:00
parent bfd5ebe008
commit 22d8a53710

View File

@ -161,31 +161,37 @@ public class HSSFEventFactory
break; break;
// If we had a last record, and this one
// isn't a continue record, then pass
// it on to the listener
if ((rec != null) && (sid != ContinueRecord.sid)) if ((rec != null) && (sid != ContinueRecord.sid))
{ {
userCode = req.processRecord(rec); userCode = req.processRecord(rec);
if (userCode != 0) break process; if (userCode != 0) break process;
} }
// If this record isn't a continue record,
// then build it up
if (sid != ContinueRecord.sid) if (sid != ContinueRecord.sid)
{ {
//System.out.println("creating "+sid); //System.out.println("creating "+sid);
Record[] recs = RecordFactory.createRecord(in); Record[] recs = RecordFactory.createRecord(in);
if (recs.length > 1) // We know that the multiple record situations
{ // we know that the multiple // don't contain continue records, so just
for (int k = 0; k < (recs.length - 1); k++) // pass those on to the listener now
{ // record situations do not if (recs.length > 1) {
for (int k = 0; k < (recs.length - 1); k++) {
userCode = req.processRecord( userCode = req.processRecord(
recs[ k ]); // contain continue records recs[ k ]);
if (userCode != 0) break process; if (userCode != 0) break process;
} }
} }
rec = recs[ recs.length - 1 ]; // regardless we'll process
// the last record as though // Regardless of the number we created, always hold
// it might be continued // onto the last record to be processed on the next
// if there is only one // loop, in case it has any continue records
// records, it will go here too. rec = recs[ recs.length - 1 ];
} }
else { else {
// Normally, ContinueRecords are handled internally // Normally, ContinueRecords are handled internally
@ -220,18 +226,16 @@ public class HSSFEventFactory
if(rec instanceof DrawingRecord) { if(rec instanceof DrawingRecord) {
lastDrawingRecord = (DrawingRecord)rec; lastDrawingRecord = (DrawingRecord)rec;
} }
} } // main while loop
if (rec != null)
{ // Process the last record in the stream, if
// it's still outstanding
if (rec != null) {
userCode = req.processRecord(rec); userCode = req.processRecord(rec);
if (userCode != 0) break process; if (userCode != 0) break process;
} }
} }
return userCode; return userCode;
// Record[] retval = new Record[ records.size() ];
// retval = ( Record [] ) records.toArray(retval);
// return null;
} }
} }