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 2009/08/18 00:34:23 UTC
svn commit: r805192 - in /poi/trunk/src:
java/org/apache/poi/hssf/record/formula/atp/
java/org/apache/poi/hssf/record/formula/eval/
java/org/apache/poi/hssf/record/formula/functions/
testcases/org/apache/poi/hssf/record/formula/functions/
Author: josh
Date: Mon Aug 17 22:34:22 2009
New Revision: 805192
URL: http://svn.apache.org/viewvc?rev=805192&view=rev
Log:
Removed obsolete Eval interface
Removed:
poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/Eval.java
Modified:
poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/ParityFunction.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/YearFrac.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/OperandResolver.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/RangeEval.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/TwoOperandNumericOperation.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/UserDefinedFunction.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/ValueEval.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/BooleanFunction.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Columns.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Count.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/CountUtils.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Counta.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Countif.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Find.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Hlookup.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Index.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/IsNa.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isref.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Match.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Mode.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Offset.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Replace.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Rows.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Time.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/NumericFunctionInvoker.java
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/ParityFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/ParityFunction.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/ParityFunction.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/ParityFunction.java Mon Aug 17 22:34:22 2009
@@ -19,7 +19,7 @@
import org.apache.poi.hssf.record.formula.eval.BoolEval;
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.ValueEval;
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
@@ -56,7 +56,7 @@
return BoolEval.valueOf(val == _desiredParity);
}
- private static int evaluateArgParity(Eval arg, int srcCellRow, int srcCellCol) throws EvaluationException {
+ private static int evaluateArgParity(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(arg, srcCellRow, (short)srcCellCol);
double d = OperandResolver.coerceValueToDouble(ve);
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/YearFrac.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/YearFrac.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/YearFrac.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/YearFrac.java Mon Aug 17 22:34:22 2009
@@ -22,7 +22,7 @@
import java.util.regex.Pattern;
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.ValueEval;
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.NumberEval;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
@@ -83,7 +83,7 @@
return new NumberEval(result);
}
- private static double evaluateDateArg(Eval arg, int srcCellRow, int srcCellCol) throws EvaluationException {
+ private static double evaluateDateArg(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(arg, srcCellRow, (short) srcCellCol);
if (ve instanceof StringEval) {
@@ -153,7 +153,7 @@
return cal;
}
- private static int evaluateIntArg(Eval arg, int srcCellRow, int srcCellCol) throws EvaluationException {
+ private static int evaluateIntArg(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(arg, srcCellRow, (short) srcCellCol);
return OperandResolver.coerceValueToInt(ve);
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/OperandResolver.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/OperandResolver.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/OperandResolver.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/OperandResolver.java Mon Aug 17 22:34:22 2009
@@ -19,7 +19,7 @@
/**
* Provides functionality for evaluating arguments to functions and operators.
- *
+ *
* @author Josh Micich
*/
public final class OperandResolver {
@@ -37,12 +37,12 @@
* @return a <tt>NumberEval</tt>, <tt>StringEval</tt>, <tt>BoolEval</tt> or <tt>BlankEval</tt>.
* Never <code>null</code> or <tt>ErrorEval</tt>.
* @throws EvaluationException(#VALUE!) if srcCellRow or srcCellCol do not properly index into
- * an AreaEval. If the actual value retrieved is an ErrorEval, a corresponding
+ * an AreaEval. If the actual value retrieved is an ErrorEval, a corresponding
* EvaluationException is thrown.
*/
- public static ValueEval getSingleValue(Eval arg, int srcCellRow, short srcCellCol)
+ public static ValueEval getSingleValue(ValueEval arg, int srcCellRow, short srcCellCol)
throws EvaluationException {
- Eval result;
+ ValueEval result;
if (arg instanceof RefEval) {
result = ((RefEval) arg).getInnerValueEval();
} else if (arg instanceof AreaEval) {
@@ -63,7 +63,7 @@
* Implements (some perhaps not well known) Excel functionality to select a single cell from an
* area depending on the coordinates of the calling cell. Here is an example demonstrating
* both selection from a single row area and a single column area in the same formula.
- *
+ *
* <table border="1" cellpadding="1" cellspacing="1" summary="sample spreadsheet">
* <tr><th> </th><th> A </th><th> B </th><th> C </th><th> D </th></tr>
* <tr><th>1</th><td>15</td><td>20</td><td>25</td><td> </td></tr>
@@ -71,10 +71,10 @@
* <tr><th>3</th><td> </td><td> </td><td> </td><td>300</td></tr>
* <tr><th>3</th><td> </td><td> </td><td> </td><td>400</td></tr>
* </table>
- *
+ *
* If the formula "=1000+A1:B1+D2:D3" is put into the 9 cells from A2 to C4, the spreadsheet
* will look like this:
- *
+ *
* <table border="1" cellpadding="1" cellspacing="1" summary="sample spreadsheet">
* <tr><th> </th><th> A </th><th> B </th><th> C </th><th> D </th></tr>
* <tr><th>1</th><td>15</td><td>20</td><td>25</td><td> </td></tr>
@@ -82,28 +82,28 @@
* <tr><th>3</th><td>1315</td><td>1320</td><td>#VALUE!</td><td>300</td></tr>
* <tr><th>4</th><td>#VALUE!</td><td>#VALUE!</td><td>#VALUE!</td><td>400</td></tr>
* </table>
- *
- * Note that the row area (A1:B1) does not include column C and the column area (D2:D3) does
+ *
+ * Note that the row area (A1:B1) does not include column C and the column area (D2:D3) does
* not include row 4, so the values in C1(=25) and D4(=400) are not accessible to the formula
* as written, but in the 4 cells A2:B3, the row and column selection works ok.<p/>
- *
- * The same concept is extended to references across sheets, such that even multi-row,
+ *
+ * The same concept is extended to references across sheets, such that even multi-row,
* multi-column areas can be useful.<p/>
- *
+ *
* Of course with carefully (or carelessly) chosen parameters, cyclic references can occur and
- * hence this method <b>can</b> throw a 'circular reference' EvaluationException. Note that
+ * hence this method <b>can</b> throw a 'circular reference' EvaluationException. Note that
* this method does not attempt to detect cycles. Every cell in the specified Area <tt>ae</tt>
- * has already been evaluated prior to this method call. Any cell (or cell<b>s</b>) part of
- * <tt>ae</tt> that would incur a cyclic reference error if selected by this method, will
+ * has already been evaluated prior to this method call. Any cell (or cell<b>s</b>) part of
+ * <tt>ae</tt> that would incur a cyclic reference error if selected by this method, will
* already have the value <t>ErrorEval.CIRCULAR_REF_ERROR</tt> upon entry to this method. It
* is assumed logic exists elsewhere to produce this behaviour.
- *
+ *
* @return whatever the selected cell's evaluated value is. Never <code>null</code>. Never
* <tt>ErrorEval</tt>.
* @throws EvaluationException if there is a problem with indexing into the area, or if the
* evaluated cell has an error.
*/
- public static ValueEval chooseSingleElementFromArea(AreaEval ae,
+ public static ValueEval chooseSingleElementFromArea(AreaEval ae,
int srcCellRow, short srcCellCol) throws EvaluationException {
ValueEval result = chooseSingleElementFromAreaInternal(ae, srcCellRow, srcCellCol);
if(result == null) {
@@ -119,9 +119,9 @@
}
/**
- * @return possibly <tt>ErrorEval</tt>, and <code>null</code>
+ * @return possibly <tt>ErrorEval</tt>, and <code>null</code>
*/
- private static ValueEval chooseSingleElementFromAreaInternal(AreaEval ae,
+ private static ValueEval chooseSingleElementFromAreaInternal(AreaEval ae,
int srcCellRow, short srcCellCol) throws EvaluationException {
if(false) {
@@ -140,10 +140,10 @@
Another reason there's little value in attempting to detect circular references here is
that only direct circular references could be detected. If the cycle involved two or more
- cells this method could not detect it.
+ cells this method could not detect it.
Logic to detect evaluation cycles of all kinds has been coded in EvaluationCycleDetector
- (and HSSFFormulaEvaluator).
+ (and HSSFFormulaEvaluator).
*/
}
@@ -172,14 +172,14 @@
/**
* Applies some conversion rules if the supplied value is not already an integer.<br/>
* Value is first coerced to a <tt>double</tt> ( See <tt>coerceValueToDouble()</tt> ).
- * Note - <tt>BlankEval</tt> is converted to <code>0</code>.<p/>
- *
+ * Note - <tt>BlankEval</tt> is converted to <code>0</code>.<p/>
+ *
* Excel typically converts doubles to integers by truncating toward negative infinity.<br/>
* The equivalent java code is:<br/>
* <code>return (int)Math.floor(d);</code><br/>
* <b>not</b>:<br/>
- * <code>return (int)d; // wrong - rounds toward zero</code>
- *
+ * <code>return (int)d; // wrong - rounds toward zero</code>
+ *
*/
public static int coerceValueToInt(ValueEval ev) throws EvaluationException {
if (ev == BlankEval.INSTANCE) {
@@ -193,13 +193,13 @@
/**
* Applies some conversion rules if the supplied value is not already a number.
- * Note - <tt>BlankEval</tt> is converted to {@link NumberEval#ZERO}.
- * @param ev must be a {@link NumberEval}, {@link StringEval}, {@link BoolEval} or
+ * Note - <tt>BlankEval</tt> is converted to {@link NumberEval#ZERO}.
+ * @param ev must be a {@link NumberEval}, {@link StringEval}, {@link BoolEval} or
* {@link BlankEval}
* @return actual, parsed or interpreted double value (respectively).
* @throws EvaluationException(#VALUE!) only if a StringEval is supplied and cannot be parsed
* as a double (See <tt>parseDouble()</tt> for allowable formats).
- * @throws RuntimeException if the supplied parameter is not {@link NumberEval},
+ * @throws RuntimeException if the supplied parameter is not {@link NumberEval},
* {@link StringEval}, {@link BoolEval} or {@link BlankEval}
*/
public static double coerceValueToDouble(ValueEval ev) throws EvaluationException {
@@ -224,8 +224,8 @@
/**
* Converts a string to a double using standard rules that Excel would use.<br/>
* Tolerates currency prefixes, commas, leading and trailing spaces.<p/>
- *
- * Some examples:<br/>
+ *
+ * Some examples:<br/>
* " 123 " -> 123.0<br/>
* ".123" -> 0.123<br/>
* These not supported yet:<br/>
@@ -233,8 +233,7 @@
* "$1.25E4" -> 12500.0<br/>
* "5**2" -> 500<br/>
* "250%" -> 2.5<br/>
- *
- * @param pText
+ *
* @return <code>null</code> if the specified text cannot be parsed as a number
*/
public static Double parseDouble(String pText) {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/RangeEval.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/RangeEval.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/RangeEval.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/RangeEval.java Mon Aug 17 22:34:22 2009
@@ -60,7 +60,7 @@
return aeA.offset(top-aeAfr, bottom-aeAfr, left-aeAfc, right-aeAfc);
}
- private static AreaEval evaluateRef(Eval arg) throws EvaluationException {
+ private static AreaEval evaluateRef(ValueEval arg) throws EvaluationException {
if (arg instanceof AreaEval) {
return (AreaEval) arg;
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/TwoOperandNumericOperation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/TwoOperandNumericOperation.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/TwoOperandNumericOperation.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/TwoOperandNumericOperation.java Mon Aug 17 22:34:22 2009
@@ -22,7 +22,7 @@
*/
abstract class TwoOperandNumericOperation implements OperationEval {
- protected final double singleOperandEvaluate(Eval arg, int srcCellRow, short srcCellCol) throws EvaluationException {
+ protected final double singleOperandEvaluate(ValueEval arg, int srcCellRow, short srcCellCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
return OperandResolver.coerceValueToDouble(ve);
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/UserDefinedFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/UserDefinedFunction.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/UserDefinedFunction.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/UserDefinedFunction.java Mon Aug 17 22:34:22 2009
@@ -44,7 +44,7 @@
throw new RuntimeException("function name argument missing");
}
- Eval nameArg = args[0];
+ ValueEval nameArg = args[0];
FreeRefFunction targetFunc;
if (nameArg instanceof NameEval) {
targetFunc = findInternalUserDefinedFunction((NameEval) nameArg);
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/ValueEval.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/ValueEval.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/ValueEval.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/ValueEval.java Mon Aug 17 22:34:22 2009
@@ -1,29 +1,25 @@
-/*
-* 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.
-*/
-/*
- * Created on May 8, 2005
- *
- */
+/* ====================================================================
+ 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;
/**
* @author Amol S. Deshmukh < amolweb at ya hoo dot com >
- *
*/
-public interface ValueEval extends Eval {
-
+public interface ValueEval {
+ // no methods
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/BooleanFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/BooleanFunction.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/BooleanFunction.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/BooleanFunction.java Mon Aug 17 22:34:22 2009
@@ -20,11 +20,10 @@
import org.apache.poi.hssf.record.formula.eval.AreaEval;
import org.apache.poi.hssf.record.formula.eval.BoolEval;
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.ValueEval;
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
import org.apache.poi.hssf.record.formula.eval.RefEval;
-import org.apache.poi.hssf.record.formula.eval.ValueEval;
/**
* Here are the general rules concerning Boolean functions:
@@ -52,7 +51,7 @@
return BoolEval.valueOf(boolResult);
}
- private boolean calculate(Eval[] args) throws EvaluationException {
+ private boolean calculate(ValueEval[] args) throws EvaluationException {
boolean result = getInitialResultValue();
boolean atleastOneNonBlank = false;
@@ -61,7 +60,7 @@
* Note: no short-circuit boolean loop exit because any ErrorEvals will override the result
*/
for (int i=0, iSize=args.length; i<iSize; i++) {
- Eval arg = args[i];
+ ValueEval arg = args[i];
if (arg instanceof AreaEval) {
AreaEval ae = (AreaEval) arg;
int height = ae.getHeight();
@@ -82,11 +81,8 @@
if (arg instanceof RefEval) {
ValueEval ve = ((RefEval) arg).getInnerValueEval();
tempVe = OperandResolver.coerceValueToBoolean(ve, true);
- } else if (arg instanceof ValueEval) {
- ValueEval ve = (ValueEval) arg;
- tempVe = OperandResolver.coerceValueToBoolean(ve, false);
} else {
- throw new RuntimeException("Unexpected eval (" + arg.getClass().getName() + ")");
+ tempVe = OperandResolver.coerceValueToBoolean(arg, false);
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Columns.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Columns.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Columns.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Columns.java Mon Aug 17 22:34:22 2009
@@ -19,7 +19,6 @@
import org.apache.poi.hssf.record.formula.eval.AreaEval;
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.RefEval;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
@@ -43,7 +42,7 @@
// too many arguments
return ErrorEval.VALUE_INVALID;
}
- Eval firstArg = args[0];
+ ValueEval firstArg = args[0];
int result;
if (firstArg instanceof AreaEval) {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Count.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Count.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Count.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Count.java Mon Aug 17 22:34:22 2009
@@ -18,7 +18,6 @@
package org.apache.poi.hssf.record.formula.functions;
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.MissingArgEval;
import org.apache.poi.hssf.record.formula.eval.NumberEval;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
@@ -60,7 +59,7 @@
private static final I_MatchPredicate predicate = new I_MatchPredicate() {
- public boolean matches(Eval valueEval) {
+ public boolean matches(ValueEval valueEval) {
if(valueEval instanceof NumberEval) {
// only numbers are counted
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/CountUtils.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/CountUtils.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/CountUtils.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/CountUtils.java Mon Aug 17 22:34:22 2009
@@ -18,7 +18,6 @@
package org.apache.poi.hssf.record.formula.functions;
import org.apache.poi.hssf.record.formula.eval.AreaEval;
-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.ValueEval;
@@ -37,7 +36,7 @@
* Common interface for the matching criteria.
*/
public interface I_MatchPredicate {
- boolean matches(Eval x);
+ boolean matches(ValueEval x);
}
/**
* @return the number of evaluated cells in the range that match the specified criteria
@@ -66,7 +65,7 @@
}
return 0;
}
- public static int countArg(Eval eval, I_MatchPredicate criteriaPredicate) {
+ public static int countArg(ValueEval eval, I_MatchPredicate criteriaPredicate) {
if (eval == null) {
throw new IllegalArgumentException("eval must not be null");
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Counta.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Counta.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Counta.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Counta.java Mon Aug 17 22:34:22 2009
@@ -19,7 +19,6 @@
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.Eval;
import org.apache.poi.hssf.record.formula.eval.NumberEval;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
import org.apache.poi.hssf.record.formula.functions.CountUtils.I_MatchPredicate;
@@ -58,7 +57,7 @@
private static final I_MatchPredicate predicate = new I_MatchPredicate() {
- public boolean matches(Eval valueEval) {
+ public boolean matches(ValueEval valueEval) {
// Note - observed behavior of Excel:
// Error values like #VALUE!, #REF!, #DIV/0!, #NAME? etc don't cause this COUNTA to return an error
// in fact, they seem to get counted
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Countif.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Countif.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Countif.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Countif.java Mon Aug 17 22:34:22 2009
@@ -23,7 +23,6 @@
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.ErrorEval;
-import org.apache.poi.hssf.record.formula.eval.Eval;
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.NumberEval;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
@@ -190,7 +189,7 @@
return String.valueOf(_value);
}
- public boolean matches(Eval x) {
+ public boolean matches(ValueEval x) {
double testValue;
if(x instanceof StringEval) {
// if the target(x) is a string, but parses as a number
@@ -241,7 +240,7 @@
return value ? 1 : 0;
}
- public boolean matches(Eval x) {
+ public boolean matches(ValueEval x) {
int testValue;
if(x instanceof StringEval) {
if (true) { // change to false to observe more intuitive behaviour
@@ -278,7 +277,7 @@
return ErrorConstants.getText(_value);
}
- public boolean matches(Eval x) {
+ public boolean matches(ValueEval x) {
if(x instanceof ErrorEval) {
int testValue = ((ErrorEval)x).getErrorCode();
return evaluate(testValue - _value);
@@ -313,7 +312,7 @@
return _pattern.pattern();
}
- public boolean matches(Eval x) {
+ public boolean matches(ValueEval x) {
if (x instanceof BlankEval) {
switch(getCode()) {
case CmpOp.NONE:
@@ -423,7 +422,7 @@
/**
* @return the number of evaluated cells in the range that match the specified criteria
*/
- private double countMatchingCellsInArea(Eval rangeArg, I_MatchPredicate criteriaPredicate) {
+ private double countMatchingCellsInArea(ValueEval rangeArg, I_MatchPredicate criteriaPredicate) {
if (rangeArg instanceof RefEval) {
return CountUtils.countMatchingCell((RefEval) rangeArg, criteriaPredicate);
@@ -438,9 +437,9 @@
* Creates a criteria predicate object for the supplied criteria arg
* @return <code>null</code> if the arg evaluates to blank.
*/
- /* package */ static I_MatchPredicate createCriteriaPredicate(Eval arg, int srcRowIndex, int srcColumnIndex) {
+ /* package */ static I_MatchPredicate createCriteriaPredicate(ValueEval arg, int srcRowIndex, int srcColumnIndex) {
- Eval evaluatedCriteriaArg = evaluateCriteriaArg(arg, srcRowIndex, srcColumnIndex);
+ ValueEval evaluatedCriteriaArg = evaluateCriteriaArg(arg, srcRowIndex, srcColumnIndex);
if(evaluatedCriteriaArg instanceof NumberEval) {
return new NumberMatcher(((NumberEval)evaluatedCriteriaArg).getNumberValue(), CmpOp.OP_NONE);
@@ -466,7 +465,7 @@
*
* @return the de-referenced criteria arg (possibly {@link ErrorEval})
*/
- private static Eval evaluateCriteriaArg(Eval arg, int srcRowIndex, int srcColumnIndex) {
+ private static ValueEval evaluateCriteriaArg(ValueEval arg, int srcRowIndex, int srcColumnIndex) {
try {
return OperandResolver.getSingleValue(arg, srcRowIndex, (short)srcColumnIndex);
} catch (EvaluationException e) {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Find.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Find.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Find.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Find.java Mon Aug 17 22:34:22 2009
@@ -17,11 +17,10 @@
package org.apache.poi.hssf.record.formula.functions;
-import org.apache.poi.hssf.record.formula.eval.Eval;
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.EvaluationException;
+import org.apache.poi.hssf.record.formula.eval.NumberEval;
+import org.apache.poi.hssf.record.formula.eval.ValueEval;
/**
* Implementation of the FIND() function.<p/>
@@ -37,7 +36,7 @@
*/
public final class Find extends TextFunction {
- protected ValueEval evaluateFunc(Eval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
throws EvaluationException {
int nArgs = args.length;
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Hlookup.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Hlookup.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Hlookup.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Hlookup.java Mon Aug 17 22:34:22 2009
@@ -19,7 +19,6 @@
import org.apache.poi.hssf.record.formula.eval.AreaEval;
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.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
@@ -43,7 +42,7 @@
public final class Hlookup implements Function {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
- Eval arg3 = null;
+ ValueEval arg3 = null;
switch(args.length) {
case 4:
arg3 = args[3]; // important: assumed array element is never null
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Index.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Index.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Index.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Index.java Mon Aug 17 22:34:22 2009
@@ -20,7 +20,6 @@
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.ErrorEval;
-import org.apache.poi.hssf.record.formula.eval.Eval;
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.MissingArgEval;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
@@ -53,7 +52,7 @@
// too few arguments
return ErrorEval.VALUE_INVALID;
}
- Eval firstArg = args[0];
+ ValueEval firstArg = args[0];
if (firstArg instanceof RefEval) {
// convert to area ref for simpler code in getValueFromArea()
firstArg = ((RefEval)firstArg).offset(0, 0, 0, 0);
@@ -180,7 +179,7 @@
* @return the resolved 1-based index. Zero if the arg was missing or blank
* @throws EvaluationException if the arg is an error value evaluates to a negative numeric value
*/
- private static int resolveIndexArg(Eval arg, int srcCellRow, short srcCellCol) throws EvaluationException {
+ private static int resolveIndexArg(ValueEval arg, int srcCellRow, short srcCellCol) throws EvaluationException {
ValueEval ev = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
if (ev == MissingArgEval.instance) {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/IsNa.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/IsNa.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/IsNa.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/IsNa.java Mon Aug 17 22:34:22 2009
@@ -19,7 +19,6 @@
import org.apache.poi.hssf.record.formula.eval.BoolEval;
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.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
@@ -43,7 +42,7 @@
if(args.length != 1) {
return ErrorEval.VALUE_INVALID;
}
- Eval arg = args[0];
+ ValueEval arg = args[0];
try {
OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java Mon Aug 17 22:34:22 2009
@@ -20,7 +20,6 @@
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.ErrorEval;
-import org.apache.poi.hssf.record.formula.eval.Eval;
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
@@ -35,7 +34,7 @@
if(args.length != 1) {
return ErrorEval.VALUE_INVALID;
}
- Eval arg = args[0];
+ ValueEval arg = args[0];
ValueEval singleCellValue;
try {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isref.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isref.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isref.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isref.java Mon Aug 17 22:34:22 2009
@@ -20,7 +20,6 @@
import org.apache.poi.hssf.record.formula.eval.AreaEval;
import org.apache.poi.hssf.record.formula.eval.BoolEval;
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.RefEval;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
@@ -33,7 +32,7 @@
return ErrorEval.VALUE_INVALID;
}
- Eval eval = operands[0];
+ ValueEval eval = operands[0];
if (eval instanceof RefEval || eval instanceof AreaEval) {
return BoolEval.TRUE;
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java Mon Aug 17 22:34:22 2009
@@ -21,7 +21,6 @@
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.ErrorEval;
-import org.apache.poi.hssf.record.formula.eval.Eval;
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.NumberEval;
import org.apache.poi.hssf.record.formula.eval.NumericValueEval;
@@ -323,7 +322,7 @@
* @return column or row index as a zero-based value, never negative.
* @throws EvaluationException when the specified arg cannot be coerced to a non-negative integer
*/
- public static int resolveRowOrColIndexArg(Eval rowColIndexArg, int srcCellRow, int srcCellCol) throws EvaluationException {
+ public static int resolveRowOrColIndexArg(ValueEval rowColIndexArg, int srcCellRow, int srcCellCol) throws EvaluationException {
if(rowColIndexArg == null) {
throw new IllegalArgumentException("argument must not be null");
}
@@ -362,7 +361,7 @@
* The second argument (table_array) should be an area ref, but can actually be a cell ref, in
* which case it is interpreted as a 1x1 area ref. Other scalar values cause #VALUE! error.
*/
- public static AreaEval resolveTableArrayArg(Eval eval) throws EvaluationException {
+ public static AreaEval resolveTableArrayArg(ValueEval eval) throws EvaluationException {
if (eval instanceof AreaEval) {
return (AreaEval) eval;
}
@@ -386,7 +385,7 @@
* @return
* @throws EvaluationException
*/
- public static boolean resolveRangeLookupArg(Eval rangeLookupArg, int srcCellRow, short srcCellCol) throws EvaluationException {
+ public static boolean resolveRangeLookupArg(ValueEval rangeLookupArg, int srcCellRow, short srcCellCol) throws EvaluationException {
if(rangeLookupArg == null) {
// range_lookup arg not provided
return true; // default is TRUE
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Match.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Match.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Match.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Match.java Mon Aug 17 22:34:22 2009
@@ -19,7 +19,6 @@
import org.apache.poi.hssf.record.formula.eval.AreaEval;
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.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.NumberEval;
import org.apache.poi.hssf.record.formula.eval.NumericValueEval;
@@ -123,7 +122,7 @@
}
}
- private static ValueVector evaluateLookupRange(Eval eval) throws EvaluationException {
+ private static ValueVector evaluateLookupRange(ValueEval eval) throws EvaluationException {
if (eval instanceof RefEval) {
RefEval re = (RefEval) eval;
return new SingleValueVector(re.getInnerValueEval());
@@ -155,9 +154,9 @@
- private static double evaluateMatchTypeArg(Eval arg, int srcCellRow, short srcCellCol)
+ private static double evaluateMatchTypeArg(ValueEval arg, int srcCellRow, short srcCellCol)
throws EvaluationException {
- Eval match_type = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
+ ValueEval match_type = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
if(match_type instanceof ErrorEval) {
throw new EvaluationException((ErrorEval)match_type);
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Mode.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Mode.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Mode.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Mode.java Mon Aug 17 22:34:22 2009
@@ -25,7 +25,6 @@
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.ErrorEval;
-import org.apache.poi.hssf.record.formula.eval.Eval;
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.NumberEval;
import org.apache.poi.hssf.record.formula.eval.RefEval;
@@ -92,7 +91,7 @@
return new NumberEval(result);
}
- private static void collectValues(Eval arg, List<Double> temp) throws EvaluationException {
+ private static void collectValues(ValueEval arg, List<Double> temp) throws EvaluationException {
if (arg instanceof AreaEval) {
AreaEval ae = (AreaEval) arg;
int width = ae.getWidth();
@@ -114,7 +113,7 @@
}
- private static void collectValue(Eval arg, List<Double> temp, boolean mustBeNumber)
+ private static void collectValue(ValueEval arg, List<Double> temp, boolean mustBeNumber)
throws EvaluationException {
if (arg instanceof ErrorEval) {
throw new EvaluationException((ErrorEval) arg);
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java Mon Aug 17 22:34:22 2009
@@ -21,7 +21,6 @@
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.ErrorEval;
-import org.apache.poi.hssf.record.formula.eval.Eval;
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.NumberEval;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
@@ -118,7 +117,7 @@
*
* @return never <code>null</code>
*/
- protected final double[] getNumberArray(Eval[] operands) throws EvaluationException {
+ protected final double[] getNumberArray(ValueEval[] operands) throws EvaluationException {
if (operands.length > getMaxNumOperands()) {
throw EvaluationException.invalidValue();
}
@@ -133,7 +132,7 @@
/**
* Collects values from a single argument
*/
- private void collectValues(Eval operand, DoubleList temp) throws EvaluationException {
+ private void collectValues(ValueEval operand, DoubleList temp) throws EvaluationException {
if (operand instanceof AreaEval) {
AreaEval ae = (AreaEval) operand;
@@ -152,7 +151,7 @@
collectValue(re.getInnerValueEval(), true, temp);
return;
}
- collectValue((ValueEval)operand, false, temp);
+ collectValue(operand, false, temp);
}
private void collectValue(ValueEval ve, boolean isViaReference, DoubleList temp) throws EvaluationException {
if (ve == null) {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java Mon Aug 17 22:34:22 2009
@@ -18,7 +18,6 @@
package org.apache.poi.hssf.record.formula.functions;
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.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.NumberEval;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
@@ -33,7 +32,7 @@
static final double TEN = 10.0;
static final double LOG_10_TO_BASE_e = Math.log(TEN);
- protected static final double singleOperandEvaluate(Eval arg, int srcCellRow, short srcCellCol) throws EvaluationException {
+ protected static final double singleOperandEvaluate(ValueEval arg, int srcCellRow, short srcCellCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
double result = OperandResolver.coerceValueToDouble(ve);
checkValue(result);
@@ -57,7 +56,7 @@
return new NumberEval(result);
}
- protected abstract double eval(Eval[] args, int srcCellRow, short srcCellCol) throws EvaluationException;
+ protected abstract double eval(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException;
/* -------------------------------------------------------------------------- */
// intermediate sub-classes (one-arg, two-arg and multi-arg)
@@ -66,7 +65,7 @@
protected OneArg() {
// no fields to initialise
}
- protected final double eval(Eval[] args, int srcCellRow, short srcCellCol) throws EvaluationException {
+ protected final double eval(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException {
if (args.length != 1) {
throw new EvaluationException(ErrorEval.VALUE_INVALID);
}
@@ -80,7 +79,7 @@
protected TwoArg() {
// no fields to initialise
}
- protected final double eval(Eval[] args, int srcCellRow, short srcCellCol) throws EvaluationException {
+ protected final double eval(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException {
if (args.length != 2) {
throw new EvaluationException(ErrorEval.VALUE_INVALID);
}
@@ -98,7 +97,7 @@
_minArgs = minArgs;
_maxArgs = maxArgs;
}
- protected final double eval(Eval[] args, int srcCellRow, short srcCellCol) throws EvaluationException {
+ protected final double eval(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException {
int nArgs = args.length;
if (nArgs < _minArgs || nArgs > _maxArgs) {
throw new EvaluationException(ErrorEval.VALUE_INVALID);
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Offset.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Offset.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Offset.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Offset.java Mon Aug 17 22:34:22 2009
@@ -20,7 +20,6 @@
import org.apache.poi.hssf.record.formula.eval.AreaEval;
import org.apache.poi.hssf.record.formula.eval.BoolEval;
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.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.NumericValueEval;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
@@ -207,7 +206,7 @@
return baseRef.offset(orRow.getFirstIndex(), orRow.getLastIndex(), orCol.getFirstIndex(), orCol.getLastIndex());
}
- private static BaseRef evaluateBaseRef(Eval eval) throws EvaluationException {
+ private static BaseRef evaluateBaseRef(ValueEval eval) throws EvaluationException {
if(eval instanceof RefEval) {
return new BaseRef((RefEval)eval);
@@ -224,7 +223,7 @@
/**
* OFFSET's numeric arguments (2..5) have similar processing rules
*/
- private static int evaluateIntArg(Eval eval, int srcCellRow, short srcCellCol) throws EvaluationException {
+ private static int evaluateIntArg(ValueEval eval, int srcCellRow, short srcCellCol) throws EvaluationException {
double d = evaluateDoubleArg(eval, srcCellRow, srcCellCol);
return convertDoubleToInt(d);
@@ -240,7 +239,7 @@
return (int)Math.floor(d);
}
- private static double evaluateDoubleArg(Eval eval, int srcCellRow, short srcCellCol) throws EvaluationException {
+ private static double evaluateDoubleArg(ValueEval eval, int srcCellRow, short srcCellCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(eval, srcCellRow, srcCellCol);
if (ve instanceof NumericValueEval) {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Replace.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Replace.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Replace.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Replace.java Mon Aug 17 22:34:22 2009
@@ -18,7 +18,6 @@
package org.apache.poi.hssf.record.formula.functions;
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.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.StringEval;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
@@ -40,7 +39,7 @@
*/
public final class Replace extends TextFunction {
- protected ValueEval evaluateFunc(Eval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
throws EvaluationException {
if (args.length != 4) {
return ErrorEval.VALUE_INVALID;
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Rows.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Rows.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Rows.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Rows.java Mon Aug 17 22:34:22 2009
@@ -19,7 +19,6 @@
import org.apache.poi.hssf.record.formula.eval.AreaEval;
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.RefEval;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
@@ -43,7 +42,7 @@
// too many arguments
return ErrorEval.VALUE_INVALID;
}
- Eval firstArg = args[0];
+ ValueEval firstArg = args[0];
int result;
if (firstArg instanceof AreaEval) {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java Mon Aug 17 22:34:22 2009
@@ -18,7 +18,6 @@
package org.apache.poi.hssf.record.formula.functions;
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.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.StringEval;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
@@ -30,7 +29,7 @@
*/
public final class Substitute extends TextFunction {
- protected ValueEval evaluateFunc(Eval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
throws EvaluationException {
if (args.length < 3 || args.length > 4) {
return ErrorEval.VALUE_INVALID;
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java Mon Aug 17 22:34:22 2009
@@ -19,7 +19,6 @@
import org.apache.poi.hssf.record.formula.eval.AreaEval;
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.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.NumberEval;
import org.apache.poi.hssf.record.formula.eval.RefEval;
@@ -100,7 +99,7 @@
* @return a range of the same dimensions as aeRange using eval to define the top left corner.
* @throws EvaluationException if eval is not a reference
*/
- private static AreaEval createSumRange(Eval eval, AreaEval aeRange) throws EvaluationException {
+ private static AreaEval createSumRange(ValueEval eval, AreaEval aeRange) throws EvaluationException {
if (eval instanceof AreaEval) {
return ((AreaEval) eval).offset(0, aeRange.getHeight()-1, 0, aeRange.getWidth()-1);
}
@@ -110,7 +109,7 @@
throw new EvaluationException(ErrorEval.VALUE_INVALID);
}
- private static AreaEval convertRangeArg(Eval eval) throws EvaluationException {
+ private static AreaEval convertRangeArg(ValueEval eval) throws EvaluationException {
if (eval instanceof AreaEval) {
return (AreaEval) eval;
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java Mon Aug 17 22:34:22 2009
@@ -19,7 +19,6 @@
import org.apache.poi.hssf.record.formula.eval.BoolEval;
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.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.NumberEval;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
@@ -34,11 +33,11 @@
protected static final String EMPTY_STRING = "";
- protected static final String evaluateStringArg(Eval eval, int srcRow, short srcCol) throws EvaluationException {
+ protected static final String evaluateStringArg(ValueEval eval, int srcRow, short srcCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(eval, srcRow, srcCol);
return OperandResolver.coerceValueToString(ve);
}
- protected static final int evaluateIntArg(Eval arg, int srcCellRow, short srcCellCol) throws EvaluationException {
+ protected static final int evaluateIntArg(ValueEval arg, int srcCellRow, short srcCellCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
return OperandResolver.coerceValueToInt(ve);
}
@@ -51,7 +50,7 @@
}
}
- protected abstract ValueEval evaluateFunc(Eval[] args, int srcCellRow, short srcCellCol) throws EvaluationException;
+ protected abstract ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException;
/* ---------------------------------------------------------------------- */
@@ -60,7 +59,7 @@
protected SingleArgTextFunc() {
// no fields to initialise
}
- protected ValueEval evaluateFunc(Eval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
throws EvaluationException {
if (args.length != 1) {
return ErrorEval.VALUE_INVALID;
@@ -110,7 +109,7 @@
*/
public static final Function MID = new TextFunction() {
- protected ValueEval evaluateFunc(Eval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
throws EvaluationException {
if (args.length != 3) {
return ErrorEval.VALUE_INVALID;
@@ -145,7 +144,7 @@
protected LeftRight(boolean isLeft) {
_isLeft = isLeft;
}
- protected ValueEval evaluateFunc(Eval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
throws EvaluationException {
if (args.length != 2) {
return ErrorEval.VALUE_INVALID;
@@ -168,7 +167,7 @@
public static final Function CONCATENATE = new TextFunction() {
- protected ValueEval evaluateFunc(Eval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
throws EvaluationException {
StringBuffer sb = new StringBuffer();
for (int i=0, iSize=args.length; i<iSize; i++) {
@@ -180,7 +179,7 @@
public static final Function EXACT = new TextFunction() {
- protected ValueEval evaluateFunc(Eval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
throws EvaluationException {
if (args.length != 2) {
return ErrorEval.VALUE_INVALID;
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Time.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Time.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Time.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Time.java Mon Aug 17 22:34:22 2009
@@ -18,7 +18,6 @@
package org.apache.poi.hssf.record.formula.functions;
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.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.MissingArgEval;
import org.apache.poi.hssf.record.formula.eval.NumberEval;
@@ -51,12 +50,12 @@
}
return new NumberEval(result);
}
- private static int evalArg(Eval arg) throws EvaluationException {
+ private static int evalArg(ValueEval arg) throws EvaluationException {
if (arg == MissingArgEval.instance) {
return 0;
}
// Excel silently truncates double values to integers
- return OperandResolver.coerceValueToInt((ValueEval) arg);
+ return OperandResolver.coerceValueToInt(arg);
}
/**
* Converts the supplied hours, minutes and seconds to an Excel time value.
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java Mon Aug 17 22:34:22 2009
@@ -19,7 +19,6 @@
import org.apache.poi.hssf.record.formula.eval.AreaEval;
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.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
@@ -43,7 +42,7 @@
public final class Vlookup implements Function {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
- Eval arg3 = null;
+ ValueEval arg3 = null;
switch(args.length) {
case 4:
arg3 = args[3]; // important: assumed array element is never null
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java Mon Aug 17 22:34:22 2009
@@ -19,7 +19,6 @@
import org.apache.poi.hssf.record.formula.eval.AreaEval;
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.EvaluationException;
import org.apache.poi.hssf.record.formula.eval.NumberEval;
import org.apache.poi.hssf.record.formula.eval.RefEval;
@@ -167,7 +166,7 @@
return result;
}
- private static ValueVector createValueVector(Eval arg) throws EvaluationException {
+ private static ValueVector createValueVector(ValueEval arg) throws EvaluationException {
if (arg instanceof ErrorEval) {
throw new EvaluationException((ErrorEval) arg);
}
@@ -177,9 +176,6 @@
if (arg instanceof RefEval) {
return new RefValueArray((RefEval) arg);
}
- if (arg instanceof ValueEval) {
- return new SingleCellValueArray((ValueEval) arg);
- }
- throw new RuntimeException("Unexpected eval class (" + arg.getClass().getName() + ")");
+ return new SingleCellValueArray(arg);
}
}
Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/NumericFunctionInvoker.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/NumericFunctionInvoker.java?rev=805192&r1=805191&r2=805192&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/NumericFunctionInvoker.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/NumericFunctionInvoker.java Mon Aug 17 22:34:22 2009
@@ -20,7 +20,7 @@
import junit.framework.AssertionFailedError;
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.ValueEval;
import org.apache.poi.hssf.record.formula.eval.NumericValueEval;
import org.apache.poi.hssf.record.formula.eval.OperationEval;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
@@ -82,7 +82,7 @@
*/
private static double invokeInternal(Object target, ValueEval[] args, int srcCellRow, int srcCellCol)
throws NumericEvalEx {
- Eval evalResult;
+ ValueEval evalResult;
// TODO - make OperationEval extend Function
try {
if (target instanceof Function) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org