public void Add(TableInstance tableInstance)
 {
     this.ListTableInstance.Add(tableInstance);
     foreach (var item in tableInstance.ListInstance)
     {
         Program.SearchInDataAbout(item.ItemSet);
     }
 }
예제 #2
0
        public static void DisplayScreen(TableInstance CandidateTableSizeOf, TableInstance FrequentItemSetSizeOfTable)
        {
            Console.Write("\n\n\n\n");
            List <string> DisplayString     = new List <string>();
            int           SizeCell          = 22;
            int           SpaceBetweenTable = 20;

            string TopHeaderTable = $"|{FillSpace("Candidate Table", ' ', SizeCell*2+1)}|";

            PaddingRight(ref TopHeaderTable, ' ', SpaceBetweenTable);
            TopHeaderTable += $"|{ FillSpace("Frequent ItemSet Table", ' ', SizeCell*2+1)}| ";

            string TopSurface = string.Empty;

            PaddingRight(ref TopSurface, '-', SizeCell * 2 + 3);
            PaddingRight(ref TopSurface, ' ', SpaceBetweenTable);
            TopSurface += TopSurface.Substring(0, TopSurface.Length - SpaceBetweenTable);

            string HeaderTable = $"|{FillSpace("ItemSet", ' ', SizeCell)}|{FillSpace("Support", ' ', SizeCell)}|";

            PaddingRight(ref HeaderTable, ' ', SpaceBetweenTable);
            HeaderTable += HeaderTable.Substring(0, HeaderTable.Length - SpaceBetweenTable);

            DisplayString.Add(TopHeaderTable);
            DisplayString.Add(TopSurface);
            DisplayString.Add(HeaderTable);
            DisplayString.Add(TopSurface);
            if (CandidateTableSizeOf.ListInstance.Count() != 0)
            {
                for (int i = 0; i < CandidateTableSizeOf.ListInstance.Count(); i++)
                {
                    string ValueRow = $"|{FillSpace(CandidateTableSizeOf.ListInstance[i].ItemSet, ' ', SizeCell)}|{FillSpace(CandidateTableSizeOf.ListInstance[i].SupportCount.ToString(), ' ', SizeCell)}|";
                    PaddingRight(ref ValueRow, ' ', SpaceBetweenTable);
                    if (i < FrequentItemSetSizeOfTable.ListInstance.Count())
                    {
                        ValueRow += $"|{FillSpace(FrequentItemSetSizeOfTable.ListInstance[i].ItemSet, ' ', SizeCell)}|{FillSpace(FrequentItemSetSizeOfTable.ListInstance[i].SupportCount.ToString(), ' ', SizeCell)}|";
                    }
                    else
                    {
                        ValueRow += $"|{FillSpace("No Frequent ItemSet", ' ', SizeCell)}|{FillSpace("No Frequent ItemSet", ' ', SizeCell)}|";
                    }
                    DisplayString.Add(ValueRow);
                    DisplayString.Add(TopSurface);
                }
            }
            else
            {
                string ValueRow = $"|{FillSpace("Can not Generate more", ' ', SizeCell)}|{FillSpace("Can not Generate more", ' ', SizeCell)}|";

                DisplayString.Add(ValueRow);
                DisplayString.Add(TopSurface);
            }

            foreach (var Line in DisplayString)
            {
                Console.WriteLine(Line);
            }
        }
        public TableInstance Add(TableInstance tableCandidate, int MinimumSupport)
        {
            var tablefrequentItem = new TableInstance();
            var frequentItem      = tableCandidate.ListInstance.FindAll(item => item.SupportCount >= MinimumSupport).ToList <Instance>();

            tablefrequentItem.ListInstance = frequentItem;
            ListTableInstance.Add(tablefrequentItem);
            return(tablefrequentItem);
        }
예제 #4
0
        public static TableInstance GenarateCandidateTableSizeOfOf(int SizeCandidate)
        {
            TableInstance TableCandidate = new TableInstance();
            var           ListItemSet    = GenarateItemSetSizeOf(SizeCandidate);

            foreach (var ItemSet in ListItemSet)
            {
                TableCandidate.ListInstance.Add(new Instance(ItemSet, 0));
            }
            CandidateTableSizeOf.Add(TableCandidate);
            return(TableCandidate);
        }