public float CalculateNameLength(NameCalculator i_NameCalculator)
        {
            AverageLengthName = 0.0f;

            if (i_NameCalculator.CalculateRequest == eCalculateRequest.Average)
            {
                int countChars = 0;

                foreach (string userName in i_NameCalculator.UserNameList())
                {
                    countChars += userName.Length;
                }

                AverageLengthName = countChars / i_NameCalculator.UserNameList().Count();
            }
            else
            {
                AverageLengthName = this.NextInChain.CalculateNameLength(i_NameCalculator);
            }

            return(AverageLengthName);
        }
示例#2
0
        public float SetAndCalcByUserChoice(List <string> i_UserNameList, eCalculateRequest i_eCalculateRequest)
        {
            NameCalculator nameCalculator = new NameCalculator(i_UserNameList, i_eCalculateRequest);

            return(m_AvgChain.CalculateNameLength(nameCalculator));
        }