/* this method checks if the namingconventions for methods
         * set by the user are met for all documents in the project
         */
        public void Methodnaming(
            List <MethodDeclarationSyntax> list,
            List <string> permittedMethods,
            Document document,
            MainWindowControl.NameCase nameCaseMethod)
        {
            list.ForEach(delegate(MethodDeclarationSyntax mds)
            {
                string currentMethodName = mds.Identifier.ToString();
                string regexmatchstring  = currentMethodName;

                /* permitted special signs get treated like
                 * they are not part of the methodname
                 */
                if (permittedMethods.Equals(""))
                {
                    permittedMethods.ForEach(delegate(string permitted)
                    {
                        regexmatchstring =
                            regexmatchstring.Replace(
                                permitted,
                                "");
                    });
                }

                /* determin whether the method name
                 * only contains letters of the abc
                 */
                if (Regex.Matches(regexmatchstring, @"[a-zA-Z ]").
                    Count == regexmatchstring.Length)
                {
                    //check if camelCase constraint is violated
                    if (char.IsUpper(regexmatchstring[0]) && nameCaseMethod.
                        Equals(MainWindowControl.NameCase.camelCase))
                    {
                        int line = mds.GetLocation().GetMappedLineSpan().
                                   StartLinePosition.Line;
                        ErrorReporter.AddWarning(
                            "Method name should be camelCase : "
                            + mds.Identifier,
                            document.FilePath,
                            line);
                    }
                    //check if PascalCase constraint is violated
                    if (char.IsLower(regexmatchstring[0]) && nameCaseMethod.
                        Equals(MainWindowControl.NameCase.PascalCase))
                    {
                        int line = mds.GetLocation().GetMappedLineSpan().
                                   StartLinePosition.Line;
                        ErrorReporter.AddWarning(
                            "Method name should be PascalCase : "
                            + mds.Identifier,
                            document.FilePath,
                            line);
                    }
                }
                else
                {
                    int line = mds.GetLocation().GetMappedLineSpan().
                               StartLinePosition.Line;
                    ErrorReporter.AddWarning(
                        "Illegal character in method name : "
                        + mds.Identifier,
                        document.FilePath,
                        line);
                }
            });
        }
        /* The CheckNaming Method which is called from the
         * MainWindowControl.xaml.cs when the assigned button is pressed
         */
        public void CheckNaming(
            List <Document> documents,
            List <string> permittedMethods,
            List <string> permittedVariables,
            List <string> permittedProperties,
            bool isMethodChecked,
            bool isVariableChecked,
            bool isClassChecked,
            bool isPropertyChecked,
            bool isNamespaceChecked,
            MainWindowControl.NameCase nameCaseMethod,
            MainWindowControl.NameCase nameCaseVariable,
            MainWindowControl.NameCase nameCaseProperty)
        {
            foreach (var document in documents)
            {
                if (document != null)
                {
                    //getting the Syntax Tree for the current document
                    SyntaxTree        tree;
                    Task <SyntaxTree> t = document.GetSyntaxTreeAsync();
                    tree = t.Result;
                    if (isMethodChecked)
                    {
                        List <MethodDeclarationSyntax> list =
                            tree.GetRoot().DescendantNodes().
                            OfType <MethodDeclarationSyntax>().ToList();

                        Methodnaming(
                            list,
                            permittedMethods,
                            document,
                            nameCaseMethod);
                    }
                    if (isVariableChecked)
                    {
                        List <VariableDeclaratorSyntax> list =
                            tree.GetRoot().DescendantNodes().
                            OfType <VariableDeclaratorSyntax>().ToList();

                        Variablenaming(
                            list,
                            permittedVariables,
                            document,
                            nameCaseVariable);
                    }
                    if (isClassChecked)
                    {
                        List <ClassDeclarationSyntax> list =
                            tree.GetRoot().DescendantNodes().
                            OfType <ClassDeclarationSyntax>().ToList();

                        Classnaming(list, document);
                    }
                    if (isPropertyChecked)
                    {
                        List <PropertyDeclarationSyntax> list =
                            tree.GetRoot().DescendantNodes().
                            OfType <PropertyDeclarationSyntax>().ToList();

                        Propertynaming(
                            list,
                            permittedProperties,
                            document,
                            nameCaseProperty);
                    }
                    if (isNamespaceChecked)
                    {
                        List <NamespaceDeclarationSyntax> list =
                            tree.GetRoot().DescendantNodes().
                            OfType <NamespaceDeclarationSyntax>().ToList();

                        List <string> folders = document.Folders.ToList();
                        String        projekt = document.Project.Name;
                        Namespacenaming(list, projekt, folders, document);
                    }
                }
            }
        }