Exemple #1
0
        public static int FindChandamNumber(object[][] Rules)
        {
            if (Rules == null || Rules.Length == 0)
            {
                return(0);
            }

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

            foreach (object _Rule in Rules[0])
            {
                if (_Rule.GetType() == typeof(string))
                {
                    int[] GBinary = GDefinition.GBinaray((string)_Rule);
                    //Scriptsharp fix .. Otherwise Can use AddRange..
                    foreach (int i in GBinary)
                    {
                        Binary.Add(i);
                    }
                }
            }

            double tot_invert = 0;

            for (int i = 0; i < Binary.Count; i++)
            {
                int    b      = Binary[i];
                double mul    = Math.Pow(2.0, (double)i);
                int    invert = 1 - b;

                tot_invert = tot_invert + (invert * mul);
            }
            return((int)tot_invert + 1);
        }
Exemple #2
0
        private static string RuleText(RuleType ruleType, object o)
        {
            switch (ruleType)
            {
            case RuleType.Name:
            {
                return(GDefinition.GAlias((string)o));
            }

            case RuleType.Type:
            {
                Category Cat = (Category)o;
                return(GDefinition.CategoryString(Cat));
            }

            case RuleType.SubType:
            {
                SubCategory Cat = (SubCategory)o;
                return(GDefinition.SubCategoryString(Cat));
            }

            case RuleType.Weight:
            {
                int Cat = (int)o;
                return(Cat.ToString() + " మాత్రలు");
            }

            default:
            {
                return("తెలియదు");
            }
            }
        }
Exemple #3
0
        public static string SequenceToGNames(List <string> Seq)
        {
            string s = "";

            foreach (string _s in Seq)
            {
                s = s + GDefinition.GName(_s) + " , ";
            }
            s = s.Substring(0, s.Length - 2);            //Trim End..  ', '
            return(s);
        }
Exemple #4
0
        public static int CharLength(object[][] Rules)
        {
            if (Rules == null || Rules.Length == 0)
            {
                return(0);
            }

            int l = 0;

            foreach (object _Rule in Rules[0])
            {
                if (_Rule.GetType() == typeof(string))
                {
                    l = l + GDefinition.GLength((string)_Rule);
                }
            }
            return(l);
        }
Exemple #5
0
        public static int MaxCharLength(object[][] Rules, RuleType R)
        {
            if (Rules == null || Rules.Length == 0)
            {
                return(0);
            }

            int max = 0;

            foreach (object[] LineRule in Rules)
            {
                int l = 0;
                foreach (object Rule in LineRule)
                {
                    int local = 0;
                    switch (R)
                    {
                    case RuleType.Name:
                        local = GDefinition.MaxThreshold2((string)Rule);
                        break;

                    case RuleType.SubType:
                        local = GDefinition.MaxThreshold3((SubCategory)Rule);
                        break;

                    case RuleType.Type:
                        local = GDefinition.MaxThreshold((Category)Rule);
                        break;

                    case RuleType.Weight:
                        local = GDefinition.MaxThreshold4((int)Rule);
                        break;
                    }
                    l = l + local;
                }
                if (l > max)
                {
                    max = l;
                }
            }
            return(max);
        }
Exemple #6
0
        public static string BuildSequence(object[][] Rules)
        {
            if (Rules == null || Rules.Length == 0)
            {
                return("");
            }

            string l = "";

            foreach (object _Rule in Rules[0])
            {
                if (_Rule.GetType() == typeof(string))
                {
                    l = l + GDefinition.GetSymbols((string)_Rule) + "-";
                }
            }

            if (l.EndsWith("-"))
            {
                l = l.Substring(0, l.Length - 1);
            }
            return(l);
        }
Exemple #7
0
        public static int CalcThreshold(Rule R)
        {
            int threshold = 0;

            foreach (object[] LineRule in R.Rules)
            {
                foreach (object Rule in LineRule)
                {
                    int local = 0;
                    switch (R.RuleType)
                    {
                    case RuleType.Name:
                        local = GDefinition.Threshold2((string)Rule);
                        break;

                    case RuleType.SubType:
                        local = GDefinition.Threshold3((SubCategory)Rule);
                        break;

                    case RuleType.Type:
                        local = GDefinition.Threshold((Category)Rule);
                        break;

                    case RuleType.Weight:
                        local = GDefinition.Threshold4((int)Rule);
                        break;
                    }

                    if (local > threshold)
                    {
                        threshold = local;
                    }
                }
            }
            return(threshold);
        }