예제 #1
0
        /// <summary>
        /// 시간표를 TTViewer에서 선택한 시간표로 변경한다.
        /// </summary>
        public void Trans()
        {
            Save();
            if (SaveExist())
            {
                lvSearchAdd.Items.Clear();
                // ix == index
                foreach (string ix in Open().Split('|'))
                {
                    foreach (ListViewItem lvi in lvSearch.Items)
                    {
                        if (lvi.SubItems[0].Text == ix)
                        {
                            TimeElement te = TimeParser.Get(lvi.SubItems[8].Text);

                            lvSearchAdd.Items.Add((ListViewItem)lvi.Clone());
                            te.index = lvi.SubItems[0].Text;
                            tt.Add(te);
                            view_table.Add(te);
                        }
                    }
                }
            }
            DrawTimeTable();
        }
예제 #2
0
 public bool OptionFix(TimeElement te)
 {
     if (tt.CheckOverlap(te) == true)
     {
         return(false);
     }
     tt.Add(te);
     return(true);
 }
예제 #3
0
        private void bStart_Click(object sender, EventArgs e)
        {
            // 웹 강의 삭제
            List <ListViewItem> lvil = new List <ListViewItem>(getLviArray());

            for (int i = 0; i < lvil.Count;)
            {
                if (TimeParser.Get(lvil[i].SubItems[8].Text).te.Count == 0)
                {
                    DelInIndex(lvil[i].SubItems[0].Text); lvil.RemoveAt(i);
                }
                else
                {
                    i++;
                }
            }
            result.Clear();
            AccessTable = new TimeTable();
            stack.Clear();
            if (subject_group.Count > 1)
            {
                subject_group.Sort((v1, v2) => v2.Count.CompareTo(v1.Count));
                for (int i = 0; i < subject_group[0].Count; i++)
                {
                    stack.Push(subject_group[0][i].index);
                    AccessTable.Add(subject_group[0][i]);
                    Iterate(1);
                    stack.Pop();
                    AccessTable.Del(subject_group[0][i]);
                    if (escape)
                    {
                        break;
                    }
                }
            }
            result = result.OrderBy(a => Guid.NewGuid()).ToList();
            if (result.Count > maxShowCount)
            {
                result.RemoveRange(maxShowCount, result.Count - maxShowCount);
            }
            StringBuilder builder = new StringBuilder();

            foreach (string r in result)
            {
                builder.Append(r + '\n');
            }
            System.IO.File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"combinations.txt", builder.ToString());
            escape = false;
            Program.m.ActivateTTListButton();
            MessageBox.Show("생성완료!\n생성횟수: " + result.Count, Version.Name, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
예제 #4
0
 private void Iterate(int iter)
 {
     if (escape)
     {
         return;
     }
     if (subject_group.Count == iter)
     {
         StringBuilder builder = new StringBuilder();
         foreach (string s in stack)
         {
             builder.Append(s + '|');
         }
         result.Add(builder.ToString());
         if (result.Count >= maxPannelCount)
         {
             escape = true;
         }
         return;
     }
     for (int i = 0; i < subject_group[iter].Count; i++)
     {
         if (AccessTable.CheckOverlap(subject_group[iter][i]))
         {
             continue;
         }
         stack.Push(subject_group[iter][i].index);
         AccessTable.Add(subject_group[iter][i]);
         Iterate(iter + 1);
         stack.Pop();
         AccessTable.Del(subject_group[iter][i]);
         if (escape)
         {
             return;
         }
     }
 }