]> source.dussan.org Git - poi.git/commitdiff
Renamed AreaEval method from getValueAt() to getAbsoluteValue()
authorJosh Micich <josh@apache.org>
Tue, 8 Dec 2009 21:48:54 +0000 (21:48 +0000)
committerJosh Micich <josh@apache.org>
Tue, 8 Dec 2009 21:48:54 +0000 (21:48 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@888582 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/record/formula/eval/AreaEval.java
src/java/org/apache/poi/hssf/record/formula/eval/AreaEvalBase.java
src/java/org/apache/poi/hssf/record/formula/eval/OperandResolver.java
src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
src/testcases/org/apache/poi/hssf/record/formula/eval/TestAreaEval.java

index b528eb784e0e39940174aa3dcbe95a242ddb4507..7428ad716396004cfdebce5b502c53b3de5d4323 100644 (file)
@@ -62,11 +62,11 @@ public interface AreaEval extends ValueEval {
     boolean isColumn();
 
     /**
-     * @return the ValueEval from within this area at the specified row and col index. Never 
-     * <code>null</code> (possibly {@link BlankEval}).  The specified indexes should be absolute 
-     * indexes in the sheet and not relative indexes within the area.  
+     * @return the ValueEval from within this area at the specified row and col index. Never
+     * <code>null</code> (possibly {@link BlankEval}).  The specified indexes should be absolute
+     * indexes in the sheet and not relative indexes within the area.
      */
-    ValueEval getValueAt(int row, int col);
+    ValueEval getAbsoluteValue(int row, int col);
 
     /**
      * returns true if the cell at row and col specified
@@ -92,9 +92,9 @@ public interface AreaEval extends ValueEval {
     int getWidth();
     int getHeight();
     /**
-     * @return the ValueEval from within this area at the specified relativeRowIndex and 
+     * @return the ValueEval from within this area at the specified relativeRowIndex and
      * relativeColumnIndex. Never <code>null</code> (possibly {@link BlankEval}). The
-     * specified indexes should relative to the top left corner of this area.  
+     * specified indexes should relative to the top left corner of this area.
      */
     ValueEval getRelativeValue(int relativeRowIndex, int relativeColumnIndex);
 
index 19dc1ef4d1dc6e1f34120f1df0ad416a7d7732f4..d435264ae5f25862b93eeb065bb5577009d9ccca 100644 (file)
@@ -67,7 +67,7 @@ public abstract class AreaEvalBase implements AreaEval {
                return _lastRow;
        }
 
-       public final ValueEval getValueAt(int row, int col) {
+       public final ValueEval getAbsoluteValue(int row, int col) {
                int rowOffsetIx = row - _firstRow;
                int colOffsetIx = col - _firstColumn;
 
index 37b8428001ee30273b3f07f950a972e4fc707d20..50e9dd058d999c5c3f6de908d854482ff33b56a0 100644 (file)
@@ -151,19 +151,19 @@ public final class OperandResolver {
                        if(!ae.containsRow(srcCellRow)) {
                                throw EvaluationException.invalidValue();
                        }
-                       return ae.getValueAt(srcCellRow, ae.getFirstColumn());
+                       return ae.getAbsoluteValue(srcCellRow, ae.getFirstColumn());
                }
                if(!ae.isRow()) {
                        // multi-column, multi-row area
                        if(ae.containsRow(srcCellRow) && ae.containsColumn(srcCellCol)) {
-                               return ae.getValueAt(ae.getFirstRow(), ae.getFirstColumn());
+                               return ae.getAbsoluteValue(ae.getFirstRow(), ae.getFirstColumn());
                        }
                        throw EvaluationException.invalidValue();
                }
                if(!ae.containsColumn(srcCellCol)) {
                        throw EvaluationException.invalidValue();
                }
-               return ae.getValueAt(ae.getFirstRow(), srcCellCol);
+               return ae.getAbsoluteValue(ae.getFirstRow(), srcCellCol);
        }
 
        /**
index ca1b71a21d72be293b555969af37bac1e15111ab..69e1446d447b17d6d5c16c98b2775c30641bfba3 100644 (file)
@@ -497,10 +497,10 @@ public final class WorkbookEvaluator {
                                if(ae.isColumn()) {
                                        return ae.getRelativeValue(0, 0);
                                }
-                               return ae.getValueAt(ae.getFirstRow(), srcColNum);
+                               return ae.getAbsoluteValue(ae.getFirstRow(), srcColNum);
                        }
                        if (ae.isColumn()) {
-                               return ae.getValueAt(srcRowNum, ae.getFirstColumn());
+                               return ae.getAbsoluteValue(srcRowNum, ae.getFirstColumn());
                        }
                        return ErrorEval.VALUE_INVALID;
                }
index 71d15745e9988e284d0e012fff2c47b7a2fdd1ee..65e4e7d4116d6a28ee580870f19fee811b166945 100644 (file)
@@ -25,7 +25,7 @@ import org.apache.poi.hssf.record.formula.functions.EvalFactory;
 
 /**
  * Tests for <tt>AreaEval</tt>
- *  
+ *
  * @author Josh Micich
  */
 public final class TestAreaEval extends TestCase {
@@ -35,15 +35,15 @@ public final class TestAreaEval extends TestCase {
                AreaPtg ptg = new AreaPtg("B2:D3");
                NumberEval one = new NumberEval(1);
                ValueEval[] values = {
-                               one,    
-                               new NumberEval(2),      
-                               new NumberEval(3),      
-                               new NumberEval(4),      
-                               new NumberEval(5),      
-                               new NumberEval(6),      
+                               one,
+                               new NumberEval(2),
+                               new NumberEval(3),
+                               new NumberEval(4),
+                               new NumberEval(5),
+                               new NumberEval(6),
                };
                AreaEval ae = EvalFactory.createAreaEval(ptg, values);
-               if (one == ae.getValueAt(1, 2)) {
+               if (one == ae.getAbsoluteValue(1, 2)) {
                        throw new AssertionFailedError("Identified bug 44950 a");
                }
                confirm(1, ae, 1, 1);
@@ -52,12 +52,11 @@ public final class TestAreaEval extends TestCase {
                confirm(4, ae, 2, 1);
                confirm(5, ae, 2, 2);
                confirm(6, ae, 2, 3);
-               
+
        }
 
        private static void confirm(int expectedValue, AreaEval ae, int row, int col) {
-               NumberEval v = (NumberEval) ae.getValueAt(row, col);
+               NumberEval v = (NumberEval) ae.getAbsoluteValue(row, col);
                assertEquals(expectedValue, v.getNumberValue(), 0.0);
        }
-
 }