mirror of https://github.com/apache/poi.git
added missing tests for Bug 55042: patch for missing function COMPLEX
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1488808 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
24967623a9
commit
782fd29471
|
@ -15,9 +15,7 @@ import org.apache.poi.ss.formula.eval.NotImplementedException;
|
|||
import org.apache.poi.ss.formula.eval.ValueEval;
|
||||
import org.apache.poi.ss.formula.function.FunctionMetadata;
|
||||
import org.apache.poi.ss.formula.function.FunctionMetadataRegistry;
|
||||
import org.apache.poi.ss.formula.functions.EDate;
|
||||
import org.apache.poi.ss.formula.functions.FreeRefFunction;
|
||||
import org.apache.poi.ss.formula.functions.Sumifs;
|
||||
import org.apache.poi.ss.formula.functions.*;
|
||||
import org.apache.poi.ss.formula.udf.UDFFinder;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -74,7 +72,7 @@ public final class AnalysisToolPak implements UDFFinder {
|
|||
r(m, "BIN2DEC", null);
|
||||
r(m, "BIN2HEX", null);
|
||||
r(m, "BIN2OCT", null);
|
||||
r(m, "COMPLEX", null);
|
||||
r(m, "COMPLEX", Complex.instance);
|
||||
r(m, "CONVERT", null);
|
||||
r(m, "COUNTIFS", null);
|
||||
r(m, "COUPDAYBS", null);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.apache.poi.ss.formula.functions;
|
||||
|
||||
import org.apache.poi.ss.formula.OperationEvaluationContext;
|
||||
import org.apache.poi.ss.formula.eval.*;
|
||||
|
||||
/**
|
||||
|
@ -30,7 +31,9 @@ import org.apache.poi.ss.formula.eval.*;
|
|||
*
|
||||
* @author cedric dot walter @ gmail dot com
|
||||
*/
|
||||
public class Complex extends Var2or3ArgFunction {
|
||||
public class Complex extends Var2or3ArgFunction implements FreeRefFunction {
|
||||
|
||||
public static final FreeRefFunction instance = new Complex();
|
||||
|
||||
public static final String DEFAULT_SUFFIX = "i";
|
||||
public static final String SUPPORTED_SUFFIX = "j";
|
||||
|
@ -116,4 +119,15 @@ public class Complex extends Var2or3ArgFunction {
|
|||
return (number == Math.floor(number)) && !Double.isInfinite(number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
|
||||
if (args.length == 2) {
|
||||
return evaluate(ec.getRowIndex(), ec.getColumnIndex(), args[0], args[1]);
|
||||
}
|
||||
if (args.length == 3) {
|
||||
return evaluate(ec.getRowIndex(), ec.getColumnIndex(), args[0], args[1], args[2]);
|
||||
}
|
||||
|
||||
return ErrorEval.VALUE_INVALID;
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue