Examples of TwoDEval


Examples of org.apache.poi.ss.formula.TwoDEval

     * Note: no short-circuit boolean loop exit because any ErrorEvals will override the result
     */
    for (int i=0, iSize=args.length; i<iSize; i++) {
      ValueEval arg = args[i];
      if (arg instanceof TwoDEval) {
        TwoDEval ae = (TwoDEval) arg;
        int height = ae.getHeight();
        int width = ae.getWidth();
        for (int rrIx=0; rrIx<height; rrIx++) {
          for (int rcIx=0; rcIx<width; rcIx++) {
            ValueEval ve = ae.getValue(rrIx, rcIx);
            Boolean tempVe = OperandResolver.coerceValueToBoolean(ve, true);
            if (tempVe != null) {
              result = partialEvaluate(result, tempVe.booleanValue());
              atleastOneNonBlank = true;
            }
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

   * Collects values from a single argument
   */
  private void collectValues(ValueEval operand, DoubleList temp) throws EvaluationException {

    if (operand instanceof TwoDEval) {
      TwoDEval ae = (TwoDEval) operand;
      int width = ae.getWidth();
      int height = ae.getHeight();
      for (int rrIx=0; rrIx<height; rrIx++) {
        for (int rcIx=0; rcIx<width; rcIx++) {
          ValueEval ve = ae.getValue(rrIx, rcIx);
          collectValue(ve, true, temp);
        }
      }
      return;
    }
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

     * Note: no short-circuit boolean loop exit because any ErrorEvals will override the result
     */
    for (int i=0, iSize=args.length; i<iSize; i++) {
      ValueEval arg = args[i];
      if (arg instanceof TwoDEval) {
        TwoDEval ae = (TwoDEval) arg;
        int height = ae.getHeight();
        int width = ae.getWidth();
        for (int rrIx=0; rrIx<height; rrIx++) {
          for (int rcIx=0; rcIx<width; rcIx++) {
            ValueEval ve = ae.getValue(rrIx, rcIx);
            Boolean tempVe = OperandResolver.coerceValueToBoolean(ve, true);
            if (tempVe != null) {
              result = partialEvaluate(result, tempVe.booleanValue());
              atleastOneNonBlank = true;
            }
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

      ValueEval arg2, ValueEval arg3) {
    try {
      // Evaluation order:
      // arg0 lookup_value, arg1 table_array, arg3 range_lookup, find lookup value, arg2 col_index, fetch result
      ValueEval lookupValue = OperandResolver.getSingleValue(arg0, srcRowIndex, srcColumnIndex);
      TwoDEval tableArray = LookupUtils.resolveTableArrayArg(arg1);
      boolean isRangeLookup = LookupUtils.resolveRangeLookupArg(arg3, srcRowIndex, srcColumnIndex);
      int rowIndex = LookupUtils.lookupIndexOfValue(lookupValue, LookupUtils.createColumnVector(tableArray, 0), isRangeLookup);
      int colIndex = LookupUtils.resolveRowOrColIndexArg(arg2, srcRowIndex, srcColumnIndex);
      ValueVector resultCol = createResultColumnVector(tableArray, colIndex);
      return resultCol.getItem(rowIndex);
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

  public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1,
      ValueEval arg2) {
    try {
      ValueEval lookupValue = OperandResolver.getSingleValue(arg0, srcRowIndex, srcColumnIndex);
      TwoDEval aeLookupVector = LookupUtils.resolveTableArrayArg(arg1);
      TwoDEval aeResultVector = LookupUtils.resolveTableArrayArg(arg2);

      ValueVector lookupVector = createVector(aeLookupVector);
      ValueVector resultVector = createVector(aeResultVector);
      if(lookupVector.getSize() > resultVector.getSize()) {
        // Excel seems to handle this by accessing past the end of the result vector.
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

* @author Josh Micich
*/
public final class Index implements Function2Arg, Function3Arg, Function4Arg {

  public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) {
    TwoDEval reference = convertFirstArg(arg0);

    int columnIx = 0;
    try {
      int rowIx = resolveIndexArg(arg1, srcRowIndex, srcColumnIndex);

      if (!reference.isColumn()) {
        if (!reference.isRow()) {
          // always an error with 2-D area refs
          // Note - the type of error changes if the pRowArg is negative
          return ErrorEval.REF_INVALID;
        }
        // When the two-arg version of INDEX() has been invoked and the reference
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

      return e.getErrorEval();
    }
  }
  public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1,
      ValueEval arg2) {
    TwoDEval reference = convertFirstArg(arg0);

    try {
      int columnIx = resolveIndexArg(arg2, srcRowIndex, srcColumnIndex);
      int rowIx = resolveIndexArg(arg1, srcRowIndex, srcColumnIndex);
      return getValueFromArea(reference, rowIx, columnIx);
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

  private static ValueEval getValueFromArea(TwoDEval ae, int pRowIx, int pColumnIx)
      throws EvaluationException {
    assert pRowIx >= 0;
    assert pColumnIx >= 0;

    TwoDEval result = ae;

    if (pRowIx != 0) {
      // Slightly irregular logic for bounds checking errors
      if (pRowIx > ae.getHeight()) {
        // high bounds check fail gives #REF! if arg was explicitly passed
        throw new EvaluationException(ErrorEval.REF_INVALID);
      }
      result = result.getRow(pRowIx-1);
    }

    if (pColumnIx != 0) {
      // Slightly irregular logic for bounds checking errors
      if (pColumnIx > ae.getWidth()) {
        // high bounds check fail gives #REF! if arg was explicitly passed
        throw new EvaluationException(ErrorEval.REF_INVALID);
      }
      result = result.getColumn(pColumnIx-1);
    }
    return result;
  }
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

   * Collects values from a single argument
   */
  private void collectValues(ValueEval operand, DoubleList temp) throws EvaluationException {

    if (operand instanceof TwoDEval) {
      TwoDEval ae = (TwoDEval) operand;
      int width = ae.getWidth();
      int height = ae.getHeight();
      for (int rrIx=0; rrIx<height; rrIx++) {
        for (int rcIx=0; rcIx<width; rcIx++) {
          ValueEval ve = ae.getValue(rrIx, rcIx);
          collectValue(ve, true, temp);
        }
      }
      return;
    }
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

      ValueEval arg2, ValueEval arg3) {
    try {
      // Evaluation order:
      // arg0 lookup_value, arg1 table_array, arg3 range_lookup, find lookup value, arg2 row_index, fetch result
      ValueEval lookupValue = OperandResolver.getSingleValue(arg0, srcRowIndex, srcColumnIndex);
      TwoDEval tableArray = LookupUtils.resolveTableArrayArg(arg1);
      boolean isRangeLookup = LookupUtils.resolveRangeLookupArg(arg3, srcRowIndex, srcColumnIndex);
      int colIndex = LookupUtils.lookupIndexOfValue(lookupValue, LookupUtils.createRowVector(tableArray, 0), isRangeLookup);
      int rowIndex = LookupUtils.resolveRowOrColIndexArg(arg2, srcRowIndex, srcColumnIndex);
      ValueVector resultCol = createResultColumnVector(tableArray, rowIndex);
      return resultCol.getItem(colIndex);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.