Esempio n. 1
0
 private void GenerateGroups()
 {
     G1 = new KeywordGroup("oil");
     G1.SelectedKeywords.AddKeyword("pan");
     G2 = new KeywordGroup("transmission");
     G3 = new KeywordGroup("oil");
     G3.SelectedKeywords.AddKeyword("leak");
 }
Esempio n. 2
0
        public void TestGenerateSubGroups()
        {
            KeywordGroup g = new KeywordGroup("oil");

            g.UpdateMembers(Exs1);
            var groups = g.GenerateSubGroups(2, 1);

            Assert.AreEqual(groups.Count, 9);

            g = new KeywordGroup("leak");
            var tempex = new ClaimableKeywordExample(new KeywordExample());

            tempex.ContainedExample.AddKeyword("exhaust");
            tempex.ContainedExample.AddKeyword("leak");
            Exs1.Add(tempex);
            g.UpdateMembers(Exs1);
            groups = g.GenerateSubGroups(2, 1);
            Assert.AreEqual(groups.Count, 5);
            var tempGroup = new KeywordGroup("leak");

            tempGroup.SelectedKeywords.AddKeyword("oil");
            Assert.IsTrue(groups.Contains(tempGroup));
        }
Esempio n. 3
0
        private static void processCategory(XmlWriter xmlWriter, Collection <KeywordGroup> groups, string category)
        {
            string[] parts = removeSpecialCategories(category);
            if (parts == null)
            {
                return;
            }

            if (parts.Length == 1)
            {
                foreach (KeywordGroup keywordGroup in groups)
                {
                    if (keywordGroup.Name == parts[0])
                    {
                        return;
                    }
                }

                KeywordGroup singleGroup = new KeywordGroup(parts[0]);
                singleGroup.Keywords.Add("All");
                groups.Add(singleGroup);
                return;
            }

            foreach (KeywordGroup group in groups)
            {
                if (group.Name == parts[0])
                {
                    for (int index = 1; index < parts.Length; index++)
                    {
                        bool keywordFound = false;

                        foreach (string keyword in group.Keywords)
                        {
                            if (keyword == parts[index])
                            {
                                keywordFound = true;
                            }
                        }

                        if (!keywordFound)
                        {
                            if (group.Keywords.Count == 0)
                            {
                                group.Keywords.Add("All");
                            }
                            group.Keywords.Add(parts[index]);
                        }
                    }

                    return;
                }
            }

            KeywordGroup newGroup = new KeywordGroup(parts[0]);

            newGroup.Keywords.Add("All");

            for (int partAddIndex = 1; partAddIndex < parts.Length; partAddIndex++)
            {
                newGroup.Keywords.Add(parts[partAddIndex]);
            }

            groups.Add(newGroup);
        }
Esempio n. 4
0
        private static void processCategory(XmlWriter xmlWriter, Collection<KeywordGroup> groups, string category)
        {
            string[] parts = removeSpecialCategories(category);
            if (parts == null)
                return;

            if (parts.Length == 1)
            {
                foreach (KeywordGroup keywordGroup in groups)
                {
                    if (keywordGroup.Name == parts[0])
                        return;
                }

                KeywordGroup singleGroup = new KeywordGroup(parts[0]);
                singleGroup.Keywords.Add("All");
                groups.Add(singleGroup);
                return;
            }

            foreach (KeywordGroup group in groups)
            {
                if (group.Name == parts[0])
                {
                    for (int index = 1; index < parts.Length; index++)
                    {
                        bool keywordFound = false;

                        foreach (string keyword in group.Keywords)
                        {
                            if (keyword == parts[index])
                                keywordFound = true;
                        }

                        if (!keywordFound)
                        {
                            if (group.Keywords.Count == 0)
                                group.Keywords.Add("All");
                            group.Keywords.Add(parts[index]);
                        }
                    }

                    return;
                }
            }

            KeywordGroup newGroup = new KeywordGroup(parts[0]);
            newGroup.Keywords.Add("All");

            for (int partAddIndex = 1; partAddIndex < parts.Length; partAddIndex++)
                newGroup.Keywords.Add(parts[partAddIndex]);

            groups.Add(newGroup);
        }