void DoProcessItemTFS(TPredicateItemBase ABase, TDynamicArray AStack) { TPredicateItemTFS m_Tfs; TPredicateItemTFE m_Tfe; if (ABase != null) { int m_type = ABase.Who(); if (m_type == 0) { m_Tfs = (TPredicateItemTFS)(ABase); for (int j = 0; j <= m_Tfs.TFECount - 1; j++) { m_Tfe = m_Tfs.GetTFEItems(j); if (m_Tfe.Big != null) { AStack.InsertToFirst(m_Tfe.Big); } } } if (m_type == 1) { AStack.InsertToFirst(ABase); } } }
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); } }
public void GetAllFirstBigsNoCheck(TDynamicArray AMass) { TAlternativeParserItemBig mTemp; TAlternativeParserItemBase mBase; TAlternativeParserItemTFS mTfs; TAlternativeParserItemTFE mTfe; int i, m_who; for (i = 0; i <= MainList.Count - 1; i++) { mBase = MainList.GetItems(i); m_who = mBase.Who(); if (m_who == 1) { mTemp = (TAlternativeParserItemBig)(mBase); mTemp.MainTreeList = MainTreeList; if (!mTemp.Check) { AMass.InsertToFirst(mTemp); } } if (m_who == 0) { mTfs = (TAlternativeParserItemTFS)(mBase); for (int j = 0; j <= mTfs.TFECount - 1; j++) { mTfe = mTfs.GetTFEItems(j); if (mTfe.Big != null && !mTfe.Big.Check) { AMass.InsertToFirst(mTfe.Big); } } } } for (i = 0; i <= CountBig - 1; i++) { mTemp = GetItemsBig(i); mTemp.MainTreeList = MainTreeList; if (!mTemp.Check) { AMass.InsertToFirst(mTemp); } if (mTemp.Cross) { mTemp.GetAllFirstBigsNoCheck(AMass); } } }
public void Init(ref TPredicateItemBig AHead, ref TPredicateTree APredicateTree) { string SC; bool pass; TPredicateItemBase Base, NC; f_PrStruct = ""; f_PrRab = ""; f_PrControlRab = ""; f_PrControlFunc = ""; f_PrCheckCondition = ""; TDynamicArray m_Stack = new TDynamicArray(); m_Stack.InsertToFirst(AHead); Base = (TPredicateItemBase)(m_Stack.Pop()); while (Base != null) { NC = DoParseItem(ref Base, ref m_Stack); if (NC != null) { f_BTree.insert(NC); } Base = (TPredicateItemBase)(m_Stack.Pop()); } m_Stack = null; SharedConst.lcList.clear(); f_BTree.inorder(acp); SharedConst.lcList.first(); for (int i = 0; i <= SharedConst.lcList.length() - 1; i++) { // TGlsListNode tmpNode = (TGlsListNode)SharedConst.lcList.val(); // TPredicateItemTFS tmpPredicateItem = (TPredicateItemTFS)(tmpNode.Val); // TPredicateItemPWork Base = (TPredicateItemBase)(SharedConst.lcList.val()); f_Item.Make(Base, Base.EnvelopeBIG); SC = f_Item.OutString; if (SC.Length > 0) { f_PrStruct = f_PrStruct + SC + "\r\n"; MakeElement(Base); if (APredicateTree != null) { AddElementToTree(APredicateTree); } } // MakeElement(Base); // f_Tran.AddGTItem(f_Item); SharedConst.lcList.next(); } bool acp(object A) { SharedConst.lcList.append(A); return(true); } // f_TextRecalc = f_Tran.Make(); }
void PushTFS(TPredicateItemTFS ATFS, ref TDynamicArray AStack) { int m_type = ATFS.TFS.BaseWorkShape.TypeShape; if ((m_type != 1) || ((m_type == 1) && (ATFS.EnvelopeBIG != null))) { AStack.InsertToFirst(ATFS); } for (int i = 0; i <= ATFS.TFECount - 1; i++) { if (ATFS.GetTFEItems(i).Big != null) { AStack.InsertToFirst(ATFS.GetTFEItems(i).Big); } } }
void DoSetIDItemTFS(TPredicateItemBase ABase, TDynamicArray AStack) { int m_type; TPredicateItemPWork m_PW; if (ABase != null) { m_type = ABase.Who(); if (m_type == 0) { PushTFS((TPredicateItemTFS)(ABase), AStack); } if (m_type == 1) { AStack.InsertToFirst(ABase); } if (m_type == 2) { m_PW = (TPredicateItemPWork)(ABase); //1 m_type = m_PW.Item1.Who(); if (m_type == 0) { PushTFS((TPredicateItemTFS)(m_PW.Item1), AStack); } if (m_type == 1) { AStack.InsertToFirst(m_PW.Item1); } //2 m_type = m_PW.Item2.Who(); if (m_type == 0) { PushTFS((TPredicateItemTFS)(m_PW.Item2), AStack); } if (m_type == 1) { AStack.InsertToFirst(m_PW.Item2); } } } }
void PushTFS(TPredicateItemTFS ATFS, TDynamicArray AStack) { for (int i = 0; i <= ATFS.TFECount - 1; i++) { if (ATFS.GetTFEItems(i).Big != null) { AStack.InsertToFirst(ATFS.GetTFEItems(i).Big); } } }
void PushBig(TPredicateItemBig ABig, ref TDynamicArray AStack) { if (ABig.Envelope) { TPredicateItemBase B = ABig.GetItems(0); B.EnvelopeBIG = ABig; int m_who = B.Who(); if ((m_who == 2) || (m_who == 1)) { AStack.InsertToFirst(B); } if (m_who == 0) { PushTFS((TPredicateItemTFS)(B), ref AStack); } } else { AStack.InsertToFirst(ABig); } }
public static void CopyDynamicArray(TDynamicArray ASource, TDynamicArray ADest, bool AInsertToFirst) { for (int i = 0; i <= ASource.Count - 1; i++) { if (AInsertToFirst) { ADest.InsertToFirst(ASource.GetItems(i)); } else { ADest.Append(ASource.GetItems(i)); } } }
void DoSetID() { TPredicateItemBig Big; f_NGen.InitNum(); TDynamicArray m_Stack = new TDynamicArray(); m_Stack.InsertToFirst(f_PredicateStart); Big = (TPredicateItemBig)(m_Stack.Pop()); while (Big != null) { DoSetIDItem(Big, m_Stack); Big = (TPredicateItemBig)(m_Stack.Pop()); } m_Stack = null; }
void DoProcess() { TPredicateItemBig Big; f_TryPath = true; TDynamicArray m_Stack = new TDynamicArray(); m_Stack.InsertToFirst(f_PredicateStart); Big = (TPredicateItemBig)(m_Stack.Pop()); while (Big != null) { DoProcessItem(Big, m_Stack); if (!f_TryPath) { break; } Big = (TPredicateItemBig)(m_Stack.Pop()); } m_Stack = null; }
/* void DoMakeAlternative();*/ void DoParse(ref TMainTreeList AMainTree) { TAlternativeParserItemBig mBig, mTemp; TAlternativeParserItemBase mBase; CreateHead(); f_Head.MainTreeList = AMainTree; f_Head.FillBasisAlternateTreeList(f_Head.MainTreeList.MainAlternative); TDynamicArray m_Stack = new TDynamicArray(); m_Stack.InsertToFirst(f_Head); mBig = (TAlternativeParserItemBig)(m_Stack.Pop()); while (mBig != null) { if (CheckEnlarge(mBig)) { MakeBig(ref mBig, f_Head == mBig); } mBig.Check = true; mBig.GetAllFirstBigsNoCheck(m_Stack); mBig = (TAlternativeParserItemBig)(m_Stack.Pop()); } m_Stack = null; }
void PushPWork(TPredicateItemPWork APWork, ref TDynamicArray AStack) { AStack.InsertToFirst(APWork); }
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; } }