You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by jo...@apache.org on 2008/09/10 21:23:46 UTC

svn commit: r693939 - in /poi/trunk/src: java/org/apache/poi/hssf/record/formula/eval/ java/org/apache/poi/hssf/record/formula/functions/ testcases/org/apache/poi/hssf/data/ testcases/org/apache/poi/hssf/record/formula/functions/

Author: josh
Date: Wed Sep 10 12:23:43 2008
New Revision: 693939

URL: http://svn.apache.org/viewvc?rev=693939&view=rev
Log:
Fixing error value handling for numeric functions. Refactored hierarchy.

Added:
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/DateFunc.java   (contents, props changed)
      - copied, changed from r693935, poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Date.java
Removed:
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Atan2.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Ceiling.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Combin.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Date.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Floor.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Log.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Mod.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/NumericFunctionOneArg.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Power.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Round.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Rounddown.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Roundup.java
Modified:
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/ConcatEval.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/FunctionEval.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Even.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Odd.java
    poi/trunk/src/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls
    poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestCountFuncs.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestRoundFuncs.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/ConcatEval.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/ConcatEval.java?rev=693939&r1=693938&r2=693939&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/ConcatEval.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/ConcatEval.java Wed Sep 10 12:23:43 2008
@@ -1,19 +1,19 @@
-/*
-* 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.
-*/
+/* ====================================================================
+   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.hssf.record.formula.eval;
 
@@ -24,7 +24,7 @@
  * @author Amol S. Deshmukh < amolweb at ya hoo dot com >
  *  
  */
-public final class ConcatEval extends StringOperationEval {
+public final class ConcatEval implements OperationEval {
 
     private ConcatPtg delegate;
 
@@ -37,20 +37,23 @@
     		return ErrorEval.VALUE_INVALID;
     	}
         StringBuffer sb = new StringBuffer();
-        for (int i = 0; i < 2; i++) { 
-            
-            ValueEval ve = singleOperandEvaluate(args[i], srcRow, srcCol);
-            if (ve instanceof StringValueEval) {
-                StringValueEval sve = (StringValueEval) ve;
-                sb.append(sve.getStringValue());
-            }
-            else if (ve instanceof BlankEval) {
-                // do nothing
-            }
-            else { // must be an error eval
-                return ve;
-            }
-        }
+        try {
+			for (int i = 0; i < 2; i++) { 
+			    
+			    ValueEval ve = OperandResolver.getSingleValue(args[i], srcRow, srcCol);
+			    if (ve instanceof StringValueEval) {
+			        StringValueEval sve = (StringValueEval) ve;
+			        sb.append(sve.getStringValue());
+			    } else if (ve instanceof BlankEval) {
+			        // do nothing
+			    } else { // must be an error eval
+			        throw new RuntimeException("Unexpected value type (" 
+			        		+ ve.getClass().getName() + ")");
+			    }
+			}
+		} catch (EvaluationException e) {
+			return e.getErrorEval();
+		}
         
         return new StringEval(sb.toString());
     }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/FunctionEval.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/FunctionEval.java?rev=693939&r1=693938&r2=693939&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/FunctionEval.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/FunctionEval.java Wed Sep 10 12:23:43 2008
@@ -90,21 +90,21 @@
         retval[10] = new Na(); // NA
         retval[11] = new Npv(); // NPV
         retval[12] = new Stdev(); // STDEV
-        retval[13] = NumericFunctionOneArg.DOLLAR;
+        retval[13] = NumericFunction.DOLLAR;
         retval[14] = new Fixed(); // FIXED
-        retval[15] = NumericFunctionOneArg.SIN;
-        retval[16] = NumericFunctionOneArg.COS;
-        retval[17] = NumericFunctionOneArg.TAN;
-        retval[18] = NumericFunctionOneArg.ATAN;
+        retval[15] = NumericFunction.SIN;
+        retval[16] = NumericFunction.COS;
+        retval[17] = NumericFunction.TAN;
+        retval[18] = NumericFunction.ATAN;
         retval[19] = new Pi(); // PI
