Ejemplo n.º 1
0
 public static int CountArg(ValueEval eval, I_MatchPredicate criteriaPredicate)
 {
     if (eval == null)
     {
         throw new ArgumentException("eval must not be null");
     }
     if (eval is AreaEval)
     {
         return(CountUtils.CountMatchingCellsInArea((AreaEval)eval, criteriaPredicate));
     }
     if (eval is RefEval)
     {
         return(CountUtils.CountMatchingCell((RefEval)eval, criteriaPredicate));
     }
     return(criteriaPredicate.Matches(eval) ? 1 : 0);
 }
Ejemplo n.º 2
0
        /**
         * @return the number of Evaluated cells in the range that match the specified criteria
         */
        private ValueEval CountMatchingCellsInArea(ValueEval rangeArg, I_MatchPredicate criteriaPredicate)
        {
            int result;

            if (rangeArg is RefEval)
            {
                result = CountUtils.CountMatchingCell((RefEval)rangeArg, criteriaPredicate);
            }
            else if (rangeArg is AreaEval)
            {
                result = CountUtils.CountMatchingCellsInArea((AreaEval)rangeArg, criteriaPredicate);
            }
            else
            {
                throw new ArgumentException("Bad range arg type (" + rangeArg.GetType().Name + ")");
            }
            return(new NumberEval(result));
        }