added getNumberOfCells CellRangeAddressBase etc

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@718840 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-11-19 02:04:07 +00:00
parent 6f28f85004
commit db1f68955e
2 changed files with 14 additions and 0 deletions

View File

@ -126,6 +126,12 @@ public abstract class CellRangeAddressBase {
public final void setLastRow(int lastRow) {
_lastRow = lastRow;
}
/**
* @return the size of the range (number of cells in the area).
*/
public int getNumberOfCells() {
return (_lastRow - _firstRow + 1) * (_lastCol - _firstCol + 1);
}
public final String toString() {
CellReference crA = new CellReference(_firstRow, _firstCol);

View File

@ -206,6 +206,14 @@ public class Region implements Comparable {
return compareTo(( Region ) o);
}
/**
* @return the size of the region (number of cells in the area).
*/
public int getArea() {
return (rowTo - rowFrom + 1) * (colTo - colFrom + 1);
}
/**
* Convert a List of CellRange objects to an array of regions
*