-        retval[20] = NumericFunctionOneArg.SQRT;
-        retval[21] = NumericFunctionOneArg.EXP;
-        retval[22] = NumericFunctionOneArg.LN;
-        retval[23] = NumericFunctionOneArg.LOG10;
-        retval[24] = NumericFunctionOneArg.ABS;
-        retval[25] = NumericFunctionOneArg.INT;
-        retval[26] = NumericFunctionOneArg.SIGN;
-        retval[27] = new Round(); // ROUND
+        retval[20] = NumericFunction.SQRT;
+        retval[21] = NumericFunction.EXP;
+        retval[22] = NumericFunction.LN;
+        retval[23] = NumericFunction.LOG10;
+        retval[24] = NumericFunction.ABS;
+        retval[25] = NumericFunction.INT;
+        retval[26] = NumericFunction.SIGN;
+        retval[27] = NumericFunction.ROUND;
         retval[28] = new Lookup(); // LOOKUP
         retval[29] = new Index(); // INDEX
         retval[30] = new Rept(); // REPT
@@ -116,7 +116,7 @@
         retval[36] = new And(); // AND
         retval[37] = new Or(); // OR
         retval[38] = new Not(); // NOT
-        retval[39] = new Mod(); // MOD
+        retval[39] = NumericFunction.MOD;
         retval[40] = new Dcount(); // DCOUNT
         retval[41] = new Dsum(); // DSUM
         retval[42] = new Daverage(); // DAVERAGE
@@ -141,7 +141,7 @@
         retval[62] = new Irr(); // IRR
         retval[63] = new Rand(); // RAND
         retval[64] = new Match(); // MATCH
-        retval[65] = new Date(); // DATE
+        retval[65] = DateFunc.instance; // DATE
         retval[66] = new Time(); // TIME
         retval[67] = CalendarFieldFunction.DAY; // DAY
         retval[68] = CalendarFieldFunction.MONTH; // MONTH
@@ -173,9 +173,9 @@
         retval[94] = new Activecell(); // ACTIVECELL
         retval[95] = new NotImplementedFunction(); // SELECTION
         retval[96] = new Result(); // RESULT
-        retval[97] = new Atan2(); // ATAN2
-        retval[98] = NumericFunctionOneArg.ASIN;
-        retval[99] = NumericFunctionOneArg.ACOS;
+        retval[97] = NumericFunction.ATAN2;
+        retval[98] = NumericFunction.ASIN;
+        retval[99] = NumericFunction.ACOS;
         retval[100] = new Choose(); // CHOOSE
         retval[101] = new Hlookup(); // HLOOKUP
         retval[102] = new Vlookup(); // VLOOKUP
@@ -185,7 +185,7 @@
         retval[106] = new NotImplementedFunction(); // GETFORMULA
         retval[107] = new NotImplementedFunction(); // GETNAME
         retval[108] = new Setvalue(); // SETVALUE
-        retval[109] = new Log(); // LOG
+        retval[109] = NumericFunction.LOG;
         retval[110] = new Exec(); // EXEC
         retval[111] = new Char(); // CHAR
         retval[112] = new Lower(); // LOWER
@@ -256,7 +256,7 @@
         retval[181] = new Help(); // HELP
         retval[182] = new NotImplementedFunction(); // GETBAR
         retval[183] = new Product(); // PRODUCT
-        retval[184] = NumericFunctionOneArg.FACT;
+        retval[184] = NumericFunction.FACT;
         retval[185] = new NotImplementedFunction(); // GETCELL
         retval[186] = new NotImplementedFunction(); // GETWORKSPACE
         retval[187] = new NotImplementedFunction(); // GETWINDOW
@@ -282,8 +282,8 @@
         retval[209] = new Rightb(); // RIGHTB
         retval[210] = new Midb(); // MIDB
         retval[211] = new Lenb(); // LENB
-        retval[212] = new Roundup(); // ROUNDUP
-        retval[213] = new Rounddown(); // ROUNDDOWN
+        retval[212] = NumericFunction.ROUNDUP;
+        retval[213] = NumericFunction.ROUNDDOWN;
         retval[214] = new Asc(); // ASC
         retval[215] = new Dbcs(); // DBCS
         retval[216] = new Rank(); // RANK
