Example #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());
        }
Example #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());
        }
Example #3
0
 public void Append(JSGFRule rule)
 {
     if (Rules == null)
     {
         throw new NullReferenceException("null rule to append");
     }
     Rules.Add(rule);
 }
Example #4
0
 public void Append(JSGFRule rule)
 {
     Debug.Assert(rule != null);
     Rules.Add(rule);
     if (Weights != null)
     {
         Weights.Add(1.0f);
     }
 }
Example #5
0
 public JSGFRuleCount(JSGFRule rule, int count)
 {
     Rule  = rule;
     Count = count;
 }
Example #6
0
 public JSGFRuleTag(JSGFRule rule, String tag)
 {
     Rule = rule;
     Tag  = tag;
 }