Package org.apache.poi.ss.formula.functions.LookupUtils

Examples of org.apache.poi.ss.formula.functions.LookupUtils.ValueVector


      ValueEval lookupValue = OperandResolver.getSingleValue(lookup_value, srcRowIndex, srcColumnIndex);
      TwoDEval tableArray = LookupUtils.resolveTableArrayArg(table_array);
      boolean isRangeLookup = LookupUtils.resolveRangeLookupArg(range_lookup, srcRowIndex, srcColumnIndex);
      int rowIndex = LookupUtils.lookupIndexOfValue(lookupValue, LookupUtils.createColumnVector(tableArray, 0), isRangeLookup);
      int colIndex = LookupUtils.resolveRowOrColIndexArg(col_index, srcRowIndex, srcColumnIndex);
      ValueVector resultCol = createResultColumnVector(tableArray, colIndex);
      return resultCol.getItem(rowIndex);
    } catch (EvaluationException e) {
      return e.getErrorEval();
    }
  }
View Full Code Here


    // Note - Excel does not strictly require -1 and +1
    boolean findLargestLessThanOrEqual = match_type > 0;

    try {
      ValueEval lookupValue = OperandResolver.getSingleValue(arg0, srcRowIndex, srcColumnIndex);
      ValueVector lookupRange = evaluateLookupRange(arg1);
      int index = findIndexOfValue(lookupValue, lookupRange, matchExact, findLargestLessThanOrEqual);
      return new NumberEval(index + 1); // +1 to convert to 1-based
    } catch (EvaluationException e) {
      return e.getErrorEval();
    }
View Full Code Here

    if (eval instanceof RefEval) {
      RefEval re = (RefEval) eval;
      return new SingleValueVector(re.getInnerValueEval());
    }
    if (eval instanceof TwoDEval) {
      ValueVector result = LookupUtils.createVector((TwoDEval)eval);
      if (result == null) {
        throw new EvaluationException(ErrorEval.NA);
      }
      return result;
    }
View Full Code Here

 
  public ValueEval evaluate(int srcRowIndex, int srcColumnIndex,
      ValueEval arg0, ValueEval arg1) {
    double result;
    try {
      ValueVector vvY = createValueVector(arg0);
      ValueVector vvX = createValueVector(arg1);
      int size = vvX.getSize();
      if (size == 0 || vvY.getSize() != size) {
        return ErrorEval.NA;
      }
      result = evaluateInternal(vvX, vvY, size);
    } catch (EvaluationException e) {
View Full Code Here

    // Note - Excel does not strictly require -1 and +1
    boolean findLargestLessThanOrEqual = match_type > 0;

    try {
      ValueEval lookupValue = OperandResolver.getSingleValue(arg0, srcRowIndex, srcColumnIndex);
      ValueVector lookupRange = evaluateLookupRange(arg1);
      int index = findIndexOfValue(lookupValue, lookupRange, matchExact, findLargestLessThanOrEqual);
      return new NumberEval(index + 1); // +1 to convert to 1-based
    } catch (EvaluationException e) {
      return e.getErrorEval();
    }
View Full Code Here

      } else {
          return LookupUtils.createVector(re);
      }
    }
    if (eval instanceof TwoDEval) {
      ValueVector result = LookupUtils.createVector((TwoDEval)eval);
      if (result == null) {
        throw new EvaluationException(ErrorEval.NA);
      }
      return result;
    }
View Full Code Here

 
  public ValueEval evaluate(int srcRowIndex, int srcColumnIndex,
      ValueEval arg0, ValueEval arg1) {
    double result;
    try {
      ValueVector vvY = createValueVector(arg0);
      ValueVector vvX = createValueVector(arg1);
      int size = vvX.getSize();
      if (size == 0 || vvY.getSize() != size) {
        return ErrorEval.NA;
      }
      result = evaluateInternal(vvX, vvY, size);
    } catch (EvaluationException e) {
View Full Code Here

  public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) {

    double result;
    try {
      ValueVector vvX = createValueVector(arg0);
      ValueVector vvY = createValueVector(arg1);
      int size = vvX.getSize();
      if (size == 0 || vvY.getSize() != size) {
        return ErrorEval.NA;
      }
      result = evaluateInternal(vvX, vvY, size);
    } catch (EvaluationException e) {
      return e.getErrorEval();
View Full Code Here

      ValueEval lookupValue = OperandResolver.getSingleValue(lookup_value, srcRowIndex, srcColumnIndex);
      TwoDEval tableArray = LookupUtils.resolveTableArrayArg(table_array);
      boolean isRangeLookup = LookupUtils.resolveRangeLookupArg(range_lookup, srcRowIndex, srcColumnIndex);
      int rowIndex = LookupUtils.lookupIndexOfValue(lookupValue, LookupUtils.createColumnVector(tableArray, 0), isRangeLookup);
      int colIndex = LookupUtils.resolveRowOrColIndexArg(col_index, srcRowIndex, srcColumnIndex);
      ValueVector resultCol = createResultColumnVector(tableArray, colIndex);
      return resultCol.getItem(rowIndex);
    } catch (EvaluationException e) {
      return e.getErrorEval();
    }
  }
View Full Code Here

    // Note - Excel does not strictly require -1 and +1
    boolean findLargestLessThanOrEqual = match_type > 0;

    try {
      ValueEval lookupValue = OperandResolver.getSingleValue(arg0, srcRowIndex, srcColumnIndex);
      ValueVector lookupRange = evaluateLookupRange(arg1);
      int index = findIndexOfValue(lookupValue, lookupRange, matchExact, findLargestLessThanOrEqual);
      return new NumberEval(index + 1); // +1 to convert to 1-based
    } catch (EvaluationException e) {
      return e.getErrorEval();
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.formula.functions.LookupUtils.ValueVector

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.