@@ -293,12 +293,12 @@
         retval[222] = new Vdb(); // VDB
         retval[227] = new Median(); // MEDIAN
         retval[228] = new Sumproduct(); // SUMPRODUCT
-        retval[229] = NumericFunctionOneArg.SINH;
-        retval[230] = NumericFunctionOneArg.COSH;
-        retval[231] = NumericFunctionOneArg.TANH;
-        retval[232] = NumericFunctionOneArg.ASINH;
-        retval[233] = NumericFunctionOneArg.ACOSH;
-        retval[234] = NumericFunctionOneArg.ATANH;
+        retval[229] = NumericFunction.SINH;
+        retval[230] = NumericFunction.COSH;
+        retval[231] = NumericFunction.TANH;
+        retval[232] = NumericFunction.ASINH;
+        retval[233] = NumericFunction.ACOSH;
+        retval[234] = NumericFunction.ATANH;
         retval[235] = new Dget(); // DGET
         retval[236] = new NotImplementedFunction(); // CREATEOBJECT
         retval[237] = new Volatile(); // VOLATILE
@@ -338,7 +338,7 @@
         retval[273] = new Binomdist(); // BINOMDIST
         retval[274] = new Chidist(); // CHIDIST
         retval[275] = new Chiinv(); // CHIINV
-        retval[276] = new Combin(); // COMBIN
+        retval[276] = NumericFunction.COMBIN;
         retval[277] = new Confidence(); // CONFIDENCE
         retval[278] = new Critbinom(); // CRITBINOM
         retval[279] = new Even(); // EVEN
@@ -347,10 +347,10 @@
         retval[282] = new Finv(); // FINV
         retval[283] = new Fisher(); // FISHER
         retval[284] = new Fisherinv(); // FISHERINV
-        retval[285] = new Floor(); // FLOOR
+        retval[285] = NumericFunction.FLOOR;
         retval[286] = new Gammadist(); // GAMMADIST
         retval[287] = new Gammainv(); // GAMMAINV
-        retval[288] = new Ceiling(); // CEILING
+        retval[288] = NumericFunction.CEILING;
         retval[289] = new Hypgeomdist(); // HYPGEOMDIST
         retval[290] = new Lognormdist(); // LOGNORMDIST
         retval[291] = new Loginv(); // LOGINV
@@ -398,13 +398,13 @@
         retval[334] = new NotImplementedFunction(); // MOVIECOMMAND
         retval[335] = new NotImplementedFunction(); // GETMOVIE
         retval[336] = new Concatenate(); // CONCATENATE
-        retval[337] = new Power(); // POWER
+        retval[337] = NumericFunction.POWER;
         retval[338] = new NotImplementedFunction(); // PIVOTADDDATA
         retval[339] = new NotImplementedFunction(); // GETPIVOTTABLE
         retval[340] = new NotImplementedFunction(); // GETPIVOTFIELD
         retval[341] = new NotImplementedFunction(); // GETPIVOTITEM
-        retval[342] = NumericFunctionOneArg.RADIANS;
-        retval[343] = NumericFunctionOneArg.DEGREES;
+        retval[342] = NumericFunction.RADIANS;
+        retval[343] = NumericFunction.DEGREES;
         retval[344] = new Subtotal(); // SUBTOTAL
         retval[345] = new Sumif(); // SUMIF
         retval[346] = new Countif(); // COUNTIF

