ASF Bugzilla – Attachment 30368 Details for
Bug 55042
[PATCH] patch for missing function COMPLEX
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
COMPLEX_AnalysisToolpack.patch + test loader from xls
COMPLEX_AnalysisToolpack.patch (text/plain), 5.00 KB, created by
Cédric Walter
on 2013-06-02 20:31:01 UTC
(
hide
)
Description:
COMPLEX_AnalysisToolpack.patch + test loader from xls
Filename:
MIME Type:
Creator:
Cédric Walter
Created:
2013-06-02 20:31:01 UTC
Size:
5.00 KB
patch
obsolete
>Index: poi/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java >IDEA additional info: >Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ><+>UTF-8 >=================================================================== >--- poi/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java (revision 1488779) >+++ poi/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java (revision ) >@@ -15,9 +15,7 @@ > 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.*; >@@ -72,9 +70,9 @@ > r(m, "BESSELK", null); > r(m, "BESSELY", null); > r(m, "BIN2DEC", null); >- r(m, "BIN2HEX", null); >+ r(m, "BIN2HEX", Bin2Hex.instance); > 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); >@@ -93,9 +91,9 @@ > r(m, "CUMIPMT", null); > r(m, "CUMPRINC", null); > r(m, "DEC2BIN", null); >- r(m, "DEC2HEX", null); >+ r(m, "DEC2HEX", Dec2Hex.instance); > r(m, "DEC2OCT", null); >- r(m, "DELTA", null); >+ r(m, "DELTA", Delta.instance); > r(m, "DISC", null); > r(m, "DOLLARDE", null); > r(m, "DOLLARFR", null); >Index: poi/src/testcases/org/apache/poi/ss/formula/functions/TestComplexFunctionsFromSpreadsheet.java >IDEA additional info: >Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ><+>UTF-8 >=================================================================== >--- poi/src/testcases/org/apache/poi/ss/formula/functions/TestComplexFunctionsFromSpreadsheet.java (revision ) >+++ poi/src/testcases/org/apache/poi/ss/formula/functions/TestComplexFunctionsFromSpreadsheet.java (revision ) >@@ -0,0 +1,31 @@ >+/* ==================================================================== >+ Licensed to the Apache Software Foundation (ASF) under one or more >+ contributor license agreements. See the NOTICE file distributed with >+ this work for additional information regarding copyright ownership. >+ The ASF licenses this file to You under the Apache License, Version 2.0 >+ (the "License"); you may not use this file except in compliance with >+ the License. You may obtain a copy of the License at >+ >+ http://www.apache.org/licenses/LICENSE-2.0 >+ >+ Unless required by applicable law or agreed to in writing, software >+ distributed under the License is distributed on an "AS IS" BASIS, >+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >+ See the License for the specific language governing permissions and >+ limitations under the License. >+==================================================================== */ >+ >+package org.apache.poi.ss.formula.functions; >+ >+/** >+ * Tests COMPLEX() as loaded from a test data spreadsheet.<p/> >+ * >+ * @author cedric dot walter @ gmail dot com >+ */ >+public class TestComplexFunctionsFromSpreadsheet extends BaseTestFunctionsFromSpreadsheet { >+ >+ @Override >+ protected String getFilename() { >+ return "ComplexFunctionTestCaseData.xls"; >+ } >+} >\ No newline at end of file >Index: poi/src/java/org/apache/poi/ss/formula/functions/Complex.java >IDEA additional info: >Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ><+>UTF-8 >=================================================================== >--- poi/src/java/org/apache/poi/ss/formula/functions/Complex.java (revision 1488779) >+++ poi/src/java/org/apache/poi/ss/formula/functions/Complex.java (revision ) >@@ -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,8 +31,10 @@ > * > * @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 @@ > 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; >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 55042
:
30357
|
30367
| 30368