reverted changes accidentally submitted with r692538

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@692541 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-09-05 20:43:37 +00:00
parent 69e25acaf8
commit 3676e8d3c8
3 changed files with 3 additions and 25 deletions

View File

@ -90,19 +90,9 @@ public final class Index implements Function {
} }
} }
private static ValueEval getValueFromArea(AreaEval ae, int pRowIx, int pColumnIx) throws EvaluationException { private static ValueEval getValueFromArea(AreaEval ae, int rowIx, int columnIx) throws EvaluationException {
int width = ae.getWidth(); int width = ae.getWidth();
int height = ae.getHeight(); int height = ae.getHeight();
int rowIx;
int columnIx;
if (ae.isRow() && pColumnIx == 0 && pRowIx > 0) {
// TODO - explore all these special cases
rowIx = 0;
columnIx = pRowIx;
} else {
rowIx = pRowIx;
columnIx = pColumnIx;
}
// Slightly irregular logic for bounds checking errors // Slightly irregular logic for bounds checking errors
if (rowIx >= height || columnIx >= width) { if (rowIx >= height || columnIx >= width) {

View File

@ -17,7 +17,6 @@
package org.apache.poi.hssf.record.formula.functions; package org.apache.poi.hssf.record.formula.functions;
import org.apache.poi.hssf.record.NumberRecord;
import org.apache.poi.hssf.record.formula.eval.AreaEval; import org.apache.poi.hssf.record.formula.eval.AreaEval;
import org.apache.poi.hssf.record.formula.eval.BlankEval; import org.apache.poi.hssf.record.formula.eval.BlankEval;
import org.apache.poi.hssf.record.formula.eval.BoolEval; import org.apache.poi.hssf.record.formula.eval.BoolEval;
@ -588,9 +587,7 @@ final class LookupUtils {
if (lookupValue instanceof BlankEval) { if (lookupValue instanceof BlankEval) {
// blank eval can never be found in a lookup array // blank eval can never be found in a lookup array
//throw new EvaluationException(ErrorEval.NA); throw new EvaluationException(ErrorEval.NA);
// TODO - investigate this
return new NumberLookupComparer(NumberEval.ZERO);
} }
if (lookupValue instanceof StringEval) { if (lookupValue instanceof StringEval) {
return new StringLookupComparer((StringEval) lookupValue); return new StringLookupComparer((StringEval) lookupValue);

View File

@ -60,16 +60,7 @@ public final class Vlookup implements Function {
AreaEval tableArray = LookupUtils.resolveTableArrayArg(args[1]); AreaEval tableArray = LookupUtils.resolveTableArrayArg(args[1]);
boolean isRangeLookup = LookupUtils.resolveRangeLookupArg(arg3, srcCellRow, srcCellCol); boolean isRangeLookup = LookupUtils.resolveRangeLookupArg(arg3, srcCellRow, srcCellCol);
int rowIndex = LookupUtils.lookupIndexOfValue(lookupValue, LookupUtils.createColumnVector(tableArray, 0), isRangeLookup); int rowIndex = LookupUtils.lookupIndexOfValue(lookupValue, LookupUtils.createColumnVector(tableArray, 0), isRangeLookup);
ValueEval veColIndex; ValueEval veColIndex = OperandResolver.getSingleValue(args[2], srcCellRow, srcCellCol);
try {
veColIndex = OperandResolver.getSingleValue(args[2], srcCellRow, srcCellCol);
} catch (EvaluationException e) {
// weird translation of errors for the third arg - needs investigation
if (e.getErrorEval() == ErrorEval.NA) {
return ErrorEval.REF_INVALID;
}
throw e;
}
int colIndex = LookupUtils.resolveRowOrColIndexArg(veColIndex); int colIndex = LookupUtils.resolveRowOrColIndexArg(veColIndex);
ValueVector resultCol = createResultColumnVector(tableArray, colIndex); ValueVector resultCol = createResultColumnVector(tableArray, colIndex);
return resultCol.getItem(rowIndex); return resultCol.getItem(rowIndex);