Ejemplo n.º 1
0
        public void funcsCountAndCodeFuncCallsComp(coupleComp c)
        {
            List <myrow> l = new List <myrow>();
            List <functionCallCounter> temp1 = new List <functionCallCounter>(c.f1.result.allCodeFunctionCalls);
            List <functionCallCounter> temp2 = new List <functionCallCounter>(c.f2.result.allCodeFunctionCalls);

            int temp1funcs      = temp1.Count();
            int temp2funcs      = temp2.Count();
            int temp1funcsCount = 0;
            int temp2funcsCount = 0;

            foreach (functionCallCounter tt in temp1)
            {
                temp1funcsCount += tt.getCount();
            }
            foreach (functionCallCounter tt in temp2)
            {
                temp2funcsCount += tt.getCount();
            }
            //System.Windows.Forms.MessageBox.Show(temp1funcs.ToString()+" "+ temp2funcs.ToString());
            //System.Windows.Forms.MessageBox.Show(temp1funcsCount.ToString() + " " + temp2funcsCount.ToString());
            l.Add(new myrow(temp1funcs, temp2funcs, "functions count", c.f1.name, c.f2.name));
            if (temp1funcsCount != 0 || temp2funcsCount != 0)
            {
                l.Add(new myrow(temp1funcsCount, temp2funcsCount, "functions call count", c.f1.name, c.f2.name));
            }
            c.refreshResult(l);
        }
Ejemplo n.º 2
0
        public void varsComp(coupleComp c)
        {
            List <myrow>           l     = new List <myrow>();
            List <variableCounter> temp1 = new List <variableCounter>(c.f1.result.varsAllFile);
            List <variableCounter> temp2 = new List <variableCounter>(c.f2.result.varsAllFile);

            int temp1funcs      = temp1.Count();
            int temp2funcs      = temp2.Count();
            int temp1funcsCount = 0;
            int temp2funcsCount = 0;

            foreach (variableCounter tt in temp1)
            {
                temp1funcsCount += tt.getCount();
            }
            foreach (variableCounter tt in temp2)
            {
                temp2funcsCount += tt.getCount();
            }
            l.Add(new myrow(temp1funcs, temp2funcs, "functions count", c.f1.name, c.f2.name));
            if (temp1funcsCount != 0 || temp2funcsCount != 0)
            {
                l.Add(new myrow(temp1funcsCount, temp2funcsCount, "functions call count", c.f1.name, c.f2.name));
            }
            c.refreshResult(l);
        }
Ejemplo n.º 3
0
        public coupleComp compare(cppFile f1, cppFile f2, params int[] x)
        {
            coupleComp c = new coupleComp();

            c.f1    = f1;
            c.f2    = f2;
            c.file1 = f1.name;
            c.file2 = f2.name;

            foreach (int d in x)
            {
                detrminMethod(c, d);
            }
            return(c);
        }
Ejemplo n.º 4
0
        public void funcsComp(coupleComp c)
        {
            List <myrow> l = new List <myrow>();
            List <functionCallCounter> temp1 = new List <functionCallCounter>(c.f1.result.allFrequentlyUsedFunctionCalls);
            List <functionCallCounter> temp2 = new List <functionCallCounter>(c.f2.result.allFrequentlyUsedFunctionCalls);

            foreach (functionCallCounter t2 in temp2)
            {
                int a = temp1.Find(aa => aa.getLexeme() == t2.getLexeme()).getCount();
                int b = t2.getCount();
                if ((a != 0) || (b != 0))
                {
                    l.Add(new myrow(a, b, t2.getLexeme(), c.f1.name, c.f2.name));
                }
            }
            c.refreshResult(l);
        }
Ejemplo n.º 5
0
        public void detrminMethod(coupleComp c, int x)
        {
            switch (x)
            {
            case 1:
                operationsComp(c);
                break;

            case 2:
                keyowrdComp(c);
                break;

            case 3:
                dataTypesComp(c);
                break;

            case 4:
                valuesComp(c);
                break;

            case 5:
                funcsComp(c);
                break;

            case 6:
                librariesComp(c);
                break;

            case 7:
                funcsCountAndCodeFuncCallsComp(c);
                break;

            case 8:    //not used XXX
                varsComp(c);
                break;
            }
        }
Ejemplo n.º 6
0
        public void dataTypesComp(coupleComp c)
        {
            List <myrow>        l     = new List <myrow>();
            List <tokenCounter> temp1 = new List <tokenCounter>(c.f1.result.dataTypesAllFile);
            List <tokenCounter> temp2 = new List <tokenCounter>(c.f2.result.dataTypesAllFile);

            foreach (tokenCounter tt in temp1)
            {
                if (!temp2.Select(a => a.getLexeme()).Contains(tt.getLexeme()))
                {
                    tokenCounter tc = tt.copy();
                    tc.setCount(0);
                    temp2.Add(tc);
                }
            }
            foreach (tokenCounter tt in temp2)
            {
                if (!temp1.Select(a => a.getLexeme()).Contains(tt.getLexeme()))
                {
                    tokenCounter tc = tt.copy();
                    tc.setCount(0);
                    temp1.Add(tc);
                }
            }

            foreach (tokenCounter t2 in temp2)
            {
                int a = temp1.Find(aa => aa.getLexeme() == t2.getLexeme()).getCount();
                int b = t2.getCount();
                if ((a != 0) || (b != 0))
                {
                    l.Add(new myrow(a, b, t2.getLexeme(), c.f1.name, c.f2.name));
                }
            }
            c.refreshResult(l);
        }