poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fannin...@apache.org
Subject svn commit: r1808703 - in /poi/trunk/src: examples/src/org/apache/poi/ss/examples/html/ java/org/apache/poi/ss/formula/ java/org/apache/poi/ss/util/ ooxml/java/org/apache/poi/xssf/extractor/ ooxml/java/org/apache/poi/xssf/streaming/ ooxml/testcases/org...
Date Mon, 18 Sep 2017 13:38:07 GMT
Author: fanningpj
Date: Mon Sep 18 13:38:07 2017
New Revision: 1808703

URL: http://svn.apache.org/viewvc?rev=1808703&view=rev
Log:
update getCellType to return CellType enum instead of int

Modified:
    poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java
    poi/trunk/src/java/org/apache/poi/ss/formula/DataValidationEvaluator.java
    poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
    poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java

Modified: poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java?rev=1808703&r1=1808702&r2=1808703&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java Mon Sep 18 13:38:07
2017
@@ -340,9 +340,9 @@ public class ToHtml {
     }
 
     private static CellType ultimateCellType(Cell c) {
-        CellType type = c.getCellTypeEnum();
+        CellType type = c.getCellType();
         if (type == CellType.FORMULA) {
-            type = c.getCachedFormulaResultTypeEnum();
+            type = c.getCachedFormulaResultType();
         }
         return type;
     }

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/DataValidationEvaluator.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/DataValidationEvaluator.java?rev=1808703&r1=1808702&r2=1808703&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/DataValidationEvaluator.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/DataValidationEvaluator.java Mon Sep 18 13:38:07
2017
@@ -255,10 +255,10 @@ public class DataValidationEvaluator {
     * @return true if the cell or cached cell formula result type match the given type
     */
     public static boolean isType(Cell cell, CellType type) {
-        final CellType cellType = cell.getCellTypeEnum();
+        final CellType cellType = cell.getCellType();
         return cellType == type 
               || (cellType == CellType.FORMULA 
-                  && cell.getCachedFormulaResultTypeEnum() == type
+                  && cell.getCachedFormulaResultType() == type
                  );
     }
    

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java?rev=1808703&r1=1808702&r2=1808703&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java Mon Sep 18 13:38:07
2017
@@ -250,7 +250,7 @@ public final class WorkbookEvaluator {
         // avoid tracking dependencies to cells that have constant definition
         boolean shouldCellDependencyBeRecorded = _stabilityClassifier == null ? true
                     : !_stabilityClassifier.isCellFinal(sheetIndex, rowIndex, columnIndex);
-        if (srcCell == null || srcCell.getCellTypeEnum() != CellType.FORMULA) {
+        if (srcCell == null || srcCell.getCellType() != CellType.FORMULA) {
             ValueEval result = getValueFromNonFormulaCell(srcCell);
             if (shouldCellDependencyBeRecorded) {
                 tracker.acceptPlainValueDependency(_workbookIx, sheetIndex, rowIndex, columnIndex,
result);
@@ -288,7 +288,7 @@ public final class WorkbookEvaluator {
              } catch (RuntimeException re) {
                  if (re.getCause() instanceof WorkbookNotFoundException && _ignoreMissingWorkbooks)
{
                      logInfo(re.getCause().getMessage() + " - Continuing with cached value!");
-                     switch(srcCell.getCachedFormulaResultTypeEnum()) {
+                     switch(srcCell.getCachedFormulaResultType()) {
                          case NUMERIC:
                              result = new NumberEval(srcCell.getNumericCellValue());
                              break;
@@ -306,7 +306,7 @@ public final class WorkbookEvaluator {
                             break;
                          case FORMULA:
                         default:
-                            throw new RuntimeException("Unexpected cell type '" + srcCell.getCellTypeEnum()+"'
found!");
+                            throw new RuntimeException("Unexpected cell type '" + srcCell.getCellType()+"'
found!");
                      }
                  } else {
                      throw re;
@@ -359,7 +359,7 @@ public final class WorkbookEvaluator {
         if (cell == null) {
             return BlankEval.instance;
         }
-        CellType cellType = cell.getCellTypeEnum();
+        CellType cellType = cell.getCellType();
         switch (cellType) {
             case NUMERIC:
                 return new NumberEval(cell.getNumericCellValue());

Modified: poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java?rev=1808703&r1=1808702&r2=1808703&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java Mon Sep 18 13:38:07 2017
@@ -138,11 +138,11 @@ public class SheetUtil {
         }
 
         CellStyle style = cell.getCellStyle();
-        CellType cellType = cell.getCellTypeEnum();
+        CellType cellType = cell.getCellType();
 
         // for formula cells we compute the cell width for the cached formula result
         if (cellType == CellType.FORMULA)
-            cellType = cell.getCachedFormulaResultTypeEnum();
+            cellType = cell.getCachedFormulaResultType();
 
         Font font = wb.getFontAt(style.getFontIndex());
 

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java?rev=1808703&r1=1808702&r2=1808703&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java Mon Sep 18
13:38:07 2017
@@ -269,13 +269,13 @@ public class XSSFExportToXml implements
     private void mapCellOnNode(XSSFCell cell, Node node) {
 
         String value ="";
-        switch (cell.getCellTypeEnum()) {
+        switch (cell.getCellType()) {
 
         case STRING: value = cell.getStringCellValue(); break;
         case BOOLEAN: value += cell.getBooleanCellValue(); break;
         case ERROR: value = cell.getErrorCellString();  break;
         case FORMULA:
-           if (cell.getCachedFormulaResultTypeEnum() == CellType.STRING) {
+           if (cell.getCachedFormulaResultType() == CellType.STRING) {
                value = cell.getStringCellValue();
            } else {
                if (DateUtil.isCellDateFormatted(cell)) {

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java?rev=1808703&r1=1808702&r2=1808703&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java Mon Sep 18
13:38:07 2017
@@ -262,7 +262,7 @@ public class SheetDataWriter implements
                 _out.write("><f>");
                 outputQuotedString(cell.getCellFormula());
                 _out.write("</f>");
-                switch (cell.getCachedFormulaResultTypeEnum()) {
+                switch (cell.getCachedFormulaResultType()) {
                     case NUMERIC:
                         double nval = cell.getNumericCellValue();
                         if (!Double.isNaN(nval)) {

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java?rev=1808703&r1=1808702&r2=1808703&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java Mon Sep
18 13:38:07 2017
@@ -303,10 +303,10 @@ public final class TestXSSFBugs extends
                 Sheet s = wb.getSheetAt(i);
                 for (Row r : s) {
                     for (Cell c : r) {
-                        if (c.getCellTypeEnum() == CellType.FORMULA) {
+                        if (c.getCellType() == CellType.FORMULA) {
                             CellValue cv = eval.evaluate(c);
 
-                            if (cv.getCellTypeEnum() == CellType.NUMERIC) {
+                            if (cv.getCellType() == CellType.NUMERIC) {
                                 // assert that the calculated value agrees with
                                 // the cached formula result calculated by Excel
                                 String formula = c.getCellFormula();
@@ -427,7 +427,7 @@ public final class TestXSSFBugs extends
 
         cell = sheet.getRow(0).getCell(0);
         assertEquals("#REF!*#REF!", cell.getCellFormula());
-        assertEquals(CellType.ERROR, evaluator.evaluateInCell(cell).getCellTypeEnum());
+        assertEquals(CellType.ERROR, evaluator.evaluateInCell(cell).getCellType());
         assertEquals("#REF!", FormulaError.forInt(cell.getErrorCellValue()).getString());
 
         Name nm1 = wb.getName("sale_1");
@@ -439,7 +439,7 @@ public final class TestXSSFBugs extends
 
         cell = sheet.getRow(1).getCell(0);
         assertEquals("sale_1*sale_2", cell.getCellFormula());
-        assertEquals(CellType.ERROR, evaluator.evaluateInCell(cell).getCellTypeEnum());
+        assertEquals(CellType.ERROR, evaluator.evaluateInCell(cell).getCellType());
         assertEquals("#REF!", FormulaError.forInt(cell.getErrorCellValue()).getString());
 
         wb.close();
@@ -645,7 +645,7 @@ public final class TestXSSFBugs extends
         Sheet sheet = wb.getSheetAt(0);
         for (Row row : sheet) {
             for (Cell cell : row) {
-                if (cell.getCellTypeEnum() == CellType.FORMULA) {
+                if (cell.getCellType() == CellType.FORMULA) {
                     formulaEvaluator.evaluateInCell(cell); // caused NPE on some cells
                 }
             }
@@ -1696,7 +1696,7 @@ public final class TestXSSFBugs extends
 
         // Get wrong cell by row 8 & column 7
         Cell cell = sheet.getRow(8).getCell(7);
-        assertEquals(CellType.NUMERIC, cell.getCellTypeEnum());
+        assertEquals(CellType.NUMERIC, cell.getCellType());
 
         // Check the value - will be zero as it is <c><v/></c>
         assertEquals(0.0, cell.getNumericCellValue(), 0.001);
@@ -2181,11 +2181,11 @@ public final class TestXSSFBugs extends
 
         Sheet sheet = wb.getSheet("Sheet1");
         Cell cell = sheet.getRow(5).getCell(4);
-        assertEquals(CellType.FORMULA, cell.getCellTypeEnum());
+        assertEquals(CellType.FORMULA, cell.getCellType());
         assertEquals("E4+E5", cell.getCellFormula());
 
         CellValue value = evaluator.evaluate(cell);
-        assertEquals(CellType.ERROR, value.getCellTypeEnum());
+        assertEquals(CellType.ERROR, value.getCellType());
         assertEquals(-60, value.getErrorValue());
         assertEquals("~CIRCULAR~REF~", FormulaError.forInt(value.getErrorValue()).getString());
         assertEquals("CIRCULAR_REF", FormulaError.forInt(value.getErrorValue()).toString());
@@ -2535,7 +2535,7 @@ public final class TestXSSFBugs extends
                 if (cell == null) {
                     cell = row.createCell(cellnum);
                 } else {
-                    if (cell.getCellTypeEnum() == CellType.FORMULA) {
+                    if (cell.getCellType() == CellType.FORMULA) {
                         cell.setCellFormula(null);
                         cell.getCellStyle().setDataFormat((short) 0);
                     }
@@ -2601,12 +2601,12 @@ public final class TestXSSFBugs extends
     }
 
     private void assertFormula(Workbook wb, Cell intF, String expectedFormula, String expectedResultOrNull)
{
-        assertEquals(CellType.FORMULA, intF.getCellTypeEnum());
+        assertEquals(CellType.FORMULA, intF.getCellType());
         if (null == expectedResultOrNull) {
-            assertEquals(CellType.ERROR, intF.getCachedFormulaResultTypeEnum());
+            assertEquals(CellType.ERROR, intF.getCachedFormulaResultType());
             expectedResultOrNull = "#VALUE!";
         } else {
-            assertEquals(CellType.NUMERIC, intF.getCachedFormulaResultTypeEnum());
+            assertEquals(CellType.NUMERIC, intF.getCachedFormulaResultType());
         }
 
         assertEquals(expectedFormula, intF.getCellFormula());
@@ -2647,7 +2647,7 @@ public final class TestXSSFBugs extends
         Sheet sheet = wb.getSheet("Sheet1");
         for (Row aRow : sheet) {
             Cell cell = aRow.getCell(1);
-            if (cell.getCellTypeEnum() == CellType.FORMULA) {
+            if (cell.getCellType() == CellType.FORMULA) {
                 String formula = cell.getCellFormula();
                 //System.out.println("formula: " + formula);
                 assertNotNull(formula);
@@ -2934,14 +2934,14 @@ public final class TestXSSFBugs extends
         row = worksheet.getRow(2);
         cell = row.getCell(1);
 
-        assertEquals(CellType.BLANK, cell.getCellTypeEnum());
+        assertEquals(CellType.BLANK, cell.getCellType());
         assertEquals(CellType._NONE, evaluator.evaluateFormulaCellEnum(cell));
 
         // A3
         row = worksheet.getRow(2);
         cell = row.getCell(0);
 
-        assertEquals(CellType.FORMULA, cell.getCellTypeEnum());
+        assertEquals(CellType.FORMULA, cell.getCellType());
         assertEquals("IF(ISBLANK(B3),\"\",B3)", cell.getCellFormula());
         assertEquals(CellType.STRING, evaluator.evaluateFormulaCellEnum(cell));
         CellValue value = evaluator.evaluate(cell);
@@ -2951,7 +2951,7 @@ public final class TestXSSFBugs extends
         row = worksheet.getRow(4);
         cell = row.getCell(0);
 
-        assertEquals(CellType.FORMULA, cell.getCellTypeEnum());
+        assertEquals(CellType.FORMULA, cell.getCellType());
         assertEquals("COUNTBLANK(A1:A4)", cell.getCellFormula());
         assertEquals(CellType.NUMERIC, evaluator.evaluateFormulaCellEnum(cell));
         value = evaluator.evaluate(cell);
@@ -3177,7 +3177,7 @@ public final class TestXSSFBugs extends
 
         Row r = s.getRow(3);
         Cell c = r.getCell(0);
-        assertEquals(CellType.FORMULA, c.getCellTypeEnum());
+        assertEquals(CellType.FORMULA, c.getCellType());
         System.out.println(c.getCellFormula());
         eval.setDebugEvaluationOutputForNextEval(true);
         CellValue cv = eval.evaluate(c);

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java?rev=1808703&r1=1808702&r2=1808703&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java
(original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java
Mon Sep 18 13:38:07 2017
@@ -592,9 +592,9 @@ public final class TestXSSFFormulaEvalua
 
         wb.getCreationHelper().createFormulaEvaluator().evaluateAll();
 
-        assertEquals(CellType.ERROR, getCell(sheet, 0,0).getCachedFormulaResultTypeEnum());
+        assertEquals(CellType.ERROR, getCell(sheet, 0,0).getCachedFormulaResultType());
         assertEquals(FormulaError.VALUE.getCode(), getCell(sheet, 0,0).getErrorCellValue());
-        assertEquals(CellType.ERROR, getCell(sheet, 0,1).getCachedFormulaResultTypeEnum());
+        assertEquals(CellType.ERROR, getCell(sheet, 0,1).getCachedFormulaResultType());
         assertEquals(FormulaError.VALUE.getCode(), getCell(sheet, 0,1).getErrorCellValue());
         
         wb.close();
@@ -613,11 +613,11 @@ public final class TestXSSFFormulaEvalua
 
         wb.getCreationHelper().createFormulaEvaluator().evaluateAll();
 
-        assertEquals(CellType.ERROR, getCell(sheet, 0, 0).getCachedFormulaResultTypeEnum());
+        assertEquals(CellType.ERROR, getCell(sheet, 0, 0).getCachedFormulaResultType());
         assertEquals(FormulaError.VALUE.getCode(), getCell(sheet, 0, 0).getErrorCellValue());
-        assertEquals(CellType.ERROR, getCell(sheet, 1, 0).getCachedFormulaResultTypeEnum());
+        assertEquals(CellType.ERROR, getCell(sheet, 1, 0).getCachedFormulaResultType());
         assertEquals(FormulaError.VALUE.getCode(), getCell(sheet, 1, 0).getErrorCellValue());
-        assertEquals(CellType.ERROR, getCell(sheet, 0, 3).getCachedFormulaResultTypeEnum());
+        assertEquals(CellType.ERROR, getCell(sheet, 0, 3).getCachedFormulaResultType());
         assertEquals(FormulaError.VALUE.getCode(), getCell(sheet, 0, 3).getErrorCellValue());
         
         wb.close();

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java?rev=1808703&r1=1808702&r2=1808703&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java Mon Sep 18 13:38:07
2017
@@ -417,7 +417,7 @@ public final class TestHSSFCell extends
         assertEquals(wb.getWorkbook(), cell.getBoundWorkbook());
 
         try {
-            cell.getCachedFormulaResultTypeEnum();
+            cell.getCachedFormulaResultType();
             fail("Should catch exception");
         } catch (IllegalStateException e) {
             // expected here



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message