Esempio n. 1
0
 /**
  * Returns one column from an <c>AreaEval</c>
  *
  * @(#VALUE!) if colIndex Is negative, (#REF!) if colIndex Is too high
  */
 private ValueVector CreateResultColumnVector(TwoDEval tableArray, int colIndex)
 {
     if (colIndex >= tableArray.Width)
     {
         throw EvaluationException.InvalidRef();
     }
     return(LookupUtils.CreateColumnVector(tableArray, colIndex));
 }
Esempio n. 2
0
 public override ValueEval Evaluate(int srcRowIndex, int srcColumnIndex, ValueEval lookup_value, ValueEval table_array,
                                    ValueEval col_index, ValueEval range_lookup)
 {
     try
     {
         // Evaluation order:
         // arg0 lookup_value, arg1 table_array, arg3 range_lookup, find lookup value, arg2 col_index, fetch result
         ValueEval   lookupValue   = OperandResolver.GetSingleValue(lookup_value, srcRowIndex, srcColumnIndex);
         TwoDEval    tableArray    = LookupUtils.ResolveTableArrayArg(table_array);
         bool        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());
     }
 }