ASF Bugzilla – Attachment 30380 Details for
Bug 55037
[PATCH] patch for missing function DELTA
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
patch : TestDeltaFunctionsFromSpreadsheet.java Delta.java AnalysisToolPak.java
DELTA_2.patch (text/plain), 5.36 KB, created by
Cédric Walter
on 2013-06-03 07:18:24 UTC
(
hide
)
Description:
patch : TestDeltaFunctionsFromSpreadsheet.java Delta.java AnalysisToolPak.java
Filename:
MIME Type:
Creator:
Cédric Walter
Created:
2013-06-03 07:18:24 UTC
Size:
5.36 KB
patch
obsolete
>Index: poi/src/testcases/org/apache/poi/ss/formula/functions/TestDeltaFunctionsFromSpreadsheet.java >IDEA additional info: >Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ><+>UTF-8 >=================================================================== >--- poi/src/testcases/org/apache/poi/ss/formula/functions/TestDeltaFunctionsFromSpreadsheet.java (revision ) >+++ poi/src/testcases/org/apache/poi/ss/formula/functions/TestDeltaFunctionsFromSpreadsheet.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 DELTA() as loaded from a test data spreadsheet.<p/> >+ * >+ * @author cedric dot walter @ gmail dot com >+ */ >+public class TestDeltaFunctionsFromSpreadsheet extends BaseTestFunctionsFromSpreadsheet { >+ >+ @Override >+ protected String getFilename() { >+ return "DeltaFunctionTestCaseData.xls"; >+ } >+} >\ No newline at end of file >Index: poi/src/java/org/apache/poi/ss/formula/functions/Delta.java >IDEA additional info: >Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ><+>UTF-8 >=================================================================== >--- poi/src/java/org/apache/poi/ss/formula/functions/Delta.java (revision 1488779) >+++ poi/src/java/org/apache/poi/ss/formula/functions/Delta.java (revision ) >@@ -17,6 +17,7 @@ > > package org.apache.poi.ss.formula.functions; > >+import org.apache.poi.ss.formula.OperationEvaluationContext; > import org.apache.poi.ss.formula.eval.*; > > import java.math.BigDecimal; >@@ -37,11 +38,14 @@ > * > * @author cedric dot walter @ gmail dot com > */ >-public final class Delta extends Fixed2ArgFunction { >+public final class Delta extends Fixed2ArgFunction implements FreeRefFunction { > >+ public static final FreeRefFunction instance = new Delta(); >+ > private final static NumberEval ONE = new NumberEval(1); > private final static NumberEval ZERO = new NumberEval(0); > >+ @Override > public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg1, ValueEval arg2) { > ValueEval veText1; > try { >@@ -72,4 +76,11 @@ > return result == 0 ? ONE : ZERO; > } > >+ @Override >+ public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) { >+ if (args.length != 2) { >+ return ErrorEval.VALUE_INVALID; >+ } >+ return evaluate(ec.getRowIndex(), ec.getColumnIndex(), args[0], args[1]); >+ } >-} >\ No newline at end of file >+} >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); >@@ -150,7 +148,7 @@ > r(m, "PRICE", null); > r(m, "PRICEDISC", null); > r(m, "PRICEMAT", null); >- r(m, "QUOTIENT", null); >+ r(m, "QUOTIENT", Quotient.instance); > r(m, "RANDBETWEEN", RandBetween.instance); > r(m, "RECEIVED", null); > r(m, "RTD", null);
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 Raw
Actions:
View
Attachments on
bug 55037
:
30351
|
30365
|
30366
| 30380