/// <summary> /// Gibt Lautwandel aus. /// </summary> /// <returns>The sound change.</returns> public void PrintSoundChange(SoundChangeRule scr, Wordform wf2, MainWindow win_) { Functions.reflex = new Wordform(wf2.CloneWfObjectExtensions()); win_.AddToTextView(scr, wf2.lastChanges, wf2.MultiPathNum); win_.AddToTextView(wf2, true, "", "Honeydew", "", "lang1"); wf2.multiPathNum = 0; }
public Wordform ChangeSound(MainWindow win_, int?stPosPhon, int?stPosGraph, bool removeAppliedRules, bool otherChanges, List <SoundChangeRule> sortedRuleList) { /* prüft ab dem Datum der aktuellen Wortform alle Regeln * und ruft SoundChangeRule.CheckRule auf * falls eine Regel erfolgreich war: * legt sie eine neue Wortform an; * prüft sie, ob die Wortform ein gültiges nfrz. Wort ist; * und ruft sich selbst mit der neuen Wortform auf * falls nicht wird die Lautentwicklung abgebrochen * und das Wort wird der frz. Wortformerkennung übergeben */ Functions.debugText.Append("sortedRuleList: "); foreach (SoundChangeRule scr in sortedRuleList) { Functions.debugText.Append(scr.Id + ", "); } Functions.debugText.Append(Environment.NewLine); foreach (SoundChangeRule scr in sortedRuleList) { Wordform wf2 = CallCheckRuleAndHandleDependencies(scr, this, win_, stPosPhon, stPosGraph, removeAppliedRules, otherChanges, sortedRuleList); if (wf2 != null) { return(wf2); } } return(null); }
public Wordform CloneWfObjectExtensions() { Wordform wf2 = ObjectExtensions.Copy(this); if (this.suffix != null) { List <Sign> suffixCopy = this.suffix; this.suffix = wf2.Word.GetRange(wf2.Word.Count - suffixCopy.Count - 1, suffixCopy.Count); this.suffixPos = new List <int> { wf2.Word.Count - suffixCopy.Count - 1, wf2.Word.Count - suffixCopy.Count - 1 + suffixCopy.Count - 1 }; } return(wf2); }
public Wordform CallCheckRuleAndHandleDependencies(SoundChangeRule scr, Wordform wf, MainWindow win_, int?stPosPhon, int?stPosGraph, bool removeAppliedRules, bool otherChanges, List <SoundChangeRule> sortedRuleList) { Wordform wf2 = scr.CheckRule(wf, win_, stPosPhon, stPosGraph, otherChanges); if (wf2 != null) { if (otherChanges == false) { if (wf2.printRule == null) { PrintSoundChange(scr, wf2, win_); } else { PrintSoundChange(wf2.printRule, wf2, win_); wf2.printRule = null; } } if (wf2.repeatRules.Count != 0 && wf2.repeatRules.Last() == scr.Id) { wf2.repeatRules.RemoveAt(wf2.repeatRules.Count - 1); Wordform wf3 = CallCheckRuleAndHandleDependencies(scr, wf2, win_, stPosPhon, stPosGraph, removeAppliedRules, otherChanges, sortedRuleList); if (wf3 != null) { return(wf3); } } sortedRuleList.Remove(scr); sortedRuleList.RemoveAll(x => x.EndDate < wf2.time); Wordform wf4 = wf2.ChangeSound(win_, 0, 0, true, otherChanges, sortedRuleList); if ((otherChanges == true) && (wf4 != null)) { return(wf4); } else { return(wf2); } } return(null); }
/// <summary> /// Wordform zum TextView hinzufügen. /// </summary> public void AddToTextView(Wordform wf, bool changed, String comment, String color, String arrowType, String lang) { TreePath path; /* Wortform + IPA = IterNode */ List <string> shortLine = new List <string>(wf.PrintShort(comment, "")); MyTreeNode shortNode = new MyTreeNode(arrowType, Functions.SpliceText(shortLine.ElementAt(1), 20, @"\s"), shortLine.ElementAt(2), Functions.SpliceText(shortLine.ElementAt(3), 60, @"\s")); shortNode.color = color; if (changed == false) { shortNode.inputBold = 600; shortNode.inputSize = Convert.ToInt32(10 * Pango.Scale.PangoScale); } Gtk.TreeIter iter = treeStore.AppendValues(shortNode); path = treeStore.GetPath(iter); tree.ScrollToCell(path, null, true, 0, 0); /* Attribute */ bool grey = false; if (changed == true) { foreach (List <string> line in wf.PrintChanged()) { MyTreeNode node = new MyTreeNode(line.ElementAt(0), Functions.SpliceText(line.ElementAt(1), 20, @"\s"), line.ElementAt(2), Functions.SpliceText(line.ElementAt(3), 60, @"\s")); if (grey == false) { node.color = "white"; grey = true; } else { node.color = "Gray98"; grey = false; } treeStore.AppendValues(iter, node); path = treeStore.GetPath(iter); tree.ScrollToCell(path, null, true, 0, 0); } treeStore.AppendValues(iter, new MyTreeNode("", "", "", "")); path = treeStore.GetPath(iter); tree.ScrollToCell(path, null, true, 0, 0); } else { List <List <String> > print = new List <List <string> >(); if (lang == "lang1") { print = wf.Print(); } else { print = wf.PrintLang2(); } foreach (List <string> line in print) { MyTreeNode node = new MyTreeNode(line.ElementAt(0), Functions.SpliceText(line.ElementAt(1), 20, @"\s"), line.ElementAt(2), Functions.SpliceText(line.ElementAt(3), 60, @"\s")); if (grey == false) { node.color = "white"; grey = true; } else { node.color = "Gray98"; grey = false; } treeStore.AppendValues(iter, node); path = treeStore.GetPath(iter); tree.ScrollToCell(path, null, true, 0, 0); } treeStore.AppendValues(iter, new MyTreeNode("", "", "", "")); path = treeStore.GetPath(iter); tree.ScrollToCell(path, null, true, 0, 0); } while (Application.EventsPending()) { Application.RunIteration(); } }
/// <summary> /// Kopierkonstruktor mit tiefer Kopie. /// </summary> public Wordform(Wordform wf) { this.word = new List <Sign>(Functions.DeepClone(wf.Word)); if (wf.Lemma != null) { this.lemma = new List <Sign>(Functions.DeepClone(wf.Lemma)); } if (wf.Phonetic != null) { this.phonetic = new List <Sign>(Functions.DeepClone(wf.Phonetic)); } if (!String.IsNullOrEmpty(wf.Pos)) { this.pos = wf.Pos; } if (!String.IsNullOrEmpty(wf.Cat)) { this.cat = wf.Cat; } if (!String.IsNullOrEmpty(wf.Tbl)) { this.tbl = wf.Tbl; } if (!String.IsNullOrEmpty(wf.Lang)) { this.lang = wf.Lang; } if (wf.Syllables != null) { this.syllables = wf.Syllables; } this.syllNum = wf.SyllNum; if (wf.Time != null) { this.time = wf.Time; } if (wf.Additional != null) { this.additional = new Dictionary <string, string>(wf.Additional); } if (wf.MappingList != null) { this.mappingList = new List <SignMapping>(wf.MappingList); } // Vorsicht: flache Kopie: if (wf.PrintRule != null) { this.printRule = wf.PrintRule; } if (wf.lastChanges != null) { this.lastChanges = new List <Change>(Functions.DeepClone(wf.lastChanges)); } if (wf.Suffix != null) { this.suffix = Functions.DeepClone(wf.Suffix); } if (wf.SuffixPos != null) { this.suffixPos = Functions.DeepClone(wf.SuffixPos); } this.multiPathNum = wf.multiPathNum; }