private int count;
@Override
- public boolean processMatch(ValueEval eval, int fieldNumber) {
- if (fieldNumber < 0 || eval instanceof NumericValueEval) {
+ public boolean processMatch(ValueEval eval) {
+ if (eval instanceof NumericValueEval) {
count++;
}
return true;
private ValueEval result;
@Override
- public boolean processMatch(ValueEval eval, int fieldNumber) {
+ public boolean processMatch(ValueEval eval) {
if(result == null) // First match, just set the value.
{
result = eval;
private ValueEval maximumValue;
@Override
- public boolean processMatch(ValueEval eval, int fieldNumber) {
+ public boolean processMatch(ValueEval eval) {
if(eval instanceof NumericValueEval) {
if(maximumValue == null) { // First match, just set the value.
maximumValue = eval;
private ValueEval minimumValue;
@Override
- public boolean processMatch(ValueEval eval, int fieldNumber) {
+ public boolean processMatch(ValueEval eval) {
if(eval instanceof NumericValueEval) {
if(minimumValue == null) { // First match, just set the value.
minimumValue = eval;
import org.apache.poi.ss.formula.eval.BlankEval;
import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.formula.eval.EvaluationException;
+import org.apache.poi.ss.formula.eval.MissingArgEval;
import org.apache.poi.ss.formula.eval.NotImplementedException;
+import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.NumericValueEval;
import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.StringEval;
return ErrorEval.VALUE_INVALID;
}
// Filter each entry.
- if(matches) {
+ if (matches) {
ValueEval currentValueEval = resolveReference(db, row, fc);
+ if (fc < 0 && algorithm.allowEmptyMatchField() && !(currentValueEval instanceof NumericValueEval)) {
+ currentValueEval = NumberEval.ZERO;
+ }
// Pass the match to the algorithm and conditionally abort the search.
- boolean shouldContinue = algorithm.processMatch(currentValueEval, fc);
+ boolean shouldContinue = algorithm.processMatch(currentValueEval);
if(! shouldContinue) {
break;
}
private double totalValue = 0;
@Override
- public boolean processMatch(ValueEval eval, int fieldNumber) {
+ public boolean processMatch(ValueEval eval) {
if(eval instanceof NumericValueEval) {
double currentValue = ((NumericValueEval)eval).getNumberValue();
totalValue += currentValue;
/**
* Process a match that is found during a run through a database.
* @param eval ValueEval of the cell in the matching row. References will already be resolved.
- * @param fieldNumber the field number (added in POI 5.2.3)
* @return Whether we should continue iterating through the database.
*/
- boolean processMatch(ValueEval eval, int fieldNumber);
+ boolean processMatch(ValueEval eval);
/**
* Return a result ValueEval that will be the result of the calculation.