예제 #1
0
파일: source.cs 프로젝트: speane/Metrix
        //  возвращает модель представления
        public ViewModel Information()
        {
            ViewModel result = new ViewModel();
            int MainCC = 0;
            int MainMeyersCC = 0;
            result.Functions = Functions;

            int commonCC = Functions.Count() + setCC(Inner);
            int funcCC = 0;
            foreach (var f in Functions)
            {
                funcCC += f.CC;
            }
            if ((commonCC - funcCC) > 1)
            {
                MainCC = commonCC - funcCC;
            }
            else
            {
                MainCC = 0;
            }

            int commonMeyersCC = Functions.Count() + MeyersCC(Inner);
            int funcMeyersCC = 0;
            foreach (var f in Functions)
            {
                funcMeyersCC += f.MeyersCC;
            }
            if ((commonMeyersCC - funcMeyersCC) > 1)
            {
                MainMeyersCC = commonMeyersCC - funcMeyersCC;
            }
            else
            {
                MainMeyersCC = 0;
            }

            result.MainCC = MainCC;
            result.MainMeyers = MainMeyersCC;

            return result;
        }
예제 #2
0
        public ViewModel Information()
        {
            string mcCabeInfo = "";
            string meyersInfo = "";
            int mcCabeCC = 1;
            int meyersCC = 1;
            foreach (var s in Strings)
            {
                s.CC = getCCOfString(s.Value);
                s.MeyersCC = getMeyersCCOfString(s.Value);
                mcCabeInfo += s.CC + "____"+ s.Value + "\n";
                meyersInfo += s.MeyersCC + "____" + s.Value + "\n";
                mcCabeCC += s.CC;
                meyersCC += s.MeyersCC;
            }
            ViewModel result = new ViewModel();
            result.McCabeInfo = mcCabeInfo + "\n\n" + mcCabeCC;
            result.MeyersInfo = meyersInfo + "\n\n" + meyersCC;
            result.MainCC = mcCabeCC;
            result.MainMeyers = meyersCC;

            return result;
        }