コード例 #1
0
 private void TaoKyHieuDon(KyHieu kh, ref string strTemp)
 {
     strTemp = kh.TrichXuat(strTemp);
     if (kh.Loai != LoaiKyHieu.ChuaCoLoai)
     {
         DSKyHieu.Add(kh);
     }
 }
コード例 #2
0
        public string HienDSKH()
        {
            string str = "";

            DSKyHieu.ForEach(x => {
                str += x.NoiDung + " ";
                //x.Hien();
            });
            return(str);
        }
コード例 #3
0
        private void TaoHauTo()
        {
            Stack <ToanTu> stack = new Stack <ToanTu>();

            DSKyHieu.ForEach(x =>
            {
                if (x is SoHoc)
                {
                    DSKetQua.Add(x);
                }
                else
                {
                    ToanTu objTT = (ToanTu)x;
                    switch (objTT.Loai)
                    {
                    case LoaiKyHieu.DongNgoac:
                        while (stack.Peek().Loai != LoaiKyHieu.MoNgoac)
                        {
                            DSKetQua.Add(stack.Pop());
                        }
                        stack.Pop();
                        break;

                    case LoaiKyHieu.CongTru:
                    case LoaiKyHieu.NhanChia:
                        while (stack.Count > 0 && stack.Peek().LonHon(objTT))
                        {
                            DSKetQua.Add(stack.Pop());
                        }
                        break;
                    }
                    if (objTT.Loai != LoaiKyHieu.DongNgoac)
                    {
                        stack.Push(objTT);
                    }
                }
            });
            while (stack.Count > 0)
            {
                DSKetQua.Add(stack.Pop());
            }
        }