Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Startup from CS Testing");

            var sax = new SAX();
            var db  = new Database();

            Console.ReadKey();
        }
Example #2
0
        public void TestSax1()
        {
            List <string> list = new List <string> {
                "asda", "asdava", "sdasd", "sad", "dasa"
            };
            string pattern = null;

            Assert.AreEqual(false, SAX.Contains(list, pattern));
        }
Example #3
0
        public void TestSax2()
        {
            List <string> list = new List <string> {
                null, "asdava", "sdasd", "sad", "dasa"
            };
            string pattern = "sad";

            Assert.AreEqual(true, SAX.Contains(list, pattern));
        }
Example #4
0
    private void FindBooks()
    {
        if (spinbuttonDateFrom.ValueAsInt > spinbuttonDateTo.ValueAsInt ||
            spinbuttonPagesFrom.ValueAsInt > spinbuttonPagesTo.ValueAsInt)
        {
            MessageDialog dialog = new MessageDialog(this, DialogFlags.Modal,
                                                     MessageType.Error, ButtonsType.Ok, "gddhfdh");
            dialog.Text = "Некоректно введені дата або кількість сторінок";
            dialog.Run();
            dialog.Destroy();
            return;
        }
        Book book = new Book
        {
            title     = comboboxTitle.ActiveText == null ? "" : comboboxTitle.ActiveText,
            author    = comboboxAuthor.ActiveText == null ? "" : comboboxAuthor.ActiveText,
            genre     = comboboxGenre.ActiveText == null ? "" : comboboxGenre.ActiveText,
            language  = comboboxLanguage.ActiveText == null ? "" : comboboxLanguage.ActiveText,
            dateFrom  = spinbuttonDateFrom.ValueAsInt,
            dateTo    = spinbuttonDateTo.ValueAsInt,
            pagesFrom = spinbuttonPagesFrom.ValueAsInt,
            pagesTo   = spinbuttonPagesTo.ValueAsInt
        };


        ISearchAlgoritm algoritm;

        if (radiobuttonDOM.Active)
        {
            algoritm = new DOM();
        }
        else if (radiobuttonSAX.Active)
        {
            algoritm = new SAX();
        }
        else
        {
            algoritm = new LINQ();
        }

        XmlDocument xDoc = algoritm.Search(book, lastxDoc);

        comboboxTitle.Model    = new ListStore(typeof(string), typeof(string));
        comboboxGenre.Model    = new ListStore(typeof(string), typeof(string));
        comboboxLanguage.Model = new ListStore(typeof(string), typeof(string));
        comboboxAuthor.Model   = new ListStore(typeof(string), typeof(string));
        OpenData(xDoc);
        lastxDoc = xDoc;
    }