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; }
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); } }
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); } }
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(); }
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); } }
public Tree(InfElem inf) { r = new ElemTree(inf); }
public ElemTree(InfElem d) { this.D = d; this.FL = null; this.FR = null; }