aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/hssf
diff options
context:
space:
mode:
authorJosh Micich <josh@apache.org>2008-10-09 08:03:43 +0000
committerJosh Micich <josh@apache.org>2008-10-09 08:03:43 +0000
commit91d6061c0781c1c71b998aa3710b66e09aca3021 (patch)
treefed8fc3d17ba54b22096863dfafd31848470aa9f /src/java/org/apache/poi/hssf
parentb3959ec23749b0f64af561b9e2e72271d1e28e71 (diff)
downloadpoi-91d6061c0781c1c71b998aa3710b66e09aca3021.tar.gz
poi-91d6061c0781c1c71b998aa3710b66e09aca3021.zip
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 ........ git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@703096 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/hssf')
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFCell.java15
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java2
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFRow.java12
3 files changed, 15 insertions, 14 deletions
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
index a6a1500321..2554f539f9 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
@@ -232,7 +232,7 @@ public class HSSFCell implements Cell {
/**
* 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 @@ public class HSSFCell implements Cell {
}
/**
- * 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;
}
/**
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java b/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java
index e5e7116ae3..97b581724a 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java
@@ -55,7 +55,7 @@ final class HSSFEvaluationCell implements EvaluationCell {
return _cell.getCellType();
}
public int getColumnIndex() {
- return _cell.getCellNum();
+ return _cell.getColumnIndex();
}
public int getErrorCellValue() {
return _cell.getErrorCellValue();
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java b/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java
index 1e211cced9..3668a53393 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java
@@ -155,7 +155,7 @@ public final class HSSFRow implements Comparable, Row {
}
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 @@ public final class HSSFRow implements Comparable, Row {
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 @@ public final class HSSFRow implements Comparable, Row {
}
// 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 @@ public final class HSSFRow implements Comparable, Row {
*/
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 @@ public final class HSSFRow implements Comparable, Row {
// 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()) {