Ejemplo n.º 1
0
        /// <summary>
        /// Get all the category sofs in the split
        /// </summary>
        /// <param name="s">the split</param>
        /// <returns>SoFs list</returns>
        private List <int> CalcSplitSofs(Split s)
        {
            s.RefreshSofs();

            List <int> classesSof = new List <int>();

            foreach (var carclass in carclasses)
            {
                int classid    = carclass.CarClassId;
                int classindex = carClassesIds.IndexOf(classid);

                classesSof.Add(s.GetClassSof(classindex));
            }

            return(classesSof);
        }
Ejemplo n.º 2
0
        private void EvalDifference()
        {
            Evaluated = true;

            // get each class SoFs in this split
            // and keep min and max
            int classSof = 0;

            if (ClassIndex == -1)
            {
                classSof = Split.GlobalSof;
            }
            else
            {
                classSof = Split.GetClassSof(ClassIndex);
            }
            int min = classSof;

            MaxSofInSplit = Split.GetMaxClassSof(ClassIndex); // max of other classes
            if (MaxSofInSplit == 0)
            {
                MaxSofInSplit = classSof;
            }
            // -->

            // exit if 0
            if (min == 0 && MaxSofInSplit == 0)
            {
                Evaluated = false; // we can not eval that
                return;
            }
            // -->


            double referencesof = classSof;

            if (classSof == 0)
            {
                referencesof = min;
            }
            ClassSof = Convert.ToInt32(referencesof);
            // -->

            // difference in % between min and max

            double a = referencesof;
            double b = MaxSofInSplit;

            if (a == 0 || b == 0)
            {
                PercentDifference = 0;
                return;
            }


            int diff = 100 - Convert.ToInt32(Math.Round(100 * a / b));

            diff = Math.Max(diff, 0);
            PercentDifference = diff;
            // -->
        }