Esempio n. 1
0
 void FillBigFromGrp(ref TAlternativeParserItemBig ABig)
 {
     for (int i = 0; i <= f_Grp.CountOUT - 1; i++)
     {
         FillItemGrp(f_Grp.GetItemsOUT(i), ref ABig);
     }
 }
Esempio n. 2
0
        void CrossToBigs(TAlternativeParserGrpCrossItem ACrossItem, TAlternativeParserItemBig ABig)
        {
            TAlternativeParserGrpItemBase     Base;
            TAlternativeParserGrpCrossItemOut Cross;
            TAlternativeParserItemBig         mHeadBig = new TAlternativeParserItemBig();

            mHeadBig.OwnerBig = ABig;
            ABig.MainList.Append(mHeadBig);

            TAlternativeParserItemBig mBig = new TAlternativeParserItemBig();

            for (int i = 0; i <= ACrossItem.CountBasis - 1; i++)
            {
                FillItemGrp(ACrossItem.GetItemsBasis(i), ref mBig);
            }
            mBig.Check    = true;
            mBig.OwnerBig = mHeadBig;
            mBig.NumAlt   = 0;
            mBig.Cross    = true;
            mHeadBig.AddBig(mBig);
            for (int i = 0; i <= ACrossItem.CountOut - 1; i++)
            {
                mBig       = new TAlternativeParserItemBig();
                Cross      = ACrossItem.GetItemsOut(i);
                mBig.Check = true;
                mBig.Cross = true;
                for (int j = 0; j <= Cross.Count - 1; j++)
                {
                    FillItemGrp(Cross.GetItems(j), ref mBig);
                }
                mBig.NumAlt   = i + 1;
                mBig.OwnerBig = mHeadBig;
                mHeadBig.AddBig(mBig);
            }
        }
Esempio n. 3
0
 void FreeHead()
 {
     if (f_Head != null)
     {
         f_Head = null;
     }
 }
Esempio n. 4
0
        public TPredicateItemBig NewBig(TAlternativeParserItemBig ABig)
        {
            TPredicateItemBig N = new TPredicateItemBig();

            N.Rfc    = ABig;
            N.NumAlt = ABig.NumAlt;
            return(N);
        }
Esempio n. 5
0
        void DoCopyTree(ref TPredicateItemBig ABig, ref TDynamicArray AStack)
        {
            int m_who;
            TAlternativeParserItemList ML;
            TAlternativeParserItemBase mBase;
            TAlternativeParserItemTFS  mTFS;
            TAlternativeParserItemBig  mBig;
            TPredicateItemTFE          mTFE;
            TAlternativeParserItemBig  mRfc = ABig.Rfc;

            ML = mRfc.MainList;
            for (int i = 0; i <= ML.Count - 1; i++)
            {
                mBase = ML.GetItems(i);
                m_who = mBase.Who();
                if (m_who == 0)
                {
                    mTFS = (TAlternativeParserItemTFS)(mBase);
                    TPredicateItemTFS iTfs = new TPredicateItemTFS();
                    iTfs.Assign(mTFS);
                    ABig.AddItem(iTfs);
                    for (int j = 0; j <= iTfs.TFECount - 1; j++)
                    {
                        mTFE = iTfs.GetTFEItems(j);
                        if (mTFE.RfcTFE.Big != null)
                        {
                            TPredicateItemBig iBig = NewBig(mTFE.RfcTFE.Big);
                            mTFE.Big = iBig;
                            AStack.InsertToFirst(iBig);
                        }
                    }
                }
                if (m_who == 1)
                {
                    mBig = (TAlternativeParserItemBig)(mBase);
                    TPredicateItemBig iBig = NewBig(mBig);
                    ABig.AddItem(iBig);
                    AStack.InsertToFirst(iBig);
                }
            }

            for (int i = 0; i <= mRfc.CountBig - 1; i++)
            {
                mBig = mRfc.GetItemsBig(i);
                TPredicateItemBig iBig = NewBig(mBig);
                ABig.AddItem(iBig);
                AStack.InsertToFirst(iBig);
            }
        }
Esempio n. 6
0
 public void SetTFE(TTreeListItem ATFE)
 {
     if (f_TFE != null)
     {
         MessageBox.Show("Повторное присвоение в TAlternativeParserItemTFE не допустимо!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     f_TFE = ATFE;
     if (ATFE.MainNode != null)
     {
         f_Big = new TAlternativeParserItemBig();
         f_Big.MainTreeList = ATFE.MainNode;
         f_Big.FillBasisAlternateTreeList(f_Big.MainTreeList.MainAlternative);
         f_Big.ParentTFE = this;
     }
 }
Esempio n. 7
0
        public void CopyTree(TAlternativeParserItemBig AHead)
        {
            TPredicateItemBig Big;

            FreeHead();
            f_PredicateStart = NewBig(AHead);
            TDynamicArray m_Stack = new TDynamicArray();

            Big = f_PredicateStart;
            while (Big != null)
            {
                DoCopyTree(ref Big, ref m_Stack);
                Big = (TPredicateItemBig)(m_Stack.Pop());
            }
            m_Stack = null;
        }
Esempio n. 8
0
        bool CheckEnlarge(TAlternativeParserItemBig ABig)
        {
            TAlternativeParserItemBig Item;

            if (ABig.Enlarge > 0)
            {
                for (int i = 0; i <= f_ListEnlarge.Count - 1; i++)
                {
                    Item = (TAlternativeParserItemBig)(f_ListEnlarge.ElementAt(i));
                    if (Item.Enlarge == ABig.Enlarge)
                    {
                        return(false);
                    }
                }
                f_ListEnlarge.Add(ABig);
            }
            return(true);
        }
Esempio n. 9
0
        void FillItemGrp(TAlternativeParserGrpItemBase AItem, ref TAlternativeParserItemBig ABig)
        {
            TAlternativeParserGrpItemTFS          GTfs;
            TAlternativeParserGrpItemList         GList;
            TAlternativeParserItemTFS             mTfs;
            TAlternativeParserItemBig             mBig;
            TAlternativeParserGrpCrossItemEnlarge Enl;

            int m_who = AItem.Who();

            if (m_who == 0)
            {
                GTfs          = (TAlternativeParserGrpItemTFS)(AItem);
                mTfs          = new TAlternativeParserItemTFS();
                mTfs.TFS      = GTfs.TFS;
                mTfs.OwnerBig = ABig;
                ABig.MainList.Append(mTfs);
            }
            if (m_who == 1)
            {
                GList = (TAlternativeParserGrpItemList)(AItem);
                mBig  = new TAlternativeParserItemBig();
                mBig.FillBasisFromGrpItemList(GList);
                mBig.OwnerBig = ABig;
                ABig.MainList.Append(mBig);
                mBig.BadBasis = ABig.Cross;
            }
            if (m_who == 2)
            {
                CrossToBigs((TAlternativeParserGrpCrossItem)(AItem), ABig);
            }
            if (m_who == 3)
            {
                Enl          = (TAlternativeParserGrpCrossItemEnlarge)(AItem);
                mBig         = new TAlternativeParserItemBig();
                mBig.Enlarge = Enl.ID;
                mBig.FillBasisFromEnlarge(Enl);
                mBig.OwnerBig = ABig;
                ABig.MainList.Append(mBig);
            }
        }
Esempio n. 10
0
 public TAlternativeParser()
 {
     f_Head        = null;
     f_Grp         = new TAlternativeParserGrp();
     f_ListEnlarge = new List <object>();
 }
Esempio n. 11
0
        void MakeBig(ref TAlternativeParserItemBig ABig, bool AByPass)
        {
            int                       m_n = 0;
            bool                      b_basis, b_main, b_tail, b_go, b_parent, b_cbm, b_valid = false;
            TTreeListTFS              TFS;
            TAlternateTreeList        AItem;
            TAlternativeParserItemBig NewBig;
            TMainTreeList             m_Tree = ABig.MainTreeList;

            TDynamicArray D      = new TDynamicArray();
            TDynamicArray Mass   = new TDynamicArray();
            bool          m_whl  = true;
            bool          m_hook = false;

            while (m_whl)
            {
                m_whl = false;
                f_Grp.Clear();
                for (int i = 0; i <= ABig.BasisCount - 1; i++)
                {
                    TFS = ABig.GetBasisItems(i);
                    m_Tree.FindAlternate(TFS.BaseWorkShape, D);
                    b_go = false;
                    if (D.Count > 0)
                    {
                        for (int j = 0; j <= D.Count - 1; j++)
                        {
                            AItem    = (TAlternateTreeList)(D.GetItems(j));
                            b_basis  = ABig.CompareBasisAndAlternateTreeList(AItem);
                            b_main   = AItem.MainAlternative;
                            b_tail   = ABig.IsTailAlternateTreeList(AItem);
                            b_parent = ABig.ParentTFE != null;
                            if (!b_basis && !b_main)
                            {
                                Mass.Clear();
                                ABig.GetTreeListTFSFromBasis(AItem, Mass, ref b_valid);
                                if (!b_valid)
                                {
                                    continue;
                                }
                                b_cbm = ABig.CompareBasisAndMassiv(Mass);
                                b_go  = (AByPass || !b_cbm || b_parent);
                                if (b_go)
                                {
                                    CreateParserGrpItemList(Mass, AItem);
                                }
                            }
                            if (b_tail && !b_main && !b_go)
                            {
                                m_n++;
                                NewBig        = new TAlternativeParserItemBig();
                                NewBig.NumAlt = m_n;
                                NewBig.FillBasisAlternateTreeList(AItem);
                                NewBig.OwnerBig = ABig;
                                ABig.AddBig(NewBig);
                            }
                        }
                    }
                    f_Grp.AddTfs(TFS);
                }

                if (ABig.BadBasis && !m_hook)
                {
                    ABig.HookBasisBig();
                    m_hook = true;
                    m_whl  = true;
                }
            }
            f_Grp.Make();
            FillBigFromGrp(ref ABig);
            D    = null;
            Mass = null;
        }
Esempio n. 12
0
 void CreateHead()
 {
     FreeHead();
     f_Head = new TAlternativeParserItemBig();
 }
Esempio n. 13
0
 public void AddBig(TAlternativeParserItemBig ABig)
 {
     f_List.Add(ABig);
 }
Esempio n. 14
0
 public TAlternativeParserItemBase()
 {
     f_MainTree = null;
     f_OwnerBig = null;
     f_NumAlt   = 0;
 }
Esempio n. 15
0
 public TAlternativeParserItemTFE()
 {
     f_TFE = null;
     f_Big = null;
 }
Esempio n. 16
0
 public TPredicateItemBig()
 {
     f_Rfc   = null;
     f_List  = new List <object>();
     f_Print = false;
 }