Ejemplo n.º 1
0
        protected override StatisticsResult Compare(StatisticsResult[] results)
        {
            if (results.Length != 2)
            {
                throw new ArgumentException(
                          "Should have 2 values, instead got " +
                          results.Length.ToString());
            }

            StatisticsResult denominator = results[0];
            StatisticsResult numerator   = results[1];

            StatisticsResult ret_r = (StatisticsResult)denominator.Clone();

            if (numerator == null)
            {
                return(null); // YM-625 / SUPPORT-5338

                /*
                 * ret_r.Value = 0;
                 * return ret_r;
                 */
            }

            if (denominator.Value == null || denominator.Value == 0)
            {
                ret_r.Value = 0;
                return(ret_r);
            }

            ret_r.Value = numerator.Value / denominator.Value;

            return(ret_r);
        }
        protected override StatisticsResult Compare(StatisticsResult[] results)
        {
            if (results.Length != 2)
            {
                throw new ArgumentException(
                          "Should have 2 values, instead got " +
                          results.Length.ToString());
            }

            StatisticsResult refval = results[0]; // value we compare against
            StatisticsResult val    = results[1]; // actual value

            StatisticsResult ret_r;

            /* we assume here that refval and val are never both null */

            if (refval == null)   // ref null, nothing to do
            {
                return((StatisticsResult)val.Clone());
            }

            if (val == null)   // val null, create a fake result from ref
            {
                ret_r       = (StatisticsResult)refval.Clone();
                ret_r.Value = 0;
            }
            else
            {
                ret_r = (StatisticsResult)val.Clone();
            }

            if (refval.Value <= this.Limit.GreaterThan)
            {
                ret_r.Value = null;
                ret_r.PrivacyLimitTriggered = true;
            }

            return(ret_r);
        }