Example #1
0
        private static string GetFinalRuleInfo <S>(int k, ITransducer <S> trans, int state, List <S> rules)
        {
            if (trans == null)
            {
                throw new AutomataException(AutomataExceptionKind.InternalError);
            }

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

            for (int i = 0; i < rules.Count; i++)
            {
                lab  += (lab == "" ? "" : ", ") + trans.DescribeLabel(rules[i]);
                info += string.Format("Rule{0}.Guard = \"{1}\" Rule{0}.Yields = \"{2}\" ", i + 1,
                                      EncodeChars(trans.DescribeGuard(rules[i])), EncodeChars(trans.DescribeYields(rules[i])));
            }
            if (k >= 0 && lab.Length > k)
            {
                lab = lab.Substring(0, k) + "...";
            }
            lab = EncodeChars(lab);
            return(string.Format("<Link Source=\"{0}\" Target=\"f{0}\" Label=\"{1}\" Category=\"FinalLabel\" {2}/>", state, lab, info));
        }