You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FreeRefFunction.java 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.hssf.record.formula.functions;
  16. import org.apache.poi.hssf.record.formula.eval.ValueEval;
  17. import org.apache.poi.ss.formula.OperationEvaluationContext;
  18. /**
  19. * For most Excel functions, involving references ((cell, area), (2d, 3d)), the references are
  20. * passed in as arguments, and the exact location remains fixed. However, a select few Excel
  21. * functions have the ability to access cells that were not part of any reference passed as an
  22. * argument.<br/>
  23. * Two important functions with this feature are <b>INDIRECT</b> and <b>OFFSET</b><p/>
  24. *
  25. * When POI evaluates formulas, each reference argument is capable of evaluating any cell inside
  26. * its range. Actually, even cells outside the reference range but on the same sheet can be
  27. * evaluated. This allows <b>OFFSET</b> to be implemented like most other functions - taking only
  28. * the arguments, and source cell coordinates.
  29. *
  30. * For the moment this interface only exists to serve the <b>INDIRECT</b> which can decode
  31. * arbitrary text into cell references, and evaluate them..
  32. *
  33. * @author Josh Micich
  34. */
  35. public interface FreeRefFunction {
  36. /**
  37. * @param args the pre-evaluated arguments for this function. args is never <code>null</code>,
  38. * nor are any of its elements.
  39. * @param ec primarily used to identify the source cell containing the formula being evaluated.
  40. * may also be used to dynamically create reference evals.
  41. * @return never <code>null</code>. Possibly an instance of <tt>ErrorEval</tt> in the case of
  42. * a specified Excel error (Exceptions are never thrown to represent Excel errors).
  43. */
  44. ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec);
  45. }