Exemplo n.º 1
0
        void MakeElement(TPredicateItemBase AElement)
        {
            int m_who = AElement.Who();

            if (m_who == 1)
            {
                //throw(Exception("недопустимо использование MakeElement(TPredicateItemBase* AElement). Обратитесь к разработчикам!"));
            }
            if (m_who == 2)
            {
                TPredicateItemPWork m_PW = (TPredicateItemPWork)(AElement);
                MakeElement(m_PW.Item1);
                MakeElement(m_PW.Item2);
            }
            if (m_who == 0)
            {
                TPredicateItemTFS m_TFS = (TPredicateItemTFS)(AElement);
                MakeElementTFS(m_TFS);
            }
        }
Exemplo n.º 2
0
        /*        AnsiString PrintPWork(TPredicateItemPWork* APWork, TDynamicArray* AStack);
         *      AnsiString PrintBig(TPredicateItemBig* ABig, TDynamicArray* AStack);
         *      AnsiString ParseItem(TPredicateItemBase* ABase, TDynamicArray* AStack);*/

        TPredicateItemBase DoParseItem(ref TPredicateItemBase ABase, ref TDynamicArray AStack)
        {
            TPredicateItemBase Res = null;
            int m_who = ABase.Who();

            if (m_who == 1)
            {
                TPredicateItemBig m_Big = (TPredicateItemBig)(ABase);
                Res = DoPrintBig(ref m_Big, ref AStack);
            }
            if (m_who == 2)
            {
                TPredicateItemPWork m_PW = (TPredicateItemPWork)(ABase);
                Res = DoPrintPWork(ref m_PW, ref AStack);
            }
            if (m_who == 0)
            {
                Res = ABase;
            }
            return(Res);
        }
Exemplo n.º 3
0
 TPredicateItemPWork DoPrintPWork(ref TPredicateItemPWork APWork, ref TDynamicArray AStack)
 {
     CheckParseItem(ref APWork.f_Item1, ref AStack);
     CheckParseItem(ref APWork.f_Item2, ref AStack);
     return(APWork);
 }
Exemplo n.º 4
0
 void PushPWork(TPredicateItemPWork APWork, ref TDynamicArray AStack)
 {
     AStack.InsertToFirst(APWork);
 }
Exemplo n.º 5
0
        void DoProcessItem(TPredicateItemBig AHead, TDynamicArray AStack)
        {
            int m_type, m_cnt, m_idx;
            TPredicateItemBase  m_Base;
            TPredicateItemBase  m_BaseItem1, m_BaseItem2;
            TPredicateItemPWork m_PWork, m_PW;
            TPredicateItemBig   m_Big;
            TPredicateItemTFS   m_Tfs;
            TPredicateItemTFE   m_Tfe;
            TDynamicArray       m_D     = new TDynamicArray();
            TDynamicArray       m_DTail = new TDynamicArray();
            TDynamicArray       m_DLN   = new TDynamicArray();

            m_cnt = AHead.Count;
            if (m_cnt == 1)
            {
                m_Base = AHead.GetItems(0);
                DoProcessItemTFS(m_Base, AStack);
                if (m_Base.Who() == 1)
                {
                    ((TPredicateItemBig)(m_Base)).Print = true;
                }

                ApplyStyle(AHead, m_Base);
            }
            if (m_cnt > 1)
            {
                for (int i = 0; i <= m_cnt - 1; i++)
                {
                    m_Base = AHead.GetItems(i);
                    m_type = m_Base.Who();
                    if (m_type == 1)
                    {
                        m_Big = (TPredicateItemBig)(m_Base);
                        if (m_Big.NumAlt > 0 || m_Big.Rfc.Cross)
                        {
                            m_DTail.Append(m_Big);
                            m_Big.Print = true;
                        }
                        else
                        {
                            m_DLN.Append(m_Base);
                            // m_Big.Print = m_Big.Rfc.CrossMain;
                        }
                    }
                    else
                    {
                        m_DLN.Append(m_Base);
                    }
                }
                if (m_DLN.Count == 1)
                {
                    m_Base = (TPredicateItemBase)(m_DLN.GetItems(0));
                    DoProcessItemTFS(m_Base, AStack);
                    ApplyStyle(AHead, m_Base);
                }
                else
                if (m_DLN.Count > 1)
                {
                    ApplyStyle(AHead, m_DLN);
                    m_BaseItem1 = (TPredicateItemBase)(m_DLN.GetItems(0));
                    m_BaseItem2 = (TPredicateItemBase)(m_DLN.GetItems(1));
                    DoProcessItemTFS(m_BaseItem1, AStack);
                    DoProcessItemTFS(m_BaseItem2, AStack);
                    for (int i = 2; i <= m_DLN.Count - 1; i++)
                    {
                        m_D.Append(m_DLN.GetItems(i));
                    }

                    AHead.DeleteItemToList(m_BaseItem1);
                    AHead.DeleteItemToList(m_BaseItem2);


                    m_BaseItem1 = EnvelopeToBig(m_BaseItem1);
                    m_BaseItem2 = EnvelopeToBig(m_BaseItem2);

                    m_PWork       = new TPredicateItemPWork();
                    m_PWork.Item1 = m_BaseItem1;
                    m_PWork.Item2 = m_BaseItem2;
                    SwapNumAlt(m_PWork, m_BaseItem1);



                    while (m_D.Count >= 1)
                    {
                        m_Big = (TPredicateItemBig)(EnvelopeToBig(m_PWork));

                        m_BaseItem1 = m_Big;
                        m_BaseItem2 = (TPredicateItemBase)(m_D.GetItems(0));
                        DoProcessItemTFS(m_BaseItem2, AStack);
                        AHead.DeleteItemToList(m_BaseItem2);

                        m_PW = new TPredicateItemPWork();
                        //m_PW.Envelope = true;
                        m_PW.Item1 = m_BaseItem1;
                        m_PW.Item2 = EnvelopeToBig(m_BaseItem2);
                        SwapNumAlt(m_PW, m_Big);
                        m_D.Delete(m_BaseItem2);
                        m_PWork = m_PW;
                    }

                    AHead.AddItem(m_PWork);
                }

                for (int i = 0; i <= m_DTail.Count - 1; i++)
                {
                    m_Base = (TPredicateItemBase)(m_DTail.GetItems(i));
                    AStack.InsertToFirst(m_Base);
                }

                m_DTail = null;
                m_DLN   = null;
                m_D     = null;
            }
        }