Copied: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/DateFunc.java (from r693935, poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Date.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/DateFunc.java?p2=poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/DateFunc.java&p1=poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Date.java&r1=693935&r2=693939&rev=693939&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Date.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/DateFunc.java Wed Sep 10 12:23:43 2008
@@ -1,84 +1,71 @@
-/*
-* 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.
-*/
+/* ====================================================================
+   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.hssf.record.formula.functions;
 
 import java.util.Calendar;
 import java.util.GregorianCalendar;
 
-import org.apache.poi.hssf.usermodel.HSSFDateUtil;
-
-import org.apache.poi.hssf.record.formula.eval.Eval;
-import org.apache.poi.hssf.record.formula.eval.RefEval;
-import org.apache.poi.hssf.record.formula.eval.BlankEval;
 import org.apache.poi.hssf.record.formula.eval.ErrorEval;
-import org.apache.poi.hssf.record.formula.eval.ValueEval;
-import org.apache.poi.hssf.record.formula.eval.NumberEval;
-import org.apache.poi.hssf.record.formula.eval.NumericValueEval;
+import org.apache.poi.hssf.record.formula.eval.EvaluationException;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
 
 /**
  * @author Pavel Krupets (pkrupets at palmtreebusiness dot com)
  */
-public class Date extends NumericFunction {
-    /**
-     * @see org.apache.poi.hssf.record.formula.functions.Function#evaluate(org.apache.poi.hssf.record.formula.eval.Eval[], int, short)
-     */
-    public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {
-        if (operands.length == 3) {
-            ValueEval ve[] = new ValueEval[3];
-            
-            ve[0] = singleOperandEvaluate(operands[0], srcCellRow, srcCellCol);
-            ve[1] = singleOperandEvaluate(operands[1], srcCellRow, srcCellCol);
-            ve[2] = singleOperandEvaluate(operands[2], srcCellRow, srcCellCol);
-            
-            if (validValues(ve)) {
-                int year = getYear(ve[0]);
-                int month = (int) ((NumericValueEval) ve[1]).getNumberValue() - 1;
-                int day = (int) ((NumericValueEval) ve[2]).getNumberValue();
-                
-                if (year < 0 || month < 0 || day < 0) {
-                    return ErrorEval.VALUE_INVALID;
-                }
-                
-                if (year == 1900 && month == Calendar.FEBRUARY && day == 29) {
-                    return new NumberEval(60.0);
-                }
-                
-                if (year == 1900) {
-                    if ((month == Calendar.JANUARY && day >= 60) ||
-                        (month == Calendar.FEBRUARY && day >= 30))
-                    {
-                        day--;
-                    }
-                }
-                
-                Calendar c = new GregorianCalendar();
-                
-                c.set(year, month, day, 0, 0, 0);
-                c.set(Calendar.MILLISECOND, 0);
-                
-                return new NumberEval(HSSFDateUtil.getExcelDate(c.getTime(), false)); // XXX fix 1900/1904 problem
+public final class DateFunc extends NumericFunction.MultiArg {
+	
+	public static final Function instance = new DateFunc();
+	
+	private DateFunc() {
+		super(3,3);
+	}
+	
+	protected double evaluate(double[] ds) throws EvaluationException {
+		int year = getYear(ds[0]);
+        int month = (int) ds[1] - 1;
+        int day = (int) ds[2];
+        
+        if (year < 0 || month < 0 || day < 0) {
+            throw new EvaluationException(ErrorEval.VALUE_INVALID);
+        }
+        
+        if (year == 1900 && month == Calendar.FEBRUARY && day == 29) {
+            return 60.0;
+        }
+        
+        if (year == 1900) {
+            if ((month == Calendar.JANUARY && day >= 60) ||
+                (month == Calendar.FEBRUARY && day >= 30))
+            {
+                day--;
             }
         }
         
-        return ErrorEval.VALUE_INVALID;
-    }
+        Calendar c = new GregorianCalendar();
+        
+        c.set(year, month, day, 0, 0, 0);
+        c.set(Calendar.MILLISECOND, 0);
+        
+        return HSSFDateUtil.getExcelDate(c.getTime(), false); // XXX fix 1900/1904 problem
+     }
     
-    private int getYear(ValueEval ve) {
-        int year = (int) ((NumericValueEval) ve).getNumberValue();
+    private static int getYear(double d) {
+        int year = (int)d;
         
         if (year < 0) {
             return -1;
@@ -86,29 +73,4 @@
         
         return year < 1900 ? 1900 + year : year;
     }
-    
-    private boolean validValues(ValueEval[] values) {
-        for (int i = 0; i < values.length; i++) {
-            ValueEval value =  values[i];
-            
-            if (value instanceof RefEval) {
-                RefEval re = (RefEval) value;
-                ValueEval ive = re.getInnerValueEval();
-                
-                if (ive instanceof BlankEval) {
-                    value = new NumberEval(0);
-                } else if (ive instanceof NumericValueEval) {
-                    value = ive;
-                } else {
-                    return false;
-                }
-            }
-            
-            if (!(value instanceof NumericValueEval)) {
-                return false;
-            }
-        }
-        
-        return true;
-    }
 }

Propchange: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/DateFunc.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/DateFunc.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/DateFunc.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Even.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Even.java?rev=693939&r1=693938&r2=693939&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Even.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Even.java Wed Sep 10 12:23:43 2008
@@ -22,7 +22,7 @@
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
  *  
  */
-public final class Even extends NumericFunctionOneArg {
+public final class Even extends NumericFunction.OneArg {
 
 	private static final long PARITY_MASK = 0xFFFFFFFFFFFFFFFEL;
 

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Odd.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Odd.java?rev=693939&r1=693938&r2=693939&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Odd.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Odd.java Wed Sep 10 12:23:43 2008
@@ -22,7 +22,7 @@
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
  *  
  */
-public final class Odd extends NumericFunctionOneArg {
+public final class Odd extends NumericFunction.OneArg {
 	private static final long PARITY_MASK = 0xFFFFFFFFFFFFFFFEL;
     
 	protected double evaluate(double d) {

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls?rev=693939&r1=693938&r2=693939&view=diff
==============================================================================
Binary files - no diff available.

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestCountFuncs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestCountFuncs.java?rev=693939&r1=693938&r2=693939&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestCountFuncs.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestCountFuncs.java Wed Sep 10 12:23:43 2008
@@ -21,13 +21,11 @@
 import junit.framework.TestCase;
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
-import org.apache.poi.hssf.record.formula.RefPtg;
 import org.apache.poi.hssf.record.formula.eval.AreaEval;
 import org.apache.poi.hssf.record.formula.eval.BlankEval;
 import org.apache.poi.hssf.record.formula.eval.BoolEval;
 import org.apache.poi.hssf.record.formula.eval.Eval;
 import org.apache.poi.hssf.record.formula.eval.NumberEval;
-import org.apache.poi.hssf.record.formula.eval.Ref2DEval;
 import org.apache.poi.hssf.record.formula.eval.StringEval;
 import org.apache.poi.hssf.record.formula.eval.ValueEval;
 import org.apache.poi.hssf.record.formula.functions.CountUtils.I_MatchPredicate;

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestRoundFuncs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestRoundFuncs.java?rev=693939&r1=693938&r2=693939&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestRoundFuncs.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestRoundFuncs.java Wed Sep 10 12:23:43 2008
@@ -17,24 +17,25 @@
 
 package org.apache.poi.hssf.record.formula.functions;
 
+import junit.framework.TestCase;
+
 import org.apache.poi.hssf.record.formula.eval.ErrorEval;
 import org.apache.poi.hssf.record.formula.eval.Eval;
 import org.apache.poi.hssf.record.formula.eval.NumberEval;
 import org.apache.poi.hssf.record.formula.eval.StringEval;
 
-import junit.framework.TestCase;
-
 /**
  * Test cases for ROUND(), ROUNDUP(), ROUNDDOWN()
  * 
  * @author Josh Micich
  */
 public final class TestRoundFuncs extends TestCase {
+	private static final NumericFunction F = null;
 	public void testRounddownWithStringArg() {
 		
 		Eval strArg = new StringEval("abc");
 		Eval[] args = { strArg, new NumberEval(2), };
-		Eval result = new Rounddown().evaluate(args, -1, (short)-1);
+		Eval result = F.ROUNDDOWN.evaluate(args, -1, (short)-1);
 		assertEquals(ErrorEval.VALUE_INVALID, result);
 	}
 	
@@ -42,7 +43,7 @@
 		
 		Eval strArg = new StringEval("abc");
 		Eval[] args = { strArg, new NumberEval(2), };
-		Eval result = new Roundup().evaluate(args, -1, (short)-1);
+		Eval result = F.ROUNDUP.evaluate(args, -1, (short)-1);
 		assertEquals(ErrorEval.VALUE_INVALID, result);
 	}
 	



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org