mirror of https://github.com/apache/poi.git
Eclipse automated refactor/cleanup: convert for loops to for-each loops
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1765728 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
99125ee191
commit
e88722f052
|
@ -30,9 +30,9 @@ public class CombinedIteratorTest {
|
|||
|
||||
Iterator<String> iter = iterable.iterator();
|
||||
|
||||
for (int i = 0; i < expected.length; i++) {
|
||||
for (String element : expected) {
|
||||
Assert.assertEquals(true, iter.hasNext());
|
||||
Assert.assertEquals(expected[i], iter.next());
|
||||
Assert.assertEquals(element, iter.next());
|
||||
}
|
||||
|
||||
Assert.assertEquals(false, iter.hasNext());
|
||||
|
|
|
@ -155,10 +155,8 @@ public class TestXSSFEventBasedExcelExtractor extends TestCase {
|
|||
|
||||
POITextExtractor[] extractors =
|
||||
new POITextExtractor[] { ooxmlExtractor, ole2Extractor };
|
||||
for (int i = 0; i < extractors.length; i++) {
|
||||
POITextExtractor extractor = extractors[i];
|
||||
|
||||
String text = extractor.getText().replaceAll("[\r\t]", "");
|
||||
for (POITextExtractor extractor : extractors) {
|
||||
String text = extractor.getText().replaceAll("[\r\t]", "");
|
||||
assertTrue(text.startsWith("First Sheet\nTest spreadsheet\n2nd row2nd row 2nd column\n"));
|
||||
Pattern pattern = Pattern.compile(".*13(\\.0+)?\\s+Sheet3.*", Pattern.DOTALL);
|
||||
Matcher m = pattern.matcher(text);
|
||||
|
|
|
@ -190,8 +190,7 @@ public class TestXSSFDataValidation extends BaseTestDataValidation {
|
|||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < doubleOperandOperatorTypes.length; j++) {
|
||||
int operatorType = doubleOperandOperatorTypes[j];
|
||||
for (int operatorType : doubleOperandOperatorTypes) {
|
||||
final Row row1 = sheet.createRow(offset++);
|
||||
|
||||
cell_10 = row1.createCell(0);
|
||||
|
|
|
@ -69,14 +69,14 @@ public final class TestStreamBugs extends StreamTest {
|
|||
|
||||
// Get without recursing
|
||||
Pointer[] ptrs = trailer.getChildPointers();
|
||||
for(int i=0; i<ptrs.length; i++) {
|
||||
Stream.createStream(ptrs[i], contents, chunkFactory, ptrFactory);
|
||||
for (Pointer ptr : ptrs) {
|
||||
Stream.createStream(ptr, contents, chunkFactory, ptrFactory);
|
||||
}
|
||||
|
||||
// Get with recursing into chunks
|
||||
for(int i=0; i<ptrs.length; i++) {
|
||||
for (Pointer ptr : ptrs) {
|
||||
Stream stream =
|
||||
Stream.createStream(ptrs[i], contents, chunkFactory, ptrFactory);
|
||||
Stream.createStream(ptr, contents, chunkFactory, ptrFactory);
|
||||
if(stream instanceof ChunkStream) {
|
||||
ChunkStream cStream = (ChunkStream)stream;
|
||||
cStream.findChunks();
|
||||
|
@ -84,9 +84,9 @@ public final class TestStreamBugs extends StreamTest {
|
|||
}
|
||||
|
||||
// Get with recursing into chunks and pointers
|
||||
for(int i=0; i<ptrs.length; i++) {
|
||||
for (Pointer ptr : ptrs) {
|
||||
Stream stream =
|
||||
Stream.createStream(ptrs[i], contents, chunkFactory, ptrFactory);
|
||||
Stream.createStream(ptr, contents, chunkFactory, ptrFactory);
|
||||
if(stream instanceof PointerContainingStream) {
|
||||
PointerContainingStream pStream =
|
||||
(PointerContainingStream)stream;
|
||||
|
|
|
@ -117,8 +117,7 @@ public final class TestExHyperlink extends TestCase {
|
|||
|
||||
// Within that, grab out the Hyperlink atoms
|
||||
List<ExHyperlink> linksA = new ArrayList<ExHyperlink>();
|
||||
for(int i=0; i<exObjList._children.length; i++) {
|
||||
Record ch = exObjList._children[i];
|
||||
for (Record ch : exObjList._children) {
|
||||
if(ch instanceof ExHyperlink) {
|
||||
linksA.add((ExHyperlink) ch);
|
||||
}
|
||||
|
|
|
@ -75,8 +75,7 @@ public final class TestAddingSlides extends TestCase {
|
|||
//grab UserEditAtom
|
||||
UserEditAtom usredit = null;
|
||||
Record[] _records = hss_empty.getRecords();
|
||||
for (int i = 0; i < _records.length; i++) {
|
||||
Record record = _records[i];
|
||||
for (Record record : _records) {
|
||||
if(record.getRecordType() == RecordTypes.UserEditAtom.typeID) {
|
||||
usredit = (UserEditAtom)record;
|
||||
}
|
||||
|
@ -169,10 +168,9 @@ public final class TestAddingSlides extends TestCase {
|
|||
//grab UserEditAtom
|
||||
UserEditAtom usredit = null;
|
||||
Record[] _records = hss_two.getRecords();
|
||||
for (int i = 0; i < _records.length; i++) {
|
||||
Record record = _records[i];
|
||||
if(_records[i].getRecordType() == RecordTypes.UserEditAtom.typeID) {
|
||||
usredit = (UserEditAtom)_records[i];
|
||||
for (Record record : _records) {
|
||||
if(record.getRecordType() == RecordTypes.UserEditAtom.typeID) {
|
||||
usredit = (UserEditAtom)record;
|
||||
}
|
||||
}
|
||||
assertNotNull(usredit);
|
||||
|
|
|
@ -47,8 +47,8 @@ public final class TestRecordSetup {
|
|||
@Test
|
||||
public void testHandleParentAwareRecords() {
|
||||
Record[] records = hss.getRecords();
|
||||
for(int i=0; i<records.length; i++) {
|
||||
ensureParentAware(records[i],null);
|
||||
for (Record record : records) {
|
||||
ensureParentAware(record,null);
|
||||
}
|
||||
}
|
||||
private void ensureParentAware(Record r,RecordContainer parent) {
|
||||
|
|
|
@ -62,9 +62,7 @@ public class AllDataFilesTester {
|
|||
{
|
||||
return file.isFile() && file.getName().startsWith("Test");
|
||||
}});
|
||||
for (int i = 0; i < docs.length; i++)
|
||||
{
|
||||
final File doc = docs[i];
|
||||
for (final File doc : docs) {
|
||||
final Logger logger = Logger.getLogger(getClass().getName());
|
||||
logger.info("Processing file \" " + doc.toString() + "\".");
|
||||
|
||||
|
|
|
@ -58,9 +58,7 @@ public class TestReadAllFiles extends TestCase {
|
|||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < fileList.length; i++)
|
||||
{
|
||||
final File f = fileList[i];
|
||||
for (final File f : fileList) {
|
||||
/* Read the POI filesystem's property set streams: */
|
||||
final POIFile[] psf1 = Util.readPropertySets(f);
|
||||
|
||||
|
|
|
@ -473,9 +473,7 @@ public class TestWrite
|
|||
Throwable thr = null;
|
||||
final int[] validCodepages = new int[]
|
||||
{CODEPAGE_DEFAULT, CODEPAGE_UTF8, CODEPAGE_UTF16, CODEPAGE_1252};
|
||||
for (int i = 0; i < validCodepages.length; i++)
|
||||
{
|
||||
final int cp = validCodepages[i];
|
||||
for (final int cp : validCodepages) {
|
||||
if (cp == -1 && !hasProperDefaultCharset())
|
||||
{
|
||||
System.err.println(IMPROPER_DEFAULT_CHARSET_MESSAGE +
|
||||
|
@ -512,9 +510,7 @@ public class TestWrite
|
|||
}
|
||||
|
||||
final int[] invalidCodepages = new int[] {0, 1, 2, 4711, 815};
|
||||
for (int i = 0; i < invalidCodepages.length; i++)
|
||||
{
|
||||
int cp = invalidCodepages[i];
|
||||
for (int cp : invalidCodepages) {
|
||||
final long type = cp == CODEPAGE_UTF16 ? Variant.VT_LPWSTR
|
||||
: Variant.VT_LPSTR;
|
||||
try
|
||||
|
|
|
@ -643,12 +643,11 @@ public class TestWriteWellKnown {
|
|||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < docs.length; i++)
|
||||
{
|
||||
for (File doc : docs) {
|
||||
try {
|
||||
task.runTest(docs[i]);
|
||||
task.runTest(doc);
|
||||
} catch (Exception e) {
|
||||
throw new IOException("While handling file " + docs[i], e);
|
||||
throw new IOException("While handling file " + doc, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,10 +159,8 @@ final class Util {
|
|||
/* Register the listener for all POI files. */
|
||||
r.registerListener(pfl);
|
||||
else
|
||||
/* Register the listener for the specified POI files
|
||||
* only. */
|
||||
for (int i = 0; i < poiFiles.length; i++)
|
||||
r.registerListener(pfl, poiFiles[i]);
|
||||
for (String poiFile : poiFiles)
|
||||
r.registerListener(pfl, poiFile);
|
||||
|
||||
/* Read the POI filesystem. */
|
||||
FileInputStream stream = new FileInputStream(poiFs);
|
||||
|
@ -257,9 +255,7 @@ final class Util {
|
|||
for (Iterator<String> i = p.stringPropertyNames().iterator(); i.hasNext();)
|
||||
names.add(i.next());
|
||||
Collections.sort(names);
|
||||
for (final Iterator<String> i = names.iterator(); i.hasNext();)
|
||||
{
|
||||
String name = i.next();
|
||||
for (String name : names) {
|
||||
String value = p.getProperty(name);
|
||||
System.out.println(name + ": " + value);
|
||||
}
|
||||
|
|
|
@ -104,8 +104,8 @@ public final class TestEventWorkbookBuilder extends TestCase {
|
|||
assertEquals("Sh3", stubHSSF.getSheetName(2));
|
||||
|
||||
// Check we can get the formula without breaking
|
||||
for(int i=0; i<fRecs.length; i++) {
|
||||
HSSFFormulaParser.toFormulaString(stubHSSF, fRecs[i].getParsedExpression());
|
||||
for (FormulaRecord fRec : fRecs) {
|
||||
HSSFFormulaParser.toFormulaString(stubHSSF, fRec.getParsedExpression());
|
||||
}
|
||||
|
||||
// Peer into just one formula, and check that
|
||||
|
|
|
@ -73,8 +73,8 @@ public final class TestFormatTrackingHSSFListener {
|
|||
String[] files = new String[] {
|
||||
"45365.xls", "45365-2.xls", "MissingBits.xls"
|
||||
};
|
||||
for(int k=0; k<files.length; k++) {
|
||||
processFile(files[k]);
|
||||
for (String file : files) {
|
||||
processFile(file);
|
||||
|
||||
// Check we found our formats
|
||||
assertTrue(listener.getNumberOfCustomFormats() > 5);
|
||||
|
|
|
@ -91,8 +91,8 @@ public final class TestHSSFEventFactory extends TestCase {
|
|||
assertTrue( recs.length > 100 );
|
||||
|
||||
// And none of them are continue ones
|
||||
for(int i=0; i<recs.length; i++) {
|
||||
assertFalse( recs[i] instanceof ContinueRecord );
|
||||
for (Record rec : recs) {
|
||||
assertFalse( rec instanceof ContinueRecord );
|
||||
}
|
||||
|
||||
// Check that the last few records are as we expect
|
||||
|
|
|
@ -445,8 +445,7 @@ public final class TestMissingRecordAwareHSSFListener extends TestCase {
|
|||
int eorCount=0;
|
||||
int mbrCount=0;
|
||||
int brCount=0;
|
||||
for (int i = 0; i < rr.length; i++) {
|
||||
Record record = rr[i];
|
||||
for (Record record : rr) {
|
||||
if (record instanceof MulBlankRecord) {
|
||||
mbrCount++;
|
||||
}
|
||||
|
@ -474,8 +473,7 @@ public final class TestMissingRecordAwareHSSFListener extends TestCase {
|
|||
Record[] rr = r;
|
||||
int missingCount=0;
|
||||
int lastCount=0;
|
||||
for (int i = 0; i < rr.length; i++) {
|
||||
Record record = rr[i];
|
||||
for (Record record : rr) {
|
||||
if (record instanceof MissingCellDummyRecord) {
|
||||
missingCount++;
|
||||
}
|
||||
|
|
|
@ -297,8 +297,7 @@ public final class TestSheet {
|
|||
boolean is11 = false;
|
||||
|
||||
int[] rowBreaks = sheet.getRowBreaks();
|
||||
for (int i = 0; i < rowBreaks.length; i++) {
|
||||
int main = rowBreaks[i];
|
||||
for (int main : rowBreaks) {
|
||||
if (main != 0 && main != 10 && main != 11) fail("Invalid page break");
|
||||
if (main == 0) is0 = true;
|
||||
if (main == 10) is10= true;
|
||||
|
@ -355,8 +354,7 @@ public final class TestSheet {
|
|||
boolean is15 = false;
|
||||
|
||||
int[] colBreaks = sheet.getColumnBreaks();
|
||||
for (int i = 0; i < colBreaks.length; i++) {
|
||||
int main = colBreaks[i];
|
||||
for (int main : colBreaks) {
|
||||
if (main != 0 && main != 1 && main != 10 && main != 15) fail("Invalid page break");
|
||||
if (main == 0) is0 = true;
|
||||
if (main == 1) is1 = true;
|
||||
|
|
|
@ -213,9 +213,9 @@ public final class TestRecordFactory extends TestCase {
|
|||
EOFRecord.instance,
|
||||
};
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
for (int i = 0; i < recs.length; i++) {
|
||||
for (Record rec : recs) {
|
||||
try {
|
||||
baos.write(recs[i].serialize());
|
||||
baos.write(rec.serialize());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -238,8 +238,7 @@ public final class TestSharedFormulaRecord extends TestCase {
|
|||
private static int countSharedFormulas(HSSFSheet sheet) {
|
||||
Record[] records = RecordInspector.getRecords(sheet, 0);
|
||||
int count = 0;
|
||||
for (int i = 0; i < records.length; i++) {
|
||||
Record rec = records[i];
|
||||
for (Record rec : records) {
|
||||
if(rec instanceof SharedFormulaRecord) {
|
||||
count++;
|
||||
}
|
||||
|
|
|
@ -85,8 +85,8 @@ public final class TestSharedValueManager extends TestCase {
|
|||
} while (attempt++ < MAX_ATTEMPTS);
|
||||
|
||||
int count=0;
|
||||
for (int i = 0; i < records.length; i++) {
|
||||
if (records[i] instanceof SharedFormulaRecord) {
|
||||
for (Record record : records) {
|
||||
if (record instanceof SharedFormulaRecord) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@ -115,8 +115,8 @@ public final class TestSharedValueManager extends TestCase {
|
|||
} while (attempt++ < MAX_ATTEMPTS);
|
||||
|
||||
int count=0;
|
||||
for (int i = 0; i < records.length; i++) {
|
||||
if (records[i] instanceof SharedFormulaRecord) {
|
||||
for (Record record : records) {
|
||||
if (record instanceof SharedFormulaRecord) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,9 +327,8 @@ public class SanityChecker {
|
|||
void checkRecordOrder(List<? extends RecordBase> records, CheckRecord[] check)
|
||||
{
|
||||
int recordIdx = 0;
|
||||
for ( int checkIdx = 0; checkIdx < check.length; checkIdx++ )
|
||||
{
|
||||
recordIdx = check[checkIdx].match(records, recordIdx);
|
||||
for (CheckRecord element : check) {
|
||||
recordIdx = element.match(records, recordIdx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -251,18 +251,18 @@ public class TestHSSFDateUtil {
|
|||
public void identifyDateFormats() {
|
||||
// First up, try with a few built in date formats
|
||||
short[] builtins = new short[] { 0x0e, 0x0f, 0x10, 0x16, 0x2d, 0x2e };
|
||||
for(int i=0; i<builtins.length; i++) {
|
||||
String formatStr = HSSFDataFormat.getBuiltinFormat(builtins[i]);
|
||||
assertTrue( HSSFDateUtil.isInternalDateFormat(builtins[i]) );
|
||||
assertTrue( HSSFDateUtil.isADateFormat(builtins[i],formatStr) );
|
||||
for (short builtin : builtins) {
|
||||
String formatStr = HSSFDataFormat.getBuiltinFormat(builtin);
|
||||
assertTrue( HSSFDateUtil.isInternalDateFormat(builtin) );
|
||||
assertTrue( HSSFDateUtil.isADateFormat(builtin,formatStr) );
|
||||
}
|
||||
|
||||
// Now try a few built-in non date formats
|
||||
builtins = new short[] { 0x01, 0x02, 0x17, 0x1f, 0x30 };
|
||||
for(int i=0; i<builtins.length; i++) {
|
||||
String formatStr = HSSFDataFormat.getBuiltinFormat(builtins[i]);
|
||||
assertFalse( HSSFDateUtil.isInternalDateFormat(builtins[i]) );
|
||||
assertFalse( HSSFDateUtil.isADateFormat(builtins[i],formatStr) );
|
||||
for (short builtin : builtins) {
|
||||
String formatStr = HSSFDataFormat.getBuiltinFormat(builtin);
|
||||
assertFalse( HSSFDateUtil.isInternalDateFormat(builtin) );
|
||||
assertFalse( HSSFDateUtil.isADateFormat(builtin,formatStr) );
|
||||
}
|
||||
|
||||
// Now for some non-internal ones
|
||||
|
@ -296,10 +296,10 @@ public class TestHSSFDateUtil {
|
|||
"[BLACK]dddd/mm/yy",
|
||||
"[yeLLow]yyyy-mm-dd"
|
||||
};
|
||||
for(int i=0; i<formats.length; i++) {
|
||||
for (String format : formats) {
|
||||
assertTrue(
|
||||
formats[i] + " is a date format",
|
||||
HSSFDateUtil.isADateFormat(formatId, formats[i])
|
||||
format + " is a date format",
|
||||
HSSFDateUtil.isADateFormat(formatId, format)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -314,10 +314,10 @@ public class TestHSSFDateUtil {
|
|||
//support elapsed time [h],[m],[s]
|
||||
"[hh]", "[mm]", "[ss]", "[SS]", "[red][hh]"
|
||||
};
|
||||
for(int i=0; i<formats.length; i++) {
|
||||
for (String format : formats) {
|
||||
assertTrue(
|
||||
formats[i] + " is a datetime format",
|
||||
HSSFDateUtil.isADateFormat(formatId, formats[i])
|
||||
format + " is a datetime format",
|
||||
HSSFDateUtil.isADateFormat(formatId, format)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -330,10 +330,10 @@ public class TestHSSFDateUtil {
|
|||
"[ms]", "[Mh]",
|
||||
"", null
|
||||
};
|
||||
for(int i=0; i<formats.length; i++) {
|
||||
for (String format : formats) {
|
||||
assertFalse(
|
||||
formats[i] + " is not a date or datetime format",
|
||||
HSSFDateUtil.isADateFormat(formatId, formats[i])
|
||||
format + " is not a date or datetime format",
|
||||
HSSFDateUtil.isADateFormat(formatId, format)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,7 @@ public class TestHSSFDateUtil {
|
|||
formats = new String[] {
|
||||
"yyyy:mm:dd",
|
||||
};
|
||||
for(int i=0; i<formats.length; i++) {
|
||||
for (String format : formats) {
|
||||
// assertFalse( HSSFDateUtil.isADateFormat(formatId, formats[i]) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -235,8 +235,7 @@ public final class TestAreaReference extends TestCase {
|
|||
assertEquals(refA, arefs[0].formatAsString());
|
||||
assertEquals(refB, arefs[1].formatAsString());
|
||||
|
||||
for(int i=0; i<arefs.length; i++) {
|
||||
AreaReference ar = arefs[i];
|
||||
for (AreaReference ar : arefs) {
|
||||
confirmResolveCellRef(wb, ar.getFirstCell());
|
||||
confirmResolveCellRef(wb, ar.getLastCell());
|
||||
}
|
||||
|
|
|
@ -59,12 +59,10 @@ public final class TestPOIFSReaderRegistry extends TestCase {
|
|||
public void testEmptyRegistry() {
|
||||
POIFSReaderRegistry registry = new POIFSReaderRegistry();
|
||||
|
||||
for (int j = 0; j < paths.length; j++)
|
||||
{
|
||||
for (int k = 0; k < names.length; k++)
|
||||
{
|
||||
for (POIFSDocumentPath path : paths) {
|
||||
for (String name : names) {
|
||||
Iterator<POIFSReaderListener> listeners =
|
||||
registry.getListeners(paths[ j ], names[ k ]);
|
||||
registry.getListeners(path, name);
|
||||
|
||||
assertTrue(!listeners.hasNext());
|
||||
}
|
||||
|
@ -129,16 +127,13 @@ public final class TestPOIFSReaderRegistry extends TestCase {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < listeners.length; j++)
|
||||
{
|
||||
registry.registerListener(listeners[ j ]);
|
||||
for (POIFSReaderListener listener : listeners) {
|
||||
registry.registerListener(listener);
|
||||
}
|
||||
for (int k = 0; k < paths.length; k++)
|
||||
{
|
||||
for (int n = 0; n < names.length; n++)
|
||||
{
|
||||
for (POIFSDocumentPath path : paths) {
|
||||
for (String name : names) {
|
||||
Iterator<POIFSReaderListener> listeners =
|
||||
registry.getListeners(paths[ k ], names[ n ]);
|
||||
registry.getListeners(path, name);
|
||||
Set<POIFSReaderListener> registeredListeners =
|
||||
new HashSet<POIFSReaderListener>();
|
||||
|
||||
|
@ -148,10 +143,9 @@ public final class TestPOIFSReaderRegistry extends TestCase {
|
|||
}
|
||||
assertEquals(this.listeners.length,
|
||||
registeredListeners.size());
|
||||
for (int j = 0; j < this.listeners.length; j++)
|
||||
{
|
||||
for (POIFSReaderListener listener : this.listeners) {
|
||||
assertTrue(registeredListeners
|
||||
.contains(this.listeners[ j ]));
|
||||
.contains(listener));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,10 +142,10 @@ public final class TestPOIFSFileSystem extends TestCase {
|
|||
"ShortLastBlock.qwp", "ShortLastBlock.wps"
|
||||
};
|
||||
|
||||
for(int i=0; i<files.length; i++) {
|
||||
for (String file : files) {
|
||||
// Open the file up
|
||||
OPOIFSFileSystem fs = new OPOIFSFileSystem(
|
||||
_samples.openResourceAsStream(files[i])
|
||||
_samples.openResourceAsStream(file)
|
||||
);
|
||||
|
||||
// Write it into a temp output array
|
||||
|
|
|
@ -34,8 +34,8 @@ public final class RawDataUtil {
|
|||
public static byte[] decode(String[] hexDataLines) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(hexDataLines.length * 32 + 32);
|
||||
|
||||
for (int i = 0; i < hexDataLines.length; i++) {
|
||||
byte[] lineData = HexRead.readFromString(hexDataLines[i]);
|
||||
for (String hexDataLine : hexDataLines) {
|
||||
byte[] lineData = HexRead.readFromString(hexDataLine);
|
||||
baos.write(lineData, 0, lineData.length);
|
||||
}
|
||||
return baos.toByteArray();
|
||||
|
@ -73,8 +73,8 @@ public final class RawDataUtil {
|
|||
public static void confirmEqual(byte[] expected, String[] hexDataLines) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(hexDataLines.length * 32 + 32);
|
||||
|
||||
for (int i = 0; i < hexDataLines.length; i++) {
|
||||
byte[] lineData = HexRead.readFromString(hexDataLines[i]);
|
||||
for (String hexDataLine : hexDataLines) {
|
||||
byte[] lineData = HexRead.readFromString(hexDataLine);
|
||||
baos.write(lineData, 0, lineData.length);
|
||||
}
|
||||
if (!Arrays.equals(expected, baos.toByteArray())) {
|
||||
|
|
|
@ -96,9 +96,8 @@ public final class TestBATBlock extends TestCase {
|
|||
ByteArrayOutputStream stream = new ByteArrayOutputStream(512
|
||||
* blocks.length);
|
||||
|
||||
for (int j = 0; j < blocks.length; j++)
|
||||
{
|
||||
blocks[ j ].writeBlocks(stream);
|
||||
for (BATBlock block : blocks) {
|
||||
block.writeBlocks(stream);
|
||||
}
|
||||
byte[] actual = stream.toByteArray();
|
||||
|
||||
|
@ -178,9 +177,8 @@ public final class TestBATBlock extends TestCase {
|
|||
ByteArrayOutputStream stream = new ByteArrayOutputStream(512
|
||||
* blocks.length);
|
||||
|
||||
for (int j = 0; j < blocks.length; j++)
|
||||
{
|
||||
blocks[ j ].writeBlocks(stream);
|
||||
for (BATBlock block : blocks) {
|
||||
block.writeBlocks(stream);
|
||||
}
|
||||
byte[] actual = stream.toByteArray();
|
||||
|
||||
|
|
|
@ -43,10 +43,9 @@ public final class TestBlockAllocationTableWriter extends TestCase {
|
|||
};
|
||||
int expectedIndex = 0;
|
||||
|
||||
for (int j = 0; j < blockSizes.length; j++)
|
||||
{
|
||||
assertEquals(expectedIndex, table.allocateSpace(blockSizes[ j ]));
|
||||
expectedIndex += blockSizes[ j ];
|
||||
for (int blockSize : blockSizes) {
|
||||
assertEquals(expectedIndex, table.allocateSpace(blockSize));
|
||||
expectedIndex += blockSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,9 +72,8 @@ public final class TestSmallDocumentBlock extends TestCase {
|
|||
(_testdata_size + 63) / 64, results.length);
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
|
||||
for (int j = 0; j < results.length; j++)
|
||||
{
|
||||
results[ j ].writeBlocks(output);
|
||||
for (SmallDocumentBlock result : results) {
|
||||
result.writeBlocks(output);
|
||||
}
|
||||
byte[] output_array = output.toByteArray();
|
||||
|
||||
|
@ -114,9 +113,8 @@ public final class TestSmallDocumentBlock extends TestCase {
|
|||
assertEquals(5, blocks.length);
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
|
||||
for (int k = 0; k < blocks.length; k++)
|
||||
{
|
||||
blocks[ k ].writeBlocks(stream);
|
||||
for (SmallDocumentBlock block : blocks) {
|
||||
block.writeBlocks(stream);
|
||||
}
|
||||
stream.close();
|
||||
byte[] output = stream.toByteArray();
|
||||
|
|
|
@ -701,8 +701,8 @@ public class TestEvaluationCache extends TestCase {
|
|||
}
|
||||
|
||||
private static void debugPrint(PrintStream ps, String[] log) {
|
||||
for (int i = 0; i < log.length; i++) {
|
||||
ps.println('"' + log[i] + "\",");
|
||||
for (String element : log) {
|
||||
ps.println('"' + element + "\",");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -219,8 +219,8 @@ public final class ExcelFileFormatDocFunctionExtractor {
|
|||
Arrays.sort(keys);
|
||||
|
||||
_ps.println("# " + headingText);
|
||||
for (int i = 0; i < keys.length; i++) {
|
||||
FunctionData fd = _allFunctionsByIndex.get(keys[i]);
|
||||
for (Integer key : keys) {
|
||||
FunctionData fd = _allFunctionsByIndex.get(key);
|
||||
_ps.println(fd.formatAsDataLine());
|
||||
}
|
||||
}
|
||||
|
@ -554,9 +554,9 @@ public final class ExcelFileFormatDocFunctionExtractor {
|
|||
"See the License for the specific language governing permissions and",
|
||||
"limitations under the License.",
|
||||
};
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
for (String line : lines) {
|
||||
ps.print("# ");
|
||||
ps.println(lines[i]);
|
||||
ps.println(line);
|
||||
}
|
||||
ps.println();
|
||||
}
|
||||
|
|
|
@ -129,9 +129,7 @@ public final class TestAreaPtg extends TestCase {
|
|||
int letUsShiftColumn1By1Column=1;
|
||||
HSSFWorkbook wb = null;
|
||||
Ptg[] ptgs = HSSFFormulaParser.parse(formula, wb);
|
||||
for(int i=0; i<ptgs.length; i++)
|
||||
{
|
||||
Ptg ptg = ptgs[i];
|
||||
for (Ptg ptg : ptgs) {
|
||||
if (ptg instanceof AreaPtg )
|
||||
{
|
||||
AreaPtg aptg = (AreaPtg)ptg;
|
||||
|
|
|
@ -133,8 +133,7 @@ public class NumberComparingSpreadsheetGenerator {
|
|||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
SheetWriter sw = new SheetWriter(wb);
|
||||
ComparisonExample[] ces = NumberComparisonExamples.getComparisonExamples();
|
||||
for (int i = 0; i < ces.length; i++) {
|
||||
ComparisonExample ce = ces[i];
|
||||
for (ComparisonExample ce : ces) {
|
||||
sw.addTestRow(ce.getA(), ce.getB(), ce.getExpectedResult());
|
||||
}
|
||||
|
||||
|
|
|
@ -148,8 +148,7 @@ public class NumberRenderingSpreadsheetGenerator {
|
|||
SheetWriter sw = new SheetWriter(wb);
|
||||
|
||||
ExampleConversion[] exampleValues = NumberToTextConversionExamples.getExampleConversions();
|
||||
for (int i = 0; i < exampleValues.length; i++) {
|
||||
ExampleConversion example = exampleValues[i];
|
||||
for (ExampleConversion example : exampleValues) {
|
||||
sw.addTestRow(example.getRawDoubleBits(), example.getExcelRendering());
|
||||
}
|
||||
|
||||
|
@ -178,8 +177,7 @@ public class NumberRenderingSpreadsheetGenerator {
|
|||
public static void writeJavaDoc() {
|
||||
|
||||
ExampleConversion[] exampleConversions = NumberToTextConversionExamples.getExampleConversions();
|
||||
for (int i = 0; i < exampleConversions.length; i++) {
|
||||
ExampleConversion ec = exampleConversions[i];
|
||||
for (ExampleConversion ec : exampleConversions) {
|
||||
String line = " * <tr><td>"
|
||||
+ formatLongAsHex(ec.getRawDoubleBits())
|
||||
+ "</td><td>" + Double.toString(ec.getDoubleValue())
|
||||
|
|
Loading…
Reference in New Issue