/** <summary> * Return a list of all template names missing from group that are defined * in this interface. Return null if all is well. * </summary> */ public virtual IList<string> GetMissingTemplates( StringTemplateGroup group ) { string[] missing = _templates.Values .Where( template => !template.optional && !group.IsDefined( template.name ) ) .Select( template => template.name ) .ToArray(); return ( missing.Length == 0 ) ? null : missing; }
/** <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; }