示例#1
0
        public override String ToString()
        {
            if (Rules.Count == 0)
            {
                return("<NULL>");
            }
            var sb = new StringBuilder();

            for (int i = 0; i < Rules.Count; ++i)
            {
                if (i > 0)
                {
                    sb.Append(' ');
                }

                JSGFRule r = Rules[i];
                if ((r is JSGFRuleAlternatives) || (r is JSGFRuleSequence))
                {
                    sb.Append("( ").Append(r).Append(" )");
                }
                else
                {
                    sb.Append(r);
                }
            }
            return(sb.ToString());
        }
示例#2
0
        public override String ToString()
        {
            if (Rules == null || Rules.Count == 0)
            {
                return("<VOID>");
            }
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < Rules.Count; ++i)
            {
                if (i > 0)
                {
                    sb.Append(" | ");
                }

                if (Weights != null)
                {
                    sb.Append("/" + Weights[i] + "/ ");
                }

                JSGFRule r = Rules[i];
                if (Rules[i] is JSGFRuleAlternatives)
                {
                    sb.Append("( ").Append(r).Append(" )");
                }
                else
                {
                    sb.Append(r);
                }
            }
            return(sb.ToString());
        }
示例#3
0
 public void Append(JSGFRule rule)
 {
     if (Rules == null)
     {
         throw new NullReferenceException("null rule to append");
     }
     Rules.Add(rule);
 }
示例#4
0
 public void Append(JSGFRule rule)
 {
     Debug.Assert(rule != null);
     Rules.Add(rule);
     if (Weights != null)
     {
         Weights.Add(1.0f);
     }
 }
示例#5
0
 public JSGFRuleCount(JSGFRule rule, int count)
 {
     Rule  = rule;
     Count = count;
 }
示例#6
0
 public JSGFRuleTag(JSGFRule rule, String tag)
 {
     Rule = rule;
     Tag  = tag;
 }