示例#1
0
        public void EditNode(string kl, InfElem infEl)
        {
            if (infEl.kl != kl)
            {
                throw new MyExcept("Ошибка! Разные ключи!");
            }
            ElemTree elem = FindNode(r, kl);

            if (elem == null)
            {
                throw new MyExcept("Узел с таким ключем не найден!");
            }
            elem.D.sokrName = infEl.sokrName;
            elem.D.name     = infEl.name;
        }
示例#2
0
        private void but_Add_Click(object sender, EventArgs e)
        {
            string skrName, name, kl, txt_search;

            skrName    = text_skr.Text;
            name       = text_inf.Text;
            kl         = text_key.Text;
            txt_search = text_task.Text;
            try {
                InfElem elem = new InfElem(skrName, name, kl);
                T.Add_Node(txt_search, elem);
            }catch (MyExcept ex) {
                MessageBox.Show(ex.Message);
            }
        }
示例#3
0
        private void but_edit_Click(object sender, EventArgs e)
        {
            string skrName, name, kl;

            skrName = text_skr.Text;
            name    = text_inf.Text;
            kl      = text_key.Text;
            try {
                InfElem elem = new InfElem(skrName, name, kl);
                T.EditNode(text_key.Text, elem);
            } catch (MyExcept ex) {
                MessageBox.Show(ex.Message);
            } catch (Exception ex1) {
                MessageBox.Show(ex1.Message);
            }
        }
示例#4
0
        private void butCreate_Click(object sender, EventArgs e)
        {
            string skrName, name, kl;

            skrName = text_skr.Text;
            name    = text_inf.Text;
            kl      = text_key.Text;
            if (kl == "" || name == "" || skrName == "")
            {
                MessageBox.Show("Вы не заполнили все поля!");
                return;
            }
            InfElem elem = new InfElem(skrName, name, kl);

            T = new Tree(elem);
            textBox_test.Clear();
        }
示例#5
0
        public void Add_Node(string Tkey, InfElem Tinf)
        {
            ElemTree elem = FindNode(r, Tkey);

            if (elem == null)
            {
                throw new MyExcept("Узел с таким ключем не найден!");
            }

            if (elem.FL == null)
            {
                elem.FL = new ElemTree(Tinf);
            }
            else
            {
                ElemTree temp = elem.FL;
                while (temp.FR != null)
                {
                    temp = temp.FR;
                }
                temp.FR = new ElemTree(Tinf);
            }
        }
示例#6
0
 public Tree(InfElem inf)
 {
     r = new ElemTree(inf);
 }
示例#7
0
 public ElemTree(InfElem d)
 {
     this.D  = d;
     this.FL = null;
     this.FR = null;
 }