aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/ss
diff options
context:
space:
mode:
authorJosh Micich <josh@apache.org>2008-11-19 02:04:07 +0000
committerJosh Micich <josh@apache.org>2008-11-19 02:04:07 +0000
commit326d502134e91852ba688105dc7c1d3534bae2e7 (patch)
treec80f0c21257d5d411b46c2cd1f9a2554b96d2511 /src/java/org/apache/poi/ss
parentb8329a9693a876ecaf40f25847b3f61908a46444 (diff)
downloadpoi-326d502134e91852ba688105dc7c1d3534bae2e7.tar.gz
poi-326d502134e91852ba688105dc7c1d3534bae2e7.zip
added getNumberOfCells CellRangeAddressBase etc
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@718840 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/ss')
-rw-r--r--src/java/org/apache/poi/ss/util/CellRangeAddressBase.java6
-rw-r--r--src/java/org/apache/poi/ss/util/Region.java8
2 files changed, 14 insertions, 0 deletions
diff --git a/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java b/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java
index 9e292929af..080384c3e2 100644
--- a/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java
+++ b/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java
@@ -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);
diff --git a/src/java/org/apache/poi/ss/util/Region.java b/src/java/org/apache/poi/ss/util/Region.java
index aee3eef0ac..27fc792c45 100644
--- a/src/java/org/apache/poi/ss/util/Region.java
+++ b/src/java/org/apache/poi/ss/util/Region.java
@@ -205,6 +205,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