private void KhoiTaoTapF1() { model.TapF tapf = new model.TapF(); tapf.Lable = "Tập F1"; List <string> listTemp = new List <string>(); string temp; int n = listViewTapD.Items.Count; for (int i = 0; i < n; i++) { temp = listViewTapD.Items[i].SubItems[0].Text; for (int j = 1; j <= listViewMaHoa.Items.Count; j++) { if (listViewTapD.Items[i].SubItems[j].Text == "1") { list.Add(j); listTemp.Add(j.ToString()); } } tapf.Add(temp, new List <string>(listTemp)); listTemp.Clear(); } Program.listTapF.Add(tapf); TapFToListView(tapf); }
private void TapC_To_TapF() { List <string> listStr = new List <string>(); List <string> listResult = new List <string>(); List <string> listTemp = new List <string>(); string[] check; string resultLast; string resultNearLast; foreach (var t in Program.listTapL[k]) { foreach (string str in t.Key) { listStr.Add(str); } } listResult = Tim_TapC_Tu_TapL(listStr, k + 1); //foreach (string str in listResult) //{ // // Console.WriteLine("Tap C: " + str); //} if (listResult.Count == 0) { MessageBox.Show("Thuật toán kết thúc!"); Form3 frm = new Form3(k); frm.ShowDialog(); } model.TapF tapf = new model.TapF(); tapf.Lable = "Tập F" + ((k + 2).ToString()); foreach (var t in Program.listTapF[k]) { foreach (string str in listResult) { check = str.Split(' '); if (check.Length >= 2) { resultLast = xoaPhanTuCuoi(str); resultNearLast = xoaPhanTuKeCuoi(str); //Console.WriteLine("Last: Near Last: "+resultLast+": "+resultNearLast); tempChar = ""; if (t.Value.Contains(resultLast)) { if (t.Value.Contains(resultNearLast)) { listTemp.Add(str); listToTapL.Add(str); } } } } //foreach (string str in listTemp ) //{ // Console.WriteLine("Tap D: " + str); //} if (listTemp.Any()) { tapf.Add(t.Key, new List <string>(listTemp)); listTemp.Clear(); } } Program.listTapF.Add(tapf); TapFToListView(tapf); TapF_To_TapL(listToTapL); }