poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r718840 - in /poi/trunk/src/java/org/apache/poi/ss/util: CellRangeAddressBase.java Region.java
Date Wed, 19 Nov 2008 02:04:08 GMT
Author: josh
Date: Tue Nov 18 18:04:07 2008
New Revision: 718840

URL: http://svn.apache.org/viewvc?rev=718840&view=rev
Log:
added getNumberOfCells CellRangeAddressBase etc

Modified:
    poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java
    poi/trunk/src/java/org/apache/poi/ss/util/Region.java

Modified: poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java?rev=718840&r1=718839&r2=718840&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java Tue Nov 18 18:04:07
2008
@@ -126,6 +126,12 @@
 	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);

Modified: poi/trunk/src/java/org/apache/poi/ss/util/Region.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/Region.java?rev=718840&r1=718839&r2=718840&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/Region.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/Region.java Tue Nov 18 18:04:07 2008
@@ -205,6 +205,14 @@
     {
         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 



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


Mime
View raw message