コード例 #1
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;
            }
        }