Przeglądaj źródła

changed short to int in Function.evaluate() method signature

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@881704 13f79535-47bb-0310-9956-ffa450edef68
pull/1/head
Josh Micich 14 lat temu
rodzic
commit
89c17f1ef7
57 zmienionych plików z 74 dodań i 74 usunięć
  1. 1
    1
      src/java/org/apache/poi/hssf/record/formula/eval/ConcatEval.java
  2. 1
    1
      src/java/org/apache/poi/hssf/record/formula/eval/IntersectionEval.java
  3. 1
    1
      src/java/org/apache/poi/hssf/record/formula/eval/PercentEval.java
  4. 1
    1
      src/java/org/apache/poi/hssf/record/formula/eval/RangeEval.java
  5. 1
    1
      src/java/org/apache/poi/hssf/record/formula/eval/RelationalOperationEval.java
  6. 1
    1
      src/java/org/apache/poi/hssf/record/formula/eval/TwoOperandNumericOperation.java
  7. 1
    1
      src/java/org/apache/poi/hssf/record/formula/eval/UnaryMinusEval.java
  8. 1
    1
      src/java/org/apache/poi/hssf/record/formula/eval/UnaryPlusEval.java
  9. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/BooleanFunction.java
  10. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/CalendarFieldFunction.java
  11. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Choose.java
  12. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Column.java
  13. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Columns.java
  14. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Count.java
  15. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Counta.java
  16. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Countblank.java
  17. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Countif.java
  18. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Errortype.java
  19. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/False.java
  20. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Find.java
  21. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Function.java
  22. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Hlookup.java
  23. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Hyperlink.java
  24. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/If.java
  25. 2
    2
      src/java/org/apache/poi/hssf/record/formula/functions/Index.java
  26. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/IsError.java
  27. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/IsNa.java
  28. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java
  29. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Isref.java
  30. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/LogicalFunction.java
  31. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Lookup.java
  32. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java
  33. 2
    2
      src/java/org/apache/poi/hssf/record/formula/functions/Match.java
  34. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Mode.java
  35. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java
  36. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Na.java
  37. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Not.java
  38. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/NotImplementedFunction.java
  39. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Now.java
  40. 6
    6
      src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java
  41. 3
    3
      src/java/org/apache/poi/hssf/record/formula/functions/Offset.java
  42. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Pi.java
  43. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Rand.java
  44. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Replace.java
  45. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Row.java
  46. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Rows.java
  47. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java
  48. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java
  49. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Sumproduct.java
  50. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/T.java
  51. 9
    9
      src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java
  52. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Time.java
  53. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Today.java
  54. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/True.java
  55. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Value.java
  56. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java
  57. 1
    1
      src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/eval/ConcatEval.java Wyświetl plik

// enforce singleton // enforce singleton
} }


public ValueEval evaluate(ValueEval[] args, int srcRow, short srcCol) {
public ValueEval evaluate(ValueEval[] args, int srcRow, int srcCol) {
if(args.length != 2) { if(args.length != 2) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/eval/IntersectionEval.java Wyświetl plik

// enforces singleton // enforces singleton
} }


public ValueEval evaluate(ValueEval[] args, int srcRow, short srcCol) {
public ValueEval evaluate(ValueEval[] args, int srcRow, int srcCol) {
if(args.length != 2) { if(args.length != 2) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/eval/PercentEval.java Wyświetl plik

// enforce singleton // enforce singleton
} }


public ValueEval evaluate(ValueEval[] args, int srcRow, short srcCol) {
public ValueEval evaluate(ValueEval[] args, int srcRow, int srcCol) {
if (args.length != 1) { if (args.length != 1) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/eval/RangeEval.java Wyświetl plik

// enforces singleton // enforces singleton
} }


public ValueEval evaluate(ValueEval[] args, int srcRow, short srcCol) {
public ValueEval evaluate(ValueEval[] args, int srcRow, int srcCol) {
if(args.length != 2) { if(args.length != 2) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/eval/RelationalOperationEval.java Wyświetl plik

* Blank < Positive numbers * Blank < Positive numbers
* </pre> * </pre>
*/ */
public final ValueEval evaluate(ValueEval[] operands, int srcRow, short srcCol) {
public final ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
if (operands.length != 2) { if (operands.length != 2) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/eval/TwoOperandNumericOperation.java Wyświetl plik

return OperandResolver.coerceValueToDouble(ve); return OperandResolver.coerceValueToDouble(ve);
} }


public final ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public final ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
double result; double result;
try { try {
double d0 = singleOperandEvaluate(args[0], srcCellRow, srcCellCol); double d0 = singleOperandEvaluate(args[0], srcCellRow, srcCellCol);

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/eval/UnaryMinusEval.java Wyświetl plik

// enforce singleton // enforce singleton
} }


public ValueEval evaluate(ValueEval[] args, int srcRow, short srcCol) {
public ValueEval evaluate(ValueEval[] args, int srcRow, int srcCol) {
if (args.length != 1) { if (args.length != 1) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/eval/UnaryPlusEval.java Wyświetl plik

// enforce singleton // enforce singleton
} }


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if(args.length != 1) { if(args.length != 1) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/BooleanFunction.java Wyświetl plik

*/ */
public abstract class BooleanFunction implements Function { public abstract class BooleanFunction implements Function {


public final ValueEval evaluate(ValueEval[] args, int srcRow, short srcCol) {
public final ValueEval evaluate(ValueEval[] args, int srcRow, int srcCol) {
if (args.length < 1) { if (args.length < 1) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/CalendarFieldFunction.java Wyświetl plik

_needsOneBaseAdjustment = needsOneBaseAdjustment; _needsOneBaseAdjustment = needsOneBaseAdjustment;
} }


public ValueEval evaluate(ValueEval[] operands, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] operands, int srcCellRow, int srcCellCol) {
if (operands.length != 1) { if (operands.length != 1) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Choose.java Wyświetl plik

*/ */
public final class Choose implements Function { public final class Choose implements Function {


public ValueEval evaluate(ValueEval[] args, int srcRowIndex, short srcColumnIndex) {
public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
if (args.length < 2) { if (args.length < 2) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Column.java Wyświetl plik

import org.apache.poi.hssf.record.formula.eval.ValueEval; import org.apache.poi.hssf.record.formula.eval.ValueEval;


public final class Column implements Function { public final class Column implements Function {
public ValueEval evaluate(ValueEval[] evals, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] evals, int srcCellRow, int srcCellCol) {
ValueEval retval = null; ValueEval retval = null;
int cnum = -1; int cnum = -1;



+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Columns.java Wyświetl plik

*/ */
public final class Columns implements Function { public final class Columns implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
switch(args.length) { switch(args.length) {
case 1: case 1:
// expected // expected

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Count.java Wyświetl plik

*/ */
public final class Count implements Function { public final class Count implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
int nArgs = args.length; int nArgs = args.length;
if (nArgs < 1) { if (nArgs < 1) {
// too few arguments // too few arguments

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Counta.java Wyświetl plik

*/ */
public final class Counta implements Function { public final class Counta implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
int nArgs = args.length; int nArgs = args.length;
if (nArgs < 1) { if (nArgs < 1) {
// too few arguments // too few arguments

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Countblank.java Wyświetl plik

*/ */
public final class Countblank implements Function { public final class Countblank implements Function {


public ValueEval evaluate(ValueEval[] args, int srcRowIndex, short srcColumnIndex) {
public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
if (args.length != 1) { if (args.length != 1) {
// TODO - it doesn't seem to be possible to enter COUNTBLANK() into Excel with the wrong arg count // TODO - it doesn't seem to be possible to enter COUNTBLANK() into Excel with the wrong arg count
// perhaps this should be an exception // perhaps this should be an exception

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Countif.java Wyświetl plik

} }
} }


public ValueEval evaluate(ValueEval[] args, int srcRowIndex, short srcColumnIndex) {
public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
switch(args.length) { switch(args.length) {
case 2: case 2:
// expected // expected

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Errortype.java Wyświetl plik

*/ */
public final class Errortype implements Function { public final class Errortype implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {


try { try {
OperandResolver.getSingleValue(args[0], srcCellRow, srcCellCol); OperandResolver.getSingleValue(args[0], srcCellRow, srcCellCol);

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/False.java Wyświetl plik

*/ */
public final class False implements Function { public final class False implements Function {


public ValueEval evaluate(ValueEval[] operands, int srcRow, short srcCol) {
public ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
ValueEval retval; ValueEval retval;
switch (operands.length) { switch (operands.length) {
default: default:

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Find.java Wyświetl plik

*/ */
public final class Find extends TextFunction { public final class Find extends TextFunction {


protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException { throws EvaluationException {


int nArgs = args.length; int nArgs = args.length;

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Function.java Wyświetl plik

* numeric functions evaluate to {@link Double#NaN} be sure to translate the result to {@link * numeric functions evaluate to {@link Double#NaN} be sure to translate the result to {@link
* ErrorEval#NUM_ERROR}. * ErrorEval#NUM_ERROR}.
*/ */
ValueEval evaluate(ValueEval[] args, int srcRowIndex, short srcColumnIndex);
ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex);
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Hlookup.java Wyświetl plik

*/ */
public final class Hlookup implements Function { public final class Hlookup implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
ValueEval arg3 = null; ValueEval arg3 = null;
switch(args.length) { switch(args.length) {
case 4: case 4:

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Hyperlink.java Wyświetl plik

*/ */
public final class Hyperlink implements Function { public final class Hyperlink implements Function {


public ValueEval evaluate(ValueEval[] operands, int srcRow, short srcCol) {
public ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
int lastArgIx = operands.length - 1; int lastArgIx = operands.length - 1;
if (lastArgIx < 0 || lastArgIx > 1) { if (lastArgIx < 0 || lastArgIx > 1) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/If.java Wyświetl plik

*/ */
public final class If implements Function { public final class If implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
ValueEval falseResult; ValueEval falseResult;
switch (args.length) { switch (args.length) {
case 3: case 3:

+ 2
- 2
src/java/org/apache/poi/hssf/record/formula/functions/Index.java Wyświetl plik

*/ */
public final class Index implements Function { public final class Index implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
int nArgs = args.length; int nArgs = args.length;
if(nArgs < 2) { if(nArgs < 2) {
// too few arguments // too few arguments
* @return the resolved 1-based index. Zero if the arg was missing or blank * @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 * @throws EvaluationException if the arg is an error value evaluates to a negative numeric value
*/ */
private static int resolveIndexArg(ValueEval arg, int srcCellRow, short srcCellCol) throws EvaluationException {
private static int resolveIndexArg(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException {


ValueEval ev = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol); ValueEval ev = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
if (ev == MissingArgEval.instance) { if (ev == MissingArgEval.instance) {

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/IsError.java Wyświetl plik

*/ */
public final class IsError implements Function { public final class IsError implements Function {


public ValueEval evaluate(ValueEval[] operands, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] operands, int srcCellRow, int srcCellCol) {
if (operands.length != 1) { if (operands.length != 1) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/IsNa.java Wyświetl plik

*/ */
public final class IsNa implements Function { public final class IsNa implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if(args.length != 1) { if(args.length != 1) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java Wyświetl plik

*/ */
public final class Isblank implements Function { public final class Isblank implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if(args.length != 1) { if(args.length != 1) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Isref.java Wyświetl plik

* @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt; * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
*/ */
public final class Isref implements Function { public final class Isref implements Function {
public ValueEval evaluate(ValueEval[] operands, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] operands, int srcCellRow, int srcCellCol) {
if (operands.length != 1) { if (operands.length != 1) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/LogicalFunction.java Wyświetl plik

return retval; return retval;
} }


public final ValueEval evaluate(ValueEval[] operands, int srcCellRow, short srcCellCol) {
public final ValueEval evaluate(ValueEval[] operands, int srcCellRow, int srcCellCol) {
if (operands.length != 1) { if (operands.length != 1) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Lookup.java Wyświetl plik

*/ */
public final class Lookup implements Function { public final class Lookup implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
switch(args.length) { switch(args.length) {
case 3: case 3:
break; break;

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java Wyświetl plik

* @return * @return
* @throws EvaluationException * @throws EvaluationException
*/ */
public static boolean resolveRangeLookupArg(ValueEval rangeLookupArg, int srcCellRow, short srcCellCol) throws EvaluationException {
public static boolean resolveRangeLookupArg(ValueEval rangeLookupArg, int srcCellRow, int srcCellCol) throws EvaluationException {
if(rangeLookupArg == null) { if(rangeLookupArg == null) {
// range_lookup arg not provided // range_lookup arg not provided
return true; // default is TRUE return true; // default is TRUE

+ 2
- 2
src/java/org/apache/poi/hssf/record/formula/functions/Match.java Wyświetl plik

public final class Match implements Function { public final class Match implements Function {




public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {


double match_type = 1; // default double match_type = 1; // default








private static double evaluateMatchTypeArg(ValueEval arg, int srcCellRow, short srcCellCol)
private static double evaluateMatchTypeArg(ValueEval arg, int srcCellRow, int srcCellCol)
throws EvaluationException { throws EvaluationException {
ValueEval match_type = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol); ValueEval match_type = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);



+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Mode.java Wyświetl plik



} }


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
double result; double result;
try { try {
List<Double> temp = new ArrayList<Double>(); List<Double> temp = new ArrayList<Double>();

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java Wyświetl plik



private static final int DEFAULT_MAX_NUM_OPERANDS = 30; private static final int DEFAULT_MAX_NUM_OPERANDS = 30;


public final ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public final ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {


double d; double d;
try { try {

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Na.java Wyświetl plik

*/ */
public final class Na implements Function { public final class Na implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
return ErrorEval.NA; return ErrorEval.NA;
} }



+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Not.java Wyświetl plik

*/ */
public final class Not implements Function { public final class Not implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if (args.length != 1) { if (args.length != 1) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/NotImplementedFunction.java Wyświetl plik

_functionName = name; _functionName = name;
} }


public ValueEval evaluate(ValueEval[] operands, int srcRow, short srcCol) {
public ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
throw new NotImplementedException(_functionName); throw new NotImplementedException(_functionName);
} }
public String getFunctionName() { public String getFunctionName() {

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Now.java Wyświetl plik

*/ */
public final class Now implements Function { public final class Now implements Function {


public ValueEval evaluate(ValueEval[] evals, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] evals, int srcCellRow, int srcCellCol) {
if (evals.length > 0) { if (evals.length > 0) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 6
- 6
src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java Wyświetl plik

static final double TEN = 10.0; static final double TEN = 10.0;
static final double LOG_10_TO_BASE_e = Math.log(TEN); static final double LOG_10_TO_BASE_e = Math.log(TEN);


protected static final double singleOperandEvaluate(ValueEval arg, int srcCellRow, short srcCellCol) throws EvaluationException {
protected static final double singleOperandEvaluate(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol); ValueEval ve = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
double result = OperandResolver.coerceValueToDouble(ve); double result = OperandResolver.coerceValueToDouble(ve);
checkValue(result); checkValue(result);
} }
} }


public final ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public final ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
double result; double result;
try { try {
result = eval(args, srcCellRow, srcCellCol); result = eval(args, srcCellRow, srcCellCol);
return new NumberEval(result); return new NumberEval(result);
} }


protected abstract double eval(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException;
protected abstract double eval(ValueEval[] args, int srcCellRow, int srcCellCol) throws EvaluationException;


/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
// intermediate sub-classes (one-arg, two-arg and multi-arg) // intermediate sub-classes (one-arg, two-arg and multi-arg)
protected OneArg() { protected OneArg() {
// no fields to initialise // no fields to initialise
} }
protected final double eval(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException {
protected final double eval(ValueEval[] args, int srcCellRow, int srcCellCol) throws EvaluationException {
if (args.length != 1) { if (args.length != 1) {
throw new EvaluationException(ErrorEval.VALUE_INVALID); throw new EvaluationException(ErrorEval.VALUE_INVALID);
} }
protected TwoArg() { protected TwoArg() {
// no fields to initialise // no fields to initialise
} }
protected final double eval(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException {
protected final double eval(ValueEval[] args, int srcCellRow, int srcCellCol) throws EvaluationException {
if (args.length != 2) { if (args.length != 2) {
throw new EvaluationException(ErrorEval.VALUE_INVALID); throw new EvaluationException(ErrorEval.VALUE_INVALID);
} }
_minArgs = minArgs; _minArgs = minArgs;
_maxArgs = maxArgs; _maxArgs = maxArgs;
} }
protected final double eval(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException {
protected final double eval(ValueEval[] args, int srcCellRow, int srcCellCol) throws EvaluationException {
int nArgs = args.length; int nArgs = args.length;
if (nArgs < _minArgs || nArgs > _maxArgs) { if (nArgs < _minArgs || nArgs > _maxArgs) {
throw new EvaluationException(ErrorEval.VALUE_INVALID); throw new EvaluationException(ErrorEval.VALUE_INVALID);

+ 3
- 3
src/java/org/apache/poi/hssf/record/formula/functions/Offset.java Wyświetl plik

} }
} }


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if(args.length < 3 || args.length > 5) { if(args.length < 3 || args.length > 5) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }
/** /**
* OFFSET's numeric arguments (2..5) have similar processing rules * OFFSET's numeric arguments (2..5) have similar processing rules
*/ */
private static int evaluateIntArg(ValueEval eval, int srcCellRow, short srcCellCol) throws EvaluationException {
private static int evaluateIntArg(ValueEval eval, int srcCellRow, int srcCellCol) throws EvaluationException {


double d = evaluateDoubleArg(eval, srcCellRow, srcCellCol); double d = evaluateDoubleArg(eval, srcCellRow, srcCellCol);
return convertDoubleToInt(d); return convertDoubleToInt(d);
return (int)Math.floor(d); return (int)Math.floor(d);
} }


private static double evaluateDoubleArg(ValueEval eval, int srcCellRow, short srcCellCol) throws EvaluationException {
private static double evaluateDoubleArg(ValueEval eval, int srcCellRow, int srcCellCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(eval, srcCellRow, srcCellCol); ValueEval ve = OperandResolver.getSingleValue(eval, srcCellRow, srcCellCol);


if (ve instanceof NumericValueEval) { if (ve instanceof NumericValueEval) {

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Pi.java Wyświetl plik



private static final NumberEval PI_EVAL = new NumberEval(Math.PI); private static final NumberEval PI_EVAL = new NumberEval(Math.PI);


public ValueEval evaluate(ValueEval[] operands, int srcRow, short srcCol) {
public ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
ValueEval retval; ValueEval retval;
switch (operands.length) { switch (operands.length) {
default: default:

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Rand.java Wyświetl plik

*/ */
public final class Rand implements Function { public final class Rand implements Function {


public ValueEval evaluate(ValueEval[] operands, int srcRow, short srcCol) {
public ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
ValueEval retval; ValueEval retval;
switch (operands.length) { switch (operands.length) {
default: default:

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Replace.java Wyświetl plik

*/ */
public final class Replace extends TextFunction { public final class Replace extends TextFunction {


protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException { throws EvaluationException {
if (args.length != 4) { if (args.length != 4) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Row.java Wyświetl plik



public final class Row implements Function { public final class Row implements Function {


public ValueEval evaluate(ValueEval[] evals, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] evals, int srcCellRow, int srcCellCol) {
ValueEval retval = null; ValueEval retval = null;
int rnum = -1; int rnum = -1;



+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Rows.java Wyświetl plik

*/ */
public final class Rows implements Function { public final class Rows implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
switch(args.length) { switch(args.length) {
case 1: case 1:
// expected // expected

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java Wyświetl plik

*/ */
public final class Substitute extends TextFunction { public final class Substitute extends TextFunction {


protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException { throws EvaluationException {
if (args.length < 3 || args.length > 4) { if (args.length < 3 || args.length > 4) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java Wyświetl plik

*/ */
public final class Sumif implements Function { public final class Sumif implements Function {


public ValueEval evaluate(ValueEval[] args, int srcRowIndex, short srcColumnIndex) {
public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
if (args.length < 2) { if (args.length < 2) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Sumproduct.java Wyświetl plik

public final class Sumproduct implements Function { public final class Sumproduct implements Function {




public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {


int maxN = args.length; int maxN = args.length;



+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/T.java Wyświetl plik



public final class T implements Function { public final class T implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
switch (args.length) { switch (args.length) {
default: default:
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;

+ 9
- 9
src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java Wyświetl plik



protected static final String EMPTY_STRING = ""; protected static final String EMPTY_STRING = "";


protected static final String evaluateStringArg(ValueEval eval, int srcRow, short srcCol) throws EvaluationException {
protected static final String evaluateStringArg(ValueEval eval, int srcRow, int srcCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(eval, srcRow, srcCol); ValueEval ve = OperandResolver.getSingleValue(eval, srcRow, srcCol);
return OperandResolver.coerceValueToString(ve); return OperandResolver.coerceValueToString(ve);
} }
protected static final int evaluateIntArg(ValueEval arg, int srcCellRow, short srcCellCol) throws EvaluationException {
protected static final int evaluateIntArg(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol); ValueEval ve = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
return OperandResolver.coerceValueToInt(ve); return OperandResolver.coerceValueToInt(ve);
} }


public final ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public final ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
try { try {
return evaluateFunc(args, srcCellRow, srcCellCol); return evaluateFunc(args, srcCellRow, srcCellCol);
} catch (EvaluationException e) { } catch (EvaluationException e) {
} }
} }


protected abstract ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException;
protected abstract ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol) throws EvaluationException;


/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */


protected SingleArgTextFunc() { protected SingleArgTextFunc() {
// no fields to initialise // no fields to initialise
} }
protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException { throws EvaluationException {
if (args.length != 1) { if (args.length != 1) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
*/ */
public static final Function MID = new TextFunction() { public static final Function MID = new TextFunction() {


protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException { throws EvaluationException {
if (args.length != 3) { if (args.length != 3) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
protected LeftRight(boolean isLeft) { protected LeftRight(boolean isLeft) {
_isLeft = isLeft; _isLeft = isLeft;
} }
protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException { throws EvaluationException {
if (args.length != 2) { if (args.length != 2) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;


public static final Function CONCATENATE = new TextFunction() { public static final Function CONCATENATE = new TextFunction() {


protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException { throws EvaluationException {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
for (int i=0, iSize=args.length; i<iSize; i++) { for (int i=0, iSize=args.length; i<iSize; i++) {


public static final Function EXACT = new TextFunction() { public static final Function EXACT = new TextFunction() {


protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException { throws EvaluationException {
if (args.length != 2) { if (args.length != 2) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Time.java Wyświetl plik

private static final int SECONDS_PER_DAY = HOURS_PER_DAY * SECONDS_PER_HOUR; private static final int SECONDS_PER_DAY = HOURS_PER_DAY * SECONDS_PER_HOUR;




public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if (args.length != 3) { if (args.length != 3) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Today.java Wyświetl plik

*/ */
public final class Today implements Function { public final class Today implements Function {


public ValueEval evaluate(ValueEval[] evals, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] evals, int srcCellRow, int srcCellCol) {
if (evals.length > 0) { if (evals.length > 0) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/True.java Wyświetl plik

*/ */
public final class True implements Function { public final class True implements Function {


public ValueEval evaluate(ValueEval[] operands, int srcRow, short srcCol) {
public ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
ValueEval retval; ValueEval retval;
switch (operands.length) { switch (operands.length) {
default: default:

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Value.java Wyświetl plik

private static final int MIN_DISTANCE_BETWEEN_THOUSANDS_SEPARATOR = 4; private static final int MIN_DISTANCE_BETWEEN_THOUSANDS_SEPARATOR = 4;
private static final Double ZERO = new Double(0.0); private static final Double ZERO = new Double(0.0);


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if (args.length != 1) { if (args.length != 1) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java Wyświetl plik

*/ */
public final class Vlookup implements Function { public final class Vlookup implements Function {


public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
ValueEval arg3 = null; ValueEval arg3 = null;
switch(args.length) { switch(args.length) {
case 4: case 4:

+ 1
- 1
src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java Wyświetl plik

*/ */
protected abstract Accumulator createAccumulator(); protected abstract Accumulator createAccumulator();


public final ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
public final ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if (args.length != 2) { if (args.length != 2) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

Ładowanie…
Anuluj
Zapisz