poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r703096 - in /poi/branches/ooxml: ./ src/java/org/apache/poi/hssf/usermodel/ src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/ src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/ src/ooxml/java/org/apache/poi/xssf/usermodel/ src/t...
Date Thu, 09 Oct 2008 08:03:44 GMT
Author: josh
Date: Thu Oct  9 01:03:43 2008
New Revision: 703096

URL: http://svn.apache.org/viewvc?rev=703096&view=rev
Log:
Merged revisions 703092 via svnmerge from 
https://svn.apache.org/repos/asf/poi/trunk

........
  r703092 | josh | 2008-10-09 00:44:37 -0700 (Thu, 09 Oct 2008) | 1 line
  
  converted short HSSFCell.getCellNum to int getColumnIndex
........

Modified:
    poi/branches/ooxml/   (props changed)
    poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java
    poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java
    poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Cell.java
    poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestIndexFunctionFromSpreadsheet.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestLookupFunctionsFromSpreadsheet.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFComment.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java

Propchange: poi/branches/ooxml/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct  9 01:03:43 2008
@@ -1 +1 @@
-/poi/trunk:693591-694881,695264-695420,695621,695649-703063
+/poi/trunk:693591-694881,695264-695420,695621,695649-703092

Propchange: poi/branches/ooxml/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Oct  9 01:03:43 2008
@@ -1 +1 @@
-/poi/trunk:1-638784,638786-639486,639488-639601,639603-640056,640058-642562,642564-642566,642568-642574,642576-642736,642739-650914,650916-703063
+/poi/trunk:1-638784,638786-639486,639488-639601,639603-640056,640058-642562,642564-642566,642568-642574,642576-642736,642739-650914,650916-703092

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java?rev=703096&r1=703095&r2=703096&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java Thu Oct  9 01:03:43
2008
@@ -232,7 +232,7 @@
     /**
      * Set the cell's number within the row (0 based).
      * @param num  short the cell number
-     * @deprecated Doesn't update the row's idea of what cell this is, use {@link HSSFRow#moveCell(HSSFCell,
short)} instead
+     * @deprecated (Jan 2008) Doesn't update the row's idea of what cell this is, use {@link
HSSFRow#moveCell(HSSFCell, short)} instead
      */
     public void setCellNum(short num)
     {
@@ -250,13 +250,14 @@
     }
 
     /**
-     *  get the cell's number within the row
-     * @return short reperesenting the column number (logical!)
+     * @deprecated (Oct 2008) use {@link #getColumnIndex()}
      */
-
-    public short getCellNum()
-    {
-        return record.getColumn();
+    public short getCellNum() {
+        return (short) getColumnIndex();
+    }
+    
+    public int getColumnIndex() {
+    	return record.getColumn() & 0xFFFF;
     }
 
     /**

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java?rev=703096&r1=703095&r2=703096&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java Thu
Oct  9 01:03:43 2008
@@ -55,7 +55,7 @@
 		return _cell.getCellType();
 	}
 	public int getColumnIndex() {
-		return _cell.getCellNum();
+		return _cell.getColumnIndex();
 	}
 	public int getErrorCellValue() {
 		return _cell.getErrorCellValue();

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java?rev=703096&r1=703095&r2=703096&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java Thu Oct  9 01:03:43
2008
@@ -155,7 +155,7 @@
     }
     private void removeCell(HSSFCell cell, boolean alsoRemoveRecords) {
         
-        short column=cell.getCellNum();
+        int column=cell.getColumnIndex();
         if(column < 0) {
             throw new RuntimeException("Negative cell indexes not allowed");
         }
@@ -169,10 +169,10 @@
             sheet.getSheet().removeValueRecord(getRowNum(), cval);
         }
         
-        if (cell.getCellNum()+1 == row.getLastCol()) {
+        if (cell.getColumnIndex()+1 == row.getLastCol()) {
             row.setLastCol((short) (findLastCell(row.getLastCol())+1));
         }
-        if (cell.getCellNum() == row.getFirstCol()) {
+        if (cell.getColumnIndex() == row.getFirstCol()) {
             row.setFirstCol(findFirstCell(row.getFirstCol()));
         }
     }
@@ -252,7 +252,7 @@
         }
         
         // Check it's one of ours
-        if(! cells[cell.getCellNum()].equals(cell)) {
+        if(! cells[cell.getColumnIndex()].equals(cell)) {
             throw new IllegalArgumentException("Asked to move a cell, but it didn't belong
to our row");
         }
         
@@ -268,7 +268,7 @@
      */
     private void addCell(HSSFCell cell) {
 
-        short column=cell.getCellNum();
+        int column=cell.getColumnIndex();
         // re-allocate cells array as required.
         if(column>=cells.length) {
             HSSFCell[] oldCells=cells;
@@ -283,7 +283,7 @@
         
         // fix up firstCol and lastCol indexes
         if (row.getFirstCol() == -1 || column < row.getFirstCol()) {
-            row.setFirstCol(column);
+            row.setFirstCol((short)column);
         }
         
         if (row.getLastCol() == -1 || column >= row.getLastCol()) {

Modified: poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java?rev=703096&r1=703095&r2=703096&view=diff
==============================================================================
--- poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java (original)
+++ poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java Thu
Oct  9 01:03:43 2008
@@ -77,7 +77,15 @@
 
 
     int getCellType();
+    /**
+     * @deprecated (Oct 2008) use {@link #getColumnIndex()}
+     */
     short getCellNum();
+    
+    /**
+     * @return the cell's column index (zero based)
+     */
+    int getColumnIndex();
     int getRowIndex();
 
     String getCellFormula();

Modified: poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Cell.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Cell.java?rev=703096&r1=703095&r2=703096&view=diff
==============================================================================
--- poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Cell.java (original)
+++ poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Cell.java Thu
Oct  9 01:03:43 2008
@@ -98,11 +98,14 @@
     void setCellNum(short num);
 
     /**
-     *  get the cell's number within the row
-     * @return short reperesenting the column number (logical!)
+     * @deprecated (Oct 2008) use {@link #getColumnIndex()}
      */
-
     short getCellNum();
+    
+    /**
+     * @return the cell's column index (zero based)
+     */
+    int getColumnIndex();
 
     int getRowIndex();
 

Modified: poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java?rev=703096&r1=703095&r2=703096&view=diff
==============================================================================
--- poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java (original)
+++ poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java Thu Oct
 9 01:03:43 2008
@@ -107,8 +107,14 @@
         return this.cell.getF().getStringValue();
     }
 
+    /**
+     * @deprecated use {@link #getColumnIndex()}
+     */
     public short getCellNum() {
-        return (short)this.cellNum;
+        return (short)getColumnIndex();
+    }
+    public int getColumnIndex() {
+    	return this.cellNum;
     }
 	public int getRowIndex() {
 		return row.getRowNum();

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestIndexFunctionFromSpreadsheet.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestIndexFunctionFromSpreadsheet.java?rev=703096&r1=703095&r2=703096&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestIndexFunctionFromSpreadsheet.java
(original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestIndexFunctionFromSpreadsheet.java
Thu Oct  9 01:03:43 2008
@@ -205,10 +205,10 @@
 	}
 
 
-	private static String formatTestCaseDetails(String sheetName, int rowNum, HSSFCell c) {
+	private static String formatTestCaseDetails(String sheetName, int rowIndex, HSSFCell c)
{
 
 		StringBuffer sb = new StringBuffer();
-		CellReference cr = new CellReference(sheetName, rowNum, c.getCellNum(), false, false);
+		CellReference cr = new CellReference(sheetName, rowIndex, c.getColumnIndex(), false, false);
 		sb.append(cr.formatAsString());
 		sb.append(" {=").append(c.getCellFormula()).append("}");
 		return sb.toString();

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestLookupFunctionsFromSpreadsheet.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestLookupFunctionsFromSpreadsheet.java?rev=703096&r1=703095&r2=703096&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestLookupFunctionsFromSpreadsheet.java
(original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestLookupFunctionsFromSpreadsheet.java
Thu Oct  9 01:03:43 2008
@@ -256,11 +256,11 @@
 	}
 
 
-	private static String formatTestCaseDetails(String sheetName, int rowNum, HSSFCell c, String
currentGroupComment,
+	private static String formatTestCaseDetails(String sheetName, int rowIndex, HSSFCell c,
String currentGroupComment,
 			String rowComment) {
 
 		StringBuffer sb = new StringBuffer();
-		CellReference cr = new CellReference(sheetName, rowNum, c.getCellNum(), false, false);
+		CellReference cr = new CellReference(sheetName, rowIndex, c.getColumnIndex(), false, false);
 		sb.append(cr.formatAsString());
 		sb.append(" {=").append(c.getCellFormula()).append("}");
 

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java?rev=703096&r1=703095&r2=703096&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java Thu Oct
 9 01:03:43 2008
@@ -66,7 +66,7 @@
 			FormulaRecord r = record.getFormulaRecord();
 			Ptg[] ptgs = r.getParsedExpression();
 			
-			String cellRef = new CellReference(row.getRowNum(), cell.getCellNum(), false, false).formatAsString();
+			String cellRef = new CellReference(row.getRowNum(), cell.getColumnIndex(), false, false).formatAsString();
 			if(false && cellRef.equals("BP24")) { // TODO - replace System.out.println()s
with asserts
 				System.out.print(cellRef);
 				System.out.println(" - has " + ptgs.length + " ptgs:");

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?rev=703096&r1=703095&r2=703096&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Thu Oct 
9 01:03:43 2008
@@ -619,7 +619,7 @@
             int cellNum = 0;
             for (Iterator it2 = row.cellIterator(); it2.hasNext(); cellNum++) {
                 HSSFCell cell = (HSSFCell)it2.next();
-                assertEquals(cellNum, cell.getCellNum());
+                assertEquals(cellNum, cell.getColumnIndex());
             }
         }
     }

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFComment.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFComment.java?rev=703096&r1=703095&r2=703096&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFComment.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFComment.java Thu
Oct  9 01:03:43 2008
@@ -134,7 +134,7 @@
              assertFalse("cells in the second column have not empyy notes", 
                      "".equals(comment.getString().getString()));
              assertEquals(rownum, comment.getRow());
-             assertEquals(cell.getCellNum(), comment.getColumn());
+             assertEquals(cell.getColumnIndex(), comment.getColumn());
          }
      }
 

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java?rev=703096&r1=703095&r2=703096&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java Thu Oct
 9 01:03:43 2008
@@ -20,7 +20,6 @@
 import junit.framework.TestCase;
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
-import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
 
 /**
  * Test HSSFRow is okay.
@@ -152,7 +151,7 @@
         assertNull(row.getCell(1));
         assertNotNull(row.getCell(5));
 
-        assertEquals(5, cellB2.getCellNum());
+        assertEquals(5, cellB2.getColumnIndex());
         assertEquals(2, row.getFirstCellNum());
         assertEquals(6, row.getLastCellNum());
     }
@@ -258,12 +257,12 @@
         assertEquals(HSSFCell.CELL_TYPE_NUMERIC, row.getCell(5, HSSFRow.CREATE_NULL_AS_BLANK).getCellType());
         
         // Check created ones get the right column
-        assertEquals((short)0, row.getCell(0, HSSFRow.CREATE_NULL_AS_BLANK).getCellNum());
-        assertEquals((short)1, row.getCell(1, HSSFRow.CREATE_NULL_AS_BLANK).getCellNum());
-        assertEquals((short)2, row.getCell(2, HSSFRow.CREATE_NULL_AS_BLANK).getCellNum());
-        assertEquals((short)3, row.getCell(3, HSSFRow.CREATE_NULL_AS_BLANK).getCellNum());
-        assertEquals((short)4, row.getCell(4, HSSFRow.CREATE_NULL_AS_BLANK).getCellNum());
-        assertEquals((short)5, row.getCell(5, HSSFRow.CREATE_NULL_AS_BLANK).getCellNum());
+        assertEquals(0, row.getCell(0, HSSFRow.CREATE_NULL_AS_BLANK).getColumnIndex());
+        assertEquals(1, row.getCell(1, HSSFRow.CREATE_NULL_AS_BLANK).getColumnIndex());
+        assertEquals(2, row.getCell(2, HSSFRow.CREATE_NULL_AS_BLANK).getColumnIndex());
+        assertEquals(3, row.getCell(3, HSSFRow.CREATE_NULL_AS_BLANK).getColumnIndex());
+        assertEquals(4, row.getCell(4, HSSFRow.CREATE_NULL_AS_BLANK).getColumnIndex());
+        assertEquals(5, row.getCell(5, HSSFRow.CREATE_NULL_AS_BLANK).getColumnIndex());
         
         
         // Now change the cell policy on the workbook, check



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


Mime
View raw message