View | Details | Raw Unified | Return to bug 55042
Collapse All | Expand All

(-)poi/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java (-7 / +5 lines)
Lines 15-23 Link Here
15
import org.apache.poi.ss.formula.eval.ValueEval;
15
import org.apache.poi.ss.formula.eval.ValueEval;
16
import org.apache.poi.ss.formula.function.FunctionMetadata;
16
import org.apache.poi.ss.formula.function.FunctionMetadata;
17
import org.apache.poi.ss.formula.function.FunctionMetadataRegistry;
17
import org.apache.poi.ss.formula.function.FunctionMetadataRegistry;
18
import org.apache.poi.ss.formula.functions.EDate;
18
import org.apache.poi.ss.formula.functions.*;
19
import org.apache.poi.ss.formula.functions.FreeRefFunction;
20
import org.apache.poi.ss.formula.functions.Sumifs;
21
import org.apache.poi.ss.formula.udf.UDFFinder;
19
import org.apache.poi.ss.formula.udf.UDFFinder;
22
20
23
import java.util.*;
21
import java.util.*;
Lines 72-80 Link Here
72
        r(m, "BESSELK", null);
70
        r(m, "BESSELK", null);
73
        r(m, "BESSELY", null);
71
        r(m, "BESSELY", null);
74
        r(m, "BIN2DEC", null);
72
        r(m, "BIN2DEC", null);
75
        r(m, "BIN2HEX", null);
73
        r(m, "BIN2HEX", Bin2Hex.instance);
76
        r(m, "BIN2OCT", null);
74
        r(m, "BIN2OCT", null);
77
        r(m, "COMPLEX", null);
75
        r(m, "COMPLEX", Complex.instance);
78
        r(m, "CONVERT", null);
76
        r(m, "CONVERT", null);
79
        r(m, "COUNTIFS", null);
77
        r(m, "COUNTIFS", null);
80
        r(m, "COUPDAYBS", null);
78
        r(m, "COUPDAYBS", null);
Lines 93-101 Link Here
93
        r(m, "CUMIPMT", null);
91
        r(m, "CUMIPMT", null);
94
        r(m, "CUMPRINC", null);
92
        r(m, "CUMPRINC", null);
95
        r(m, "DEC2BIN", null);
93
        r(m, "DEC2BIN", null);
96
        r(m, "DEC2HEX", null);
94
        r(m, "DEC2HEX", Dec2Hex.instance);
97
        r(m, "DEC2OCT", null);
95
        r(m, "DEC2OCT", null);
98
        r(m, "DELTA", null);
96
        r(m, "DELTA", Delta.instance);
99
        r(m, "DISC", null);
97
        r(m, "DISC", null);
100
        r(m, "DOLLARDE", null);
98
        r(m, "DOLLARDE", null);
101
        r(m, "DOLLARFR", null);
99
        r(m, "DOLLARFR", null);
(-)poi/src/testcases/org/apache/poi/ss/formula/functions/TestComplexFunctionsFromSpreadsheet.java (+31 lines)
Line 0 Link Here
1
/* ====================================================================
2
   Licensed to the Apache Software Foundation (ASF) under one or more
3
   contributor license agreements.  See the NOTICE file distributed with
4
   this work for additional information regarding copyright ownership.
5
   The ASF licenses this file to You under the Apache License, Version 2.0
6
   (the "License"); you may not use this file except in compliance with
7
   the License.  You may obtain a copy of the License at
8
9
       http://www.apache.org/licenses/LICENSE-2.0
10
11
   Unless required by applicable law or agreed to in writing, software
12
   distributed under the License is distributed on an "AS IS" BASIS,
13
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
   See the License for the specific language governing permissions and
15
   limitations under the License.
16
==================================================================== */
17
18
package org.apache.poi.ss.formula.functions;
19
20
/**
21
 * Tests COMPLEX() as loaded from a test data spreadsheet.<p/>
22
 *
23
 * @author cedric dot walter @ gmail dot com
24
 */
25
public class TestComplexFunctionsFromSpreadsheet extends BaseTestFunctionsFromSpreadsheet {
26
27
    @Override
28
    protected String getFilename() {
29
        return "ComplexFunctionTestCaseData.xls";
30
    }
31
}
(-)poi/src/java/org/apache/poi/ss/formula/functions/Complex.java (-1 / +15 lines)
Lines 1-5 Link Here
1
package org.apache.poi.ss.formula.functions;
1
package org.apache.poi.ss.formula.functions;
2
2
3
import org.apache.poi.ss.formula.OperationEvaluationContext;
3
import org.apache.poi.ss.formula.eval.*;
4
import org.apache.poi.ss.formula.eval.*;
4
5
5
/**
6
/**
Lines 30-37 Link Here
30
 *
31
 *
31
 * @author cedric dot walter @ gmail dot com
32
 * @author cedric dot walter @ gmail dot com
32
 */
33
 */
33
public class Complex extends Var2or3ArgFunction {
34
public class Complex extends Var2or3ArgFunction implements FreeRefFunction {
34
35
36
    public static final FreeRefFunction instance = new Complex();
37
35
    public static final String DEFAULT_SUFFIX = "i";
38
    public static final String DEFAULT_SUFFIX = "i";
36
    public static final String SUPPORTED_SUFFIX = "j";
39
    public static final String SUPPORTED_SUFFIX = "j";
37
40
Lines 116-119 Link Here
116
        return (number == Math.floor(number)) && !Double.isInfinite(number);
119
        return (number == Math.floor(number)) && !Double.isInfinite(number);
117
    }
120
    }
118
121
122
    @Override
123
    public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
124
        if (args.length == 2) {
125
            return evaluate(ec.getRowIndex(), ec.getColumnIndex(), args[0], args[1]);
126
        }
127
        if (args.length == 3) {
128
            return evaluate(ec.getRowIndex(), ec.getColumnIndex(), args[0], args[1], args[2]);
129
        }
130
131
        return ErrorEval.VALUE_INVALID;
132
    }
119
}
133
}

Return to bug 55042