Package org.apache.poi.hssf.record.formula.functions

Examples of org.apache.poi.hssf.record.formula.functions.FreeRefFunction


   
    return m;
  }

  private static void r(Map<String, FreeRefFunction> m, String functionName, FreeRefFunction pFunc) {
    FreeRefFunction func = pFunc == null ? new NotImplemented(functionName) : pFunc;
    m.put(functionName, func);
  }
View Full Code Here


    if(nIncomingArgs < 1) {
      throw new RuntimeException("function name argument missing");
    }
   
    Eval nameArg = args[0];
    FreeRefFunction targetFunc;
    if (nameArg instanceof NameEval) {
      targetFunc = findInternalUserDefinedFunction((NameEval) nameArg);
    } else if (nameArg instanceof NameXEval) {
      targetFunc = findExternalUserDefinedFunction(workbook, (NameXEval) nameArg);
    } else {
      throw new RuntimeException("First argument should be a NameEval, but got ("
          + nameArg.getClass().getName() + ")");
    }
    int nOutGoingArgs = nIncomingArgs -1;
    Eval[] outGoingArgs = new Eval[nOutGoingArgs];
    System.arraycopy(args, 1, outGoingArgs, 0, nOutGoingArgs);
    return targetFunc.evaluate(outGoingArgs, workbook, srcCellSheet, srcCellRow, srcCellCol);
  }
View Full Code Here

    if(false) {
      System.out.println("received call to external user defined function (" + functionName + ")");
    }
    // currently only looking for functions from the 'Analysis TookPak'  e.g. "YEARFRAC" or "ISEVEN"
    // not sure how much this logic would need to change to support other or multiple add-ins.
    FreeRefFunction result = AnalysisToolPak.findFunction(functionName);
    if (result != null) {
      return result;
    }
    throw new NotImplementedException(functionName);
  }
View Full Code Here

   
    int nOutGoingArgs = nIncomingArgs -1;
    Eval[] outGoingArgs = new Eval[nOutGoingArgs];
    System.arraycopy(args, 1, outGoingArgs, 0, nOutGoingArgs);
   
    FreeRefFunction targetFunc;
    try {
      targetFunc = findTargetFunction(workbook, functionNameEval);
    } catch (EvaluationException e) {
      return e.getErrorEval();
    }
   
    return targetFunc.evaluate(outGoingArgs, srcCellRow, srcCellCol, workbook, sheet);
  }
View Full Code Here

    return m;
  }

  private static void r(Map<String, FreeRefFunction> m, String functionName, FreeRefFunction pFunc) {
    FreeRefFunction func = pFunc == null ? new NotImplemented(functionName) : pFunc;
    m.put(functionName, func);
  }
View Full Code Here

      functionName = ec.getWorkbook().resolveNameXText(((NameXEval) nameArg).getPtg());
    } else {
      throw new RuntimeException("First argument should be a NameEval, but got ("
          + nameArg.getClass().getName() + ")");
    }
    FreeRefFunction targetFunc = ec.findUserDefinedFunction(functionName);
    if (targetFunc == null) {
      throw new NotImplementedException(functionName);
    }
    int nOutGoingArgs = nIncomingArgs -1;
    ValueEval[] outGoingArgs = new ValueEval[nOutGoingArgs];
    System.arraycopy(args, 1, outGoingArgs, 0, nOutGoingArgs);
    return targetFunc.evaluate(outGoingArgs, ec);
  }
View Full Code Here

   *
   * @param name Name of function.
   * @return Function executor. <code>null</code> if not found
   */
  public FreeRefFunction findFunction(String name) {
    FreeRefFunction evaluatorForFunction;
    for (UDFFinder pack : _usedToolPacks) {
      evaluatorForFunction = pack.findFunction(name);
      if (evaluatorForFunction != null) {
        return evaluatorForFunction;
      }
View Full Code Here

   
    int nOutGoingArgs = nIncomingArgs -1;
    Eval[] outGoingArgs = new Eval[nOutGoingArgs];
    System.arraycopy(args, 1, outGoingArgs, 0, nOutGoingArgs);
   
    FreeRefFunction targetFunc;
    try {
      targetFunc = findTargetFunction(workbook, functionNameEval);
    } catch (EvaluationException e) {
      return e.getErrorEval();
    }
   
    return targetFunc.evaluate(outGoingArgs, srcCellRow, srcCellCol, workbook, sheet);
  }
View Full Code Here

    return m;
  }

  private static void r(Map<String, FreeRefFunction> m, String functionName, FreeRefFunction pFunc) {
    FreeRefFunction func = pFunc == null ? new NotImplemented(functionName) : pFunc;
    m.put(functionName, func);
  }
View Full Code Here

      functionName = ec.getWorkbook().resolveNameXText(((NameXEval) nameArg).getPtg());
    } else {
      throw new RuntimeException("First argument should be a NameEval, but got ("
          + nameArg.getClass().getName() + ")");
    }
    FreeRefFunction targetFunc = ec.findUserDefinedFunction(functionName);
    if (targetFunc == null) {
      throw new NotImplementedException(functionName);
    }
    int nOutGoingArgs = nIncomingArgs -1;
    ValueEval[] outGoingArgs = new ValueEval[nOutGoingArgs];
    System.arraycopy(args, 1, outGoingArgs, 0, nOutGoingArgs);
    return targetFunc.evaluate(outGoingArgs, ec);
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.formula.functions.FreeRefFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.