Renamed AreaEval method from getValueAt() to getAbsoluteValue()

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@888582 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2009-12-08 21:48:54 +00:00
parent 37790e51e4
commit 0c3c85a152
5 changed files with 22 additions and 23 deletions

View File

@ -66,7 +66,7 @@ public interface AreaEval extends ValueEval {
* <code>null</code> (possibly {@link BlankEval}). The specified indexes should be absolute * <code>null</code> (possibly {@link BlankEval}). The specified indexes should be absolute
* indexes in the sheet and not relative indexes within the area. * 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 * returns true if the cell at row and col specified

View File

@ -67,7 +67,7 @@ public abstract class AreaEvalBase implements AreaEval {
return _lastRow; return _lastRow;
} }
public final ValueEval getValueAt(int row, int col) { public final ValueEval getAbsoluteValue(int row, int col) {
int rowOffsetIx = row - _firstRow; int rowOffsetIx = row - _firstRow;
int colOffsetIx = col - _firstColumn; int colOffsetIx = col - _firstColumn;

View File

@ -151,19 +151,19 @@ public final class OperandResolver {
if(!ae.containsRow(srcCellRow)) { if(!ae.containsRow(srcCellRow)) {
throw EvaluationException.invalidValue(); throw EvaluationException.invalidValue();
} }
return ae.getValueAt(srcCellRow, ae.getFirstColumn()); return ae.getAbsoluteValue(srcCellRow, ae.getFirstColumn());
} }
if(!ae.isRow()) { if(!ae.isRow()) {
// multi-column, multi-row area // multi-column, multi-row area
if(ae.containsRow(srcCellRow) && ae.containsColumn(srcCellCol)) { if(ae.containsRow(srcCellRow) && ae.containsColumn(srcCellCol)) {
return ae.getValueAt(ae.getFirstRow(), ae.getFirstColumn()); return ae.getAbsoluteValue(ae.getFirstRow(), ae.getFirstColumn());
} }
throw EvaluationException.invalidValue(); throw EvaluationException.invalidValue();
} }
if(!ae.containsColumn(srcCellCol)) { if(!ae.containsColumn(srcCellCol)) {
throw EvaluationException.invalidValue(); throw EvaluationException.invalidValue();
} }
return ae.getValueAt(ae.getFirstRow(), srcCellCol); return ae.getAbsoluteValue(ae.getFirstRow(), srcCellCol);
} }
/** /**

View File

@ -497,10 +497,10 @@ public final class WorkbookEvaluator {
if(ae.isColumn()) { if(ae.isColumn()) {
return ae.getRelativeValue(0, 0); return ae.getRelativeValue(0, 0);
} }
return ae.getValueAt(ae.getFirstRow(), srcColNum); return ae.getAbsoluteValue(ae.getFirstRow(), srcColNum);
} }
if (ae.isColumn()) { if (ae.isColumn()) {
return ae.getValueAt(srcRowNum, ae.getFirstColumn()); return ae.getAbsoluteValue(srcRowNum, ae.getFirstColumn());
} }
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

View File

@ -43,7 +43,7 @@ public final class TestAreaEval extends TestCase {
new NumberEval(6), new NumberEval(6),
}; };
AreaEval ae = EvalFactory.createAreaEval(ptg, values); 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"); throw new AssertionFailedError("Identified bug 44950 a");
} }
confirm(1, ae, 1, 1); confirm(1, ae, 1, 1);
@ -56,8 +56,7 @@ public final class TestAreaEval extends TestCase {
} }
private static void confirm(int expectedValue, AreaEval ae, int row, int col) { 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); assertEquals(expectedValue, v.getNumberValue(), 0.0);
} }
} }