Ejemplo n.º 1
0
        /** <summary>
         *  Return a list of all template sigs that are present in the group, but
         *  that have wrong formal argument lists.  Return null if all is well.
         *  </summary>
         */
        public virtual IList <string> GetMismatchedTemplates(StringTemplateGroup group)
        {
            List <string> mismatched = new List <string>();

            foreach (TemplateDefinition d in _templates.Values)
            {
                if (group.IsDefined(d.name))
                {
                    StringTemplate defST      = group.GetTemplateDefinition(d.name);
                    var            formalArgs = defST.FormalArguments;
                    bool           ack        = false;
                    if ((d.formalArgs != null && formalArgs == null) ||
                        (d.formalArgs == null && formalArgs != null) ||
                        d.formalArgs.Count != formalArgs.Count)
                    {
                        ack = true;
                    }
                    if (!ack)
                    {
                        foreach (var arg in formalArgs)
                        {
                            FormalArgument arg2;
                            if (!d.formalArgs.TryGetValue(arg.name, out arg2) || arg2 == null)
                            {
                                ack = true;
                                break;
                            }
                        }
                    }
                    if (ack)
                    {
                        //System.out.println(d.formalArgs+"!="+formalArgs);
                        mismatched.Add(GetTemplateSignature(d));
                    }
                }
            }
            if (mismatched.Count == 0)
            {
                mismatched = null;
            }
            return(mismatched);
        }