Ejemplo n.º 1
0
        private void TapF_To_TapL(List <string> listSTR)
        {
            List <string> tempSTR  = new List <string>();
            List <string> tempList = new List <string>();

            model.TapL tapl = new model.TapL();
            tapl.Lable = "Tập L" + ((k + 2).ToString());

            tempSTR.AddRange(listSTR.Distinct());
            tempSTR.Sort();
            int count = 0;

            foreach (string findValue in tempSTR)
            {
                count = listSTR.Where(temp => temp.Equals(findValue))
                        .Select(temp => temp)
                        .Count();
                //Console.WriteLine("Find Value: "+findValue+" : "+count);
                if ((count * 100) / SoUngVien >= Program.minSup)
                {
                    tempList.Add(findValue);
                    tapl.Add(new List <string>(tempList), count);
                    tempList.Clear();
                }
            }
            Program.listTapL.Add(tapl);
            TapLToListView(tapl);
            listToTapL.Clear();
        }
Ejemplo n.º 2
0
        private void KhoiTaoTapL1()
        {
            List <int> listMaHoa = new List <int>();

            foreach (var mh in Program.listMahoa)
            {
                listMaHoa.Add(mh.maHoa);
                //Console.WriteLine("So ma hoa: "+mh.maHoa);
            }

            model.TapL tapl = new model.TapL();
            tapl.Lable = "Tập L1";

            List <string> tempList = new List <string>();
            int           dem      = 0;

            foreach (int number in listMaHoa)
            {
                tempList.Add(number.ToString());

                dem = list.Where(temp => temp.Equals(number))
                      .Select(temp => temp)
                      .Count();

                tapl.Add(new List <string>(tempList), dem);
                tempList.Clear();
                dem = 0;
            }
            Program.listTapL.Add(tapl);
            TapLToListView(tapl);
        }
Ejemplo n.º 3
0
        private void TapLToListView(model.TapL tapl)
        {
            listView2.Items.Clear();
            label3.Text = tapl.Lable;
            int i = 0;

            foreach (var t in tapl)
            {
                listView2.Items.Add(t.Key);
                listView2.Items[i++].SubItems.Add(t.Value.ToString());
            }
            listView2.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            listView2.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
Ejemplo n.º 4
0
        private void TapF_To_TapL(List <string> listSTR)
        {
            List <string> tempSTR    = new List <string>();
            bool          checkLNull = true;

            model.TapL tapl = new model.TapL();
            tapl.Lable = "Tập L" + ((k + 2).ToString());

            tempSTR.AddRange(listSTR.Distinct());
            tempSTR.Sort();
            int count = 0;

            foreach (string findValue in tempSTR)
            {
                count = listSTR.Where(temp => temp.Equals(findValue))
                        .Select(temp => temp)
                        .Count();
                //Console.WriteLine("Find Value: "+findValue+" : "+count);
                if ((count * 100) / SoUngVien >= Program.minSup)
                {
                    checkLNull = false;
                    tapl.Add(findValue, count);
                }
            }

            if (checkLNull == true)
            {
                MessageBox.Show("Thuật toán kết thúc!");
                Form3 frm = new Form3(k);
                frm.ShowDialog();
                k--;
                return;
            }
            Program.listTapL.Add(tapl);
            TapLToListView(tapl);
            listToTapL.Clear();
        }