import org.apache.poi.ss.formula.eval.NameEval;
import org.apache.poi.ss.formula.eval.NameXEval;
+import org.apache.poi.ss.formula.eval.NotImplementedFunctionException;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
-import org.apache.poi.ss.formula.eval.NotImplementedException;
/**
*
* Common entry point for all user-defined (non-built-in) functions (where
}
FreeRefFunction targetFunc = ec.findUserDefinedFunction(functionName);
if (targetFunc == null) {
- throw new NotImplementedException(functionName);
+ throw new NotImplementedFunctionException(functionName);
}
int nOutGoingArgs = nIncomingArgs -1;
ValueEval[] outGoingArgs = new ValueEval[nOutGoingArgs];
package org.apache.poi.ss.formula.atp;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeSet;
+
import org.apache.poi.ss.formula.OperationEvaluationContext;
-import org.apache.poi.ss.formula.eval.NotImplementedException;
+import org.apache.poi.ss.formula.eval.NotImplementedFunctionException;
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.*;
+import org.apache.poi.ss.formula.functions.Bin2Dec;
+import org.apache.poi.ss.formula.functions.Complex;
+import org.apache.poi.ss.formula.functions.Countifs;
+import org.apache.poi.ss.formula.functions.Dec2Bin;
+import org.apache.poi.ss.formula.functions.Dec2Hex;
+import org.apache.poi.ss.formula.functions.Delta;
+import org.apache.poi.ss.formula.functions.EDate;
+import org.apache.poi.ss.formula.functions.FactDouble;
+import org.apache.poi.ss.formula.functions.FreeRefFunction;
+import org.apache.poi.ss.formula.functions.Hex2Dec;
+import org.apache.poi.ss.formula.functions.ImReal;
+import org.apache.poi.ss.formula.functions.Imaginary;
+import org.apache.poi.ss.formula.functions.Oct2Dec;
+import org.apache.poi.ss.formula.functions.Quotient;
+import org.apache.poi.ss.formula.functions.Sumifs;
+import org.apache.poi.ss.formula.functions.WeekNum;
import org.apache.poi.ss.formula.udf.UDFFinder;
-import java.util.*;
-
/**
* Analysis Toolpack Function Definitions
*/
}
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
- throw new NotImplementedException(_functionName);
+ throw new NotImplementedFunctionException(_functionName);
}
}
import org.apache.poi.ss.usermodel.FormulaEvaluator;
/**
- * An exception thrown by implementors of {@link FormulaEvaluator} when attempting to evaluate
- * a formula which requires features that POI does not (yet) support.
- *
- * @author Josh Micich
+ * An exception thrown by implementors of {@link FormulaEvaluator},
+ * when attempting to evaluate a formula which requires features
+ * that POI does not (yet) support.
+ *
+ * <p>Where possible, a subclass of this should be thrown, to provide
+ * more detail of what part of the formula couldn't be processed due
+ * to a missing implementation
*/
-public final class NotImplementedException extends RuntimeException {
-
- public NotImplementedException(String message) {
+public class NotImplementedException extends RuntimeException {
+ private static final long serialVersionUID = -5840703336495141301L;
+
+ public NotImplementedException(String message) {
super(message);
}
public NotImplementedException(String message, NotImplementedException cause) {
--- /dev/null
+/* ====================================================================
+ 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.eval;
+
+import org.apache.poi.ss.usermodel.FormulaEvaluator;
+
+/**
+ * An exception thrown by implementors of {@link FormulaEvaluator} when
+ * attempting to evaluate a formula which requires a function that POI
+ * does not (yet) support.
+ */
+public final class NotImplementedFunctionException extends NotImplementedException {
+ private static final long serialVersionUID = 1208119411557559057L;
+
+ private String functionName;
+
+ public NotImplementedFunctionException(String functionName) {
+ super(functionName);
+ this.functionName = functionName;
+ }
+ public NotImplementedFunctionException(String functionName, NotImplementedException cause) {
+ super(functionName, cause);
+ this.functionName = functionName;
+ }
+
+ public String getFunctionName() {
+ return functionName;
+ }
+}
package org.apache.poi.ss.formula.functions;
+import org.apache.poi.ss.formula.eval.NotImplementedFunctionException;
import org.apache.poi.ss.formula.eval.ValueEval;
-import org.apache.poi.ss.formula.eval.NotImplementedException;
/**
- *
- * @author Amol S. Deshmukh < amolweb at ya hoo dot com >
* This is the default implementation of a Function class.
* The default behaviour is to raise a POI internal error
- * ({@link NotImplementedException}). This error should alert
+ * ({@link NotImplementedFunctionException}). This error should alert
* the user that the formula contained a function that is not
* yet implemented.
*/
}
public ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
- throw new NotImplementedException(_functionName);
+ throw new NotImplementedFunctionException(_functionName);
}
public String getFunctionName() {
return _functionName;
package org.apache.poi.ss.formula.functions;
+import static org.apache.poi.ss.formula.functions.AggregateFunction.subtotalInstance;
+
import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.formula.eval.EvaluationException;
+import org.apache.poi.ss.formula.eval.NotImplementedException;
+import org.apache.poi.ss.formula.eval.NotImplementedFunctionException;
import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.ValueEval;
-import org.apache.poi.ss.formula.eval.NotImplementedException;
-import static org.apache.poi.ss.formula.functions.AggregateFunction.subtotalInstance;
/**
* Implementation for the Excel function SUBTOTAL<p>
case 5: return subtotalInstance(AggregateFunction.MIN);
case 6: return subtotalInstance(AggregateFunction.PRODUCT);
case 7: return subtotalInstance(AggregateFunction.STDEV);
- case 8: throw new NotImplementedException("STDEVP");
+ case 8: throw new NotImplementedFunctionException("STDEVP");
case 9: return subtotalInstance(AggregateFunction.SUM);
- case 10: throw new NotImplementedException("VAR");
- case 11: throw new NotImplementedException("VARP");
+ case 10: throw new NotImplementedFunctionException("VAR");
+ case 11: throw new NotImplementedFunctionException("VARP");
}
if (functionCode > 100 && functionCode < 112) {
throw new NotImplementedException("SUBTOTAL - with 'exclude hidden values' option");