Tidy up various indents and generics warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@948878 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2010-05-27 16:22:46 +00:00
parent 959cf9aa7c
commit 13bc8e8500
2 changed files with 20 additions and 28 deletions

View File

@ -1869,9 +1869,7 @@ public final class InternalWorkbook {
* @return the format id of a format that matches or -1 if none found and createIfNotFound * @return the format id of a format that matches or -1 if none found and createIfNotFound
*/ */
public short getFormat(String format, boolean createIfNotFound) { public short getFormat(String format, boolean createIfNotFound) {
Iterator iterator; for (FormatRecord r : formats) {
for (iterator = formats.iterator(); iterator.hasNext();) {
FormatRecord r = (FormatRecord)iterator.next();
if (r.getFormatString().equals(format)) { if (r.getFormatString().equals(format)) {
return (short)r.getIndexCode(); return (short)r.getIndexCode();
} }
@ -1888,7 +1886,7 @@ public final class InternalWorkbook {
* Returns the list of FormatRecords in the workbook. * Returns the list of FormatRecords in the workbook.
* @return ArrayList of FormatRecords in the notebook * @return ArrayList of FormatRecords in the notebook
*/ */
public List getFormats() { public List<FormatRecord> getFormats() {
return formats; return formats;
} }
@ -1919,9 +1917,7 @@ public final class InternalWorkbook {
* Returns the first occurance of a record matching a particular sid. * Returns the first occurance of a record matching a particular sid.
*/ */
public Record findFirstRecordBySid(short sid) { public Record findFirstRecordBySid(short sid) {
for (Iterator iterator = records.iterator(); iterator.hasNext(); ) { for (Record record : records) {
Record record = ( Record ) iterator.next();
if (record.getSid() == sid) { if (record.getSid() == sid) {
return record; return record;
} }
@ -1936,9 +1932,7 @@ public final class InternalWorkbook {
*/ */
public int findFirstRecordLocBySid(short sid) { public int findFirstRecordLocBySid(short sid) {
int index = 0; int index = 0;
for (Iterator iterator = records.iterator(); iterator.hasNext(); ) { for (Record record : records) {
Record record = ( Record ) iterator.next();
if (record.getSid() == sid) { if (record.getSid() == sid) {
return index; return index;
} }
@ -1952,9 +1946,7 @@ public final class InternalWorkbook {
*/ */
public Record findNextRecordBySid(short sid, int pos) { public Record findNextRecordBySid(short sid, int pos) {
int matches = 0; int matches = 0;
for (Iterator iterator = records.iterator(); iterator.hasNext(); ) { for (Record record : records) {
Record record = ( Record ) iterator.next();
if (record.getSid() == sid) { if (record.getSid() == sid) {
if (matches++ == pos) if (matches++ == pos)
return record; return record;
@ -1963,7 +1955,7 @@ public final class InternalWorkbook {
return null; return null;
} }
public List getHyperlinks() public List<HyperlinkRecord> getHyperlinks()
{ {
return hyperlinks; return hyperlinks;
} }
@ -2010,11 +2002,14 @@ public final class InternalWorkbook {
* Finds the primary drawing group, if one already exists * Finds the primary drawing group, if one already exists
*/ */
public void findDrawingGroup() { public void findDrawingGroup() {
if(drawingManager != null) {
// We already have it!
return;
}
// Need to find a DrawingGroupRecord that // Need to find a DrawingGroupRecord that
// contains a EscherDggRecord // contains a EscherDggRecord
for(Iterator<Record> rit = records.iterator(); rit.hasNext();) { for(Record r : records) {
Record r = rit.next();
if(r instanceof DrawingGroupRecord) { if(r instanceof DrawingGroupRecord) {
DrawingGroupRecord dg = (DrawingGroupRecord)r; DrawingGroupRecord dg = (DrawingGroupRecord)r;
dg.processChildRecords(); dg.processChildRecords();
@ -2047,8 +2042,7 @@ public final class InternalWorkbook {
if(dgLoc != -1) { if(dgLoc != -1) {
DrawingGroupRecord dg = (DrawingGroupRecord)records.get(dgLoc); DrawingGroupRecord dg = (DrawingGroupRecord)records.get(dgLoc);
EscherDggRecord dgg = null; EscherDggRecord dgg = null;
for(Iterator it = dg.getEscherRecords().iterator(); it.hasNext();) { for(EscherRecord er : dg.getEscherRecords()) {
Object er = it.next();
if(er instanceof EscherDggRecord) { if(er instanceof EscherDggRecord) {
dgg = (EscherDggRecord)er; dgg = (EscherDggRecord)er;
} }
@ -2086,9 +2080,7 @@ public final class InternalWorkbook {
bstoreContainer = new EscherContainerRecord(); bstoreContainer = new EscherContainerRecord();
bstoreContainer.setRecordId( EscherContainerRecord.BSTORE_CONTAINER ); bstoreContainer.setRecordId( EscherContainerRecord.BSTORE_CONTAINER );
bstoreContainer.setOptions( (short) ( (escherBSERecords.size() << 4) | 0xF ) ); bstoreContainer.setOptions( (short) ( (escherBSERecords.size() << 4) | 0xF ) );
for ( Iterator iterator = escherBSERecords.iterator(); iterator.hasNext(); ) for (EscherRecord escherRecord : escherBSERecords) {
{
EscherRecord escherRecord = (EscherRecord) iterator.next();
bstoreContainer.addChildRecord( escherRecord ); bstoreContainer.addChildRecord( escherRecord );
} }
} }

View File

@ -23,7 +23,7 @@ import java.util.List;
import org.apache.poi.hssf.record.Record; import org.apache.poi.hssf.record.Record;
public final class WorkbookRecordList { public final class WorkbookRecordList implements Iterable<Record> {
private List<Record> records = new ArrayList<Record>(); private List<Record> records = new ArrayList<Record>();
private int protpos = 0; // holds the position of the protect record. private int protpos = 0; // holds the position of the protect record.