Example #1
0
        private static string GetNonFinalRuleInfo <S>(int k, IAutomaton <S> aut, ITransducer <S> trans, int source, int target, List <S> rules, Func <S, string> describeS = null)
        {
            if (describeS == null)
            {
                describeS = aut.DescribeLabel;
            }

            string lab  = "";
            string info = "";

            for (int i = 0; i < rules.Count; i++)
            {
                lab += (lab == "" ? "" : ", ") + describeS(rules[i]);
                if (trans != null)
                {
                    info += string.Format("Rule{0}.Guard = \"{1}\" Rule{0}.Update = \"{2}\" Rule{0}.Yields = \"{3}\" ", i + 1,
                                          EncodeChars(trans.DescribeGuard(rules[i])),
                                          EncodeChars(trans.DescribeUpdate(rules[i])),
                                          EncodeChars(trans.DescribeYields(rules[i])));
                }
            }
            if (k >= 0 && lab.Length > k)
            {
                lab = lab.Substring(0, k) + "...";
            }
            lab = EncodeChars(lab);
            if (lab.Length > 50)
            {
                info += string.Format(" HiddenLabel = \"{0}\"", lab);
                lab   = "...";
            }
            return(string.Format("<Link Source=\"{0}\" Target=\"{1}\" Label=\"{2}\" Category=\"NonepsilonTransition\" {3}/>", source, target, lab, info));
        }