Fixing compiler warnings - unboxing parameter to overloaded method, unnecessary typecast
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@805900 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a7e9db045f
commit
ee3718b5a7
@ -67,7 +67,7 @@ public class FontDetails
|
||||
*/
|
||||
public int getCharWidth( char c )
|
||||
{
|
||||
Integer widthInteger = (Integer)(charWidths.get(new Character(c)));
|
||||
Integer widthInteger = charWidths.get(new Character(c));
|
||||
if (widthInteger == null && c != 'W') {
|
||||
return getCharWidth('W');
|
||||
}
|
||||
|
@ -39,11 +39,11 @@ public final class TestXSSFFormulaEvaluation extends TestCase {
|
||||
|
||||
Cell c1 = r.createCell(0);
|
||||
c1.setCellFormula("1+5");
|
||||
assertEquals(0.0, c1.getNumericCellValue() );
|
||||
assertEquals(0.0, c1.getNumericCellValue(), 0.0);
|
||||
|
||||
Cell c2 = r.createCell(1);
|
||||
c2.setCellFormula("10/2");
|
||||
assertEquals(0.0, c2.getNumericCellValue() );
|
||||
assertEquals(0.0, c2.getNumericCellValue(), 0.0);
|
||||
|
||||
FormulaEvaluator fe = new XSSFFormulaEvaluator(wb);
|
||||
|
||||
@ -67,19 +67,19 @@ public final class TestXSSFFormulaEvaluation extends TestCase {
|
||||
|
||||
Cell c1 = r.createCell(0);
|
||||
c1.setCellFormula("SUM(A1:B1)");
|
||||
assertEquals(0.0, c1.getNumericCellValue() );
|
||||
assertEquals(0.0, c1.getNumericCellValue(), 0.0);
|
||||
|
||||
Cell c2 = r.createCell(1);
|
||||
c2.setCellFormula("SUM(A1:E1)");
|
||||
assertEquals(0.0, c2.getNumericCellValue() );
|
||||
assertEquals(0.0, c2.getNumericCellValue(), 0.0);
|
||||
|
||||
Cell c3 = r.createCell(2);
|
||||
c3.setCellFormula("COUNT(A1:A1)");
|
||||
assertEquals(0.0, c3.getNumericCellValue() );
|
||||
assertEquals(0.0, c3.getNumericCellValue(), 0.0);
|
||||
|
||||
Cell c4 = r.createCell(3);
|
||||
c4.setCellFormula("COUNTA(A1:E1)");
|
||||
assertEquals(0.0, c4.getNumericCellValue() );
|
||||
assertEquals(0.0, c4.getNumericCellValue(), 0.0);
|
||||
|
||||
|
||||
// Evaluate and test
|
||||
@ -150,11 +150,10 @@ public final class TestXSSFFormulaEvaluation extends TestCase {
|
||||
row.createCell(2).setCellFormula("sales_1*3");
|
||||
|
||||
XSSFFormulaEvaluator evaluator = new XSSFFormulaEvaluator(wb);
|
||||
assertEquals(3.0, evaluator.evaluate(sh1.getRow(0).getCell(1)).getNumberValue());
|
||||
assertEquals(6.0, evaluator.evaluate(sh1.getRow(0).getCell(2)).getNumberValue());
|
||||
assertEquals(3.0, evaluator.evaluate(sh1.getRow(0).getCell(1)).getNumberValue(), 0.0);
|
||||
assertEquals(6.0, evaluator.evaluate(sh1.getRow(0).getCell(2)).getNumberValue(), 0.0);
|
||||
|
||||
assertEquals(5.0, evaluator.evaluate(sh2.getRow(0).getCell(1)).getNumberValue());
|
||||
assertEquals(15.0, evaluator.evaluate(sh2.getRow(0).getCell(2)).getNumberValue());
|
||||
assertEquals(5.0, evaluator.evaluate(sh2.getRow(0).getCell(1)).getNumberValue(), 0.0);
|
||||
assertEquals(15.0, evaluator.evaluate(sh2.getRow(0).getCell(2)).getNumberValue(), 0.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -61,9 +61,9 @@ public final class TestColumnHelper extends TestCase {
|
||||
count = countColumns(worksheet);
|
||||
assertEquals(16375, count);
|
||||
// Remember - POI column 0 == OOXML column 1
|
||||
assertEquals((double) 88, helper.getColumn(0, false).getWidth());
|
||||
assertEquals(88.0, helper.getColumn(0, false).getWidth(), 0.0);
|
||||
assertTrue(helper.getColumn(0, false).getHidden());
|
||||
assertEquals((double)0, helper.getColumn(1, false).getWidth());
|
||||
assertEquals(0.0, helper.getColumn(1, false).getWidth(), 0.0);
|
||||
assertFalse(helper.getColumn(1, false).getHidden());
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ public final class TestColumnHelper extends TestCase {
|
||||
assertEquals(2, newCol.getMin());
|
||||
assertEquals(8, newCol.getMax());
|
||||
assertTrue(newCol.getHidden());
|
||||
assertEquals(13.4, newCol.getWidth());
|
||||
assertEquals(13.4, newCol.getWidth(), 0.0);
|
||||
}
|
||||
|
||||
public void testAddCleanColIntoCols() {
|
||||
@ -213,8 +213,8 @@ public final class TestColumnHelper extends TestCase {
|
||||
ColumnHelper helper = new ColumnHelper(worksheet);
|
||||
assertNotNull(helper.getColumn(0, false));
|
||||
assertNotNull(helper.getColumn(1, false));
|
||||
assertEquals((double) 88, helper.getColumn(0, false).getWidth());
|
||||
assertEquals((double) 0, helper.getColumn(1, false).getWidth());
|
||||
assertEquals(88.0, helper.getColumn(0, false).getWidth(), 0.0);
|
||||
assertEquals(0.0, helper.getColumn(1, false).getWidth(), 0.0);
|
||||
assertTrue(helper.getColumn(0, false).getHidden());
|
||||
assertFalse(helper.getColumn(1, false).getHidden());
|
||||
assertNull(helper.getColumn(99, false));
|
||||
@ -226,12 +226,12 @@ public final class TestColumnHelper extends TestCase {
|
||||
col.setWidth(12);
|
||||
col.setHidden(true);
|
||||
CTCol newCol = CTCol.Factory.newInstance();
|
||||
assertEquals((double) 0, newCol.getWidth());
|
||||
assertEquals(0.0, newCol.getWidth(), 0.0);
|
||||
assertFalse(newCol.getHidden());
|
||||
ColumnHelper helper = new ColumnHelper(CTWorksheet.Factory
|
||||
.newInstance());
|
||||
helper.setColumnAttributes(col, newCol);
|
||||
assertEquals((double) 12, newCol.getWidth());
|
||||
assertEquals(12.0, newCol.getWidth(), 0.0);
|
||||
assertTrue(newCol.getHidden());
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public abstract class BaseTestDataFormat extends TestCase {
|
||||
|
||||
Map<Integer, String> formats = BuiltinFormats.getBuiltinFormats();
|
||||
for (int idx : formats.keySet()) {
|
||||
String fmt = formats.get(idx);
|
||||
String fmt = formats.get(new Integer(idx));
|
||||
assertEquals(idx, df.getFormat(fmt));
|
||||
}
|
||||
|
||||
|
@ -287,18 +287,18 @@ public abstract class BaseTestRow extends TestCase {
|
||||
|
||||
sheet.setDefaultRowHeightInPoints(20);
|
||||
row1.setHeight((short)-1); //reset the row height
|
||||
assertEquals(20.0f, row1.getHeightInPoints());
|
||||
assertEquals(20.0f, row1.getHeightInPoints(), 0F);
|
||||
assertEquals(20*20, row1.getHeight());
|
||||
|
||||
Row row2 = sheet.createRow(1);
|
||||
row2.setHeight((short)310);
|
||||
assertEquals(310, row2.getHeight());
|
||||
assertEquals((float)310/20, row2.getHeightInPoints());
|
||||
assertEquals(310F/20, row2.getHeightInPoints(), 0F);
|
||||
|
||||
Row row3 = sheet.createRow(2);
|
||||
row3.setHeightInPoints(25.5f);
|
||||
assertEquals((short)(25.5f*20), row3.getHeight());
|
||||
assertEquals(25.5f, row3.getHeightInPoints());
|
||||
assertEquals(25.5f, row3.getHeightInPoints(), 0F);
|
||||
|
||||
Row row4 = sheet.createRow(3);
|
||||
assertFalse(row4.getZeroHeight());
|
||||
@ -312,14 +312,14 @@ public abstract class BaseTestRow extends TestCase {
|
||||
row2 = sheet.getRow(1);
|
||||
row3 = sheet.getRow(2);
|
||||
row4 = sheet.getRow(3);
|
||||
assertEquals(20.0f, row1.getHeightInPoints());
|
||||
assertEquals(20.0f, row1.getHeightInPoints(), 0F);
|
||||
assertEquals(20*20, row1.getHeight());
|
||||
|
||||
assertEquals(310, row2.getHeight());
|
||||
assertEquals((float)310/20, row2.getHeightInPoints());
|
||||
assertEquals(310F/20, row2.getHeightInPoints(), 0F);
|
||||
|
||||
assertEquals((short)(25.5f*20), row3.getHeight());
|
||||
assertEquals(25.5f, row3.getHeightInPoints());
|
||||
assertEquals(25.5f, row3.getHeightInPoints(), 0F);
|
||||
|
||||
assertFalse(row1.getZeroHeight());
|
||||
assertFalse(row2.getZeroHeight());
|
||||
@ -385,6 +385,4 @@ public abstract class BaseTestRow extends TestCase {
|
||||
assertTrue(cell2 == it.next());
|
||||
assertEquals(Cell.CELL_TYPE_STRING, cell5.getCellType());
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user