void SetPathNode(TPredicateItemBig AHead, TDynamicArray ADyn) { int mpos = -1; TPredicatePathNode L; TPredicatePathNodeItem NI; TPredicatePathNodeItem FI; TDynamicArray D = new TDynamicArray(); TPredicatePathNode N = FillPathNode(AHead, ADyn); if (N != null) { L = f_UsedPath.FindLikePathNode(N); if (L != null) { NI = L.FindIndexFirst(ref mpos); while (NI != null) { FI = N.FindByBlockID(NI.BlockID); if (FI != null) { D.Append(FI.ItemBase); } NI = L.FindIndexNext(ref mpos); } } } if (D.Count == ADyn.Count) { ADyn.Clear(); SharedConst.CopyDynamicArray(D, ADyn, false); } D = null; }
public void ArrayIDToDelete(TPredicateTreeItem AItem, ref TDynamicArray Arr) { TPredicateTreeItem Item; Arr.Clear(); int del, cfind; for (int i = 0; i <= AItem.Count - 1; i++) { del = AItem.GetTFE_ID(i); cfind = 0; for (int j = 0; j <= f_List.Count - 1; j++) { Item = (TPredicateTreeItem)(f_List.ElementAt(j)); if (!Item.TReated && (Item != AItem)) { for (int k = 0; k <= Item.Count - 1; k++) { if (del == Item.GetTFE_ID(k)) { cfind++; } } } } if (cfind == 0 && Arr.Find(del) == null) { Arr.Append(del); } } }
public override void ListIDFill(TDynamicArray AList) { int id; TPredicateItemTFS mTfs; //мб только укрупненная или просто рабочая операция id = f_Item1.Who(); if (id == 0) { mTfs = (TPredicateItemTFS)(f_Item1); id = mTfs.GetTFEItems(0).TFE.BaseShape.ID; AList.AppendInteger(id, mTfs.GetTFEItems(0).TFE.BaseShape); } else { AList.AppendInteger(f_Item1.ID, null); } id = f_Item2.Who(); if (id == 0) { mTfs = (TPredicateItemTFS)(f_Item2); id = mTfs.GetTFEItems(0).TFE.BaseShape.ID; AList.AppendInteger(id, mTfs.GetTFEItems(0).TFE.BaseShape); } else { AList.AppendInteger(f_Item2.ID, null); } }
public void GetTreeListTFSFromBasis(TAlternateTreeList Alternative, TDynamicArray D, ref bool AValid) { TBaseWorkShape NS, NE, CR; TTreeListTFS Tmp; bool f = false; bool e = false; NS = Alternative.NodeStart.WorkShape; NE = Alternative.NodeEnd.WorkShape; for (int i = 0; i <= BasisCount - 1; i++) { Tmp = GetBasisItems(i); CR = Tmp.BaseWorkShape; if (!f && (CR == NS)) { f = true; } if (f && !e) { D.Append(Tmp); } if (!e && (CR == NE)) { e = true; } } AValid = f && e; }
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(); }
TPredicatePathNode FillPathNode(TPredicateItemBig AHead, TDynamicArray ADyn) { int m_who; bool valid = false; TPredicateItemBase Item; TPredicatePathNode N = null; TDynamicArray D = new TDynamicArray(); for (int i = 0; i <= ADyn.Count - 1; i++) { Item = (TPredicateItemBase)(ADyn.GetItems(i)); m_who = Item.Who(); valid = m_who == 0; if (m_who == 1) { valid = ((TPredicateItemBig)(Item)).ValidDescendant(); } if (valid) { D.Append(Item); } } if (D.Count > 0) { N = f_BasePath.CreatePathNode(AHead); for (int i = 0; i <= D.Count - 1; i++) { N.AddItem((TPredicateItemBase)(D.GetItems(i))); } } D = null; return(N); }
public TPredicateTreeItem FindByTfeID(int AID, TDynamicArray Arr) { TPredicateTreeItem Item, Res = null; if (Arr != null) { Arr.Clear(); } for (int i = 0; i <= Count - 1; i++) { Item = GetItems(i); for (int j = 0; j <= Item.Count - 1; j++) { if (Item.GetTFE_ID(j) == AID) { if (Res == null) { Res = Item; } if (Arr != null) { Arr.Append(Item); } } } } return(Res); }
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); } } }
public void CascadeDelete(TDynamicArray AMass) { for (int i = 0; i <= AMass.Count - 1; i++) { DeleteTfsItem((TAlternativeParserGrpItemTFS)(AMass.GetItems(i))); } }
void DoEnlarge() { int m, cnt, index, r_f, r_pos, m_id; TAlternativeParserEnlargerStep MStep; TAlternativeParserEnlargerItem A, B; TDynamicArray DM = new TDynamicArray(); MStep = new TAlternativeParserEnlargerStep(); int c_trash; bool go = true; while (go) { go = false; m = FindMax().Count; cnt = Count; c_trash = 0; for (int i = m; i >= 1; i--) { DM.Clear(); for (int j = 0; j <= cnt - 1; j++) { A = GetItems(j); MStep.Clear(); index = 0; r_f = A.FillStep(MStep, index, i); DM.Append(A); while (r_f > 0) { m_id = SharedConst.NextTrashItemID(); for (int k = 0; k <= cnt - 1; k++) { B = GetItems(k); if (DM.Find(B) == null) { r_pos = B.Pos(MStep); if (r_pos >= 0) { CreateTrashItem(A.GetItems(index), i, A, m_id); CreateTrashItem(B.GetItems(r_pos), i, B, m_id); c_trash++; } } } MStep.Clear(); r_f = A.FillStep(MStep, ++index, i); } } if (c_trash > 0) { Restruct(); go = true; break; } } } MStep = null; DM = null; }
bool CheckPath(TPredicateItemBig AHead, TDynamicArray ADyn) { TPredicatePathNode N = FillPathNode(AHead, ADyn); if (N != null && f_UsedPath.FindLikePathNode(N) == null) { return(false); } return(true); }
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); } } }
public TPredicateTreeItem() { f_ParentID = 0; f_TypeWorkShape = 0; f_NumAlt = 0; f_BaseWorkShape = null; f_ParentShape = null; f_TReated = false; f_List = new TDynamicArray(); }
/* public bool GetAlternateInfo(int AShapeID, int &AltID, int &NumAlt, int &IDParent);*/ public void GetAllWorkShape(TDynamicArray AMass) { if (AMass != null) { AMass.Clear(); for (int i = 0; i <= MainList.Count - 1; i++) { AMass.Append(((TNodeMain)(MainList.ElementAt(i))).WorkShape); } } }
public TAlternativeParserItemBig() { f_Check = false; f_Cross = false; f_Enlarge = 0; f_EnlargeSetNum = false; f_ParentTFE = null; f_BadBasis = false; f_MainList = new TAlternativeParserItemList(); f_List = new List <object>(); f_Basis = new TDynamicArray(); }
void CreateParserGrpItemList(TDynamicArray AMass, TAlternateTreeList Alternative) { TAlternativeParserGrpItemList Item; if (AMass.Count > 0) { Item = f_Grp.GetNewList(Alternative); for (int i = 0; i <= AMass.Count - 1; i++) { Item.AddTfs((TTreeListTFS)(AMass.GetItems(i))); } } }
/* TTreeListItem* FindTFE(TBaseShape* ABaseShape);*/ public void FindAlternate(TBaseWorkShape ABaseWorkShape, TDynamicArray D) { TBaseWorkShape Tfs; D.Clear(); for (int i = 0; i <= ItemCount - 1; i++) { Tfs = GetAlternateItem(i).NodeStart.WorkShape; if (Tfs == ABaseWorkShape) { D.Append(GetAlternateItem(i)); } } }
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)); } } }
public void FindTrashItem(TAlternativeParserGrpCrossItem AOwner, TDynamicArray AOut) { TAlternativeParserEnlargerTrashItem Item; AOut.Clear(); for (int i = 0; i <= f_Trash.Count - 1; i++) { Item = f_Trash.GetItems(i); if (Item.Owner.ParentMain == AOwner) { AOut.Append(Item); } } }
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 ApplyStyle(TPredicateItemBig AHead, TDynamicArray ADyn) { if (f_PathStyle == 0) { FillPathNode(AHead, ADyn); } if (f_PathStyle == 1) { f_TryPath = CheckPath(AHead, ADyn); } if (f_PathStyle == 2) { SetPathNode(AHead, ADyn); } }
/* void SetNextWorkShape(TBaseWorkShape AValue); * void CreateImage(); * void CreateBaseLine(); * TLineCuttingItem FindLine(Point APointStart, Point APointEnd); * bool AddToPointList(Point APointStart, Point APointEnd); * bool ComparePoint(TLineCuttingItem A, TLineCuttingItem B, ref Point AStart, ref Point AEnd); * void ApplyOffset(int Ax, int Ay); * void Paint(TCanvas ACanvas);*/ public TLineCutting(Graphics ACanvas) { f_PointList = new List <object>(); f_BaseLineList = new List <object>(); f_WorkShape = null; f_NextWorkShape = null; f_BaseX = f_BaseY = 0; f_StartBaseX = f_StartBaseY = 0; f_Canvas = ACanvas; f_FirstLine = new TRectLine(0, 0); f_LastLine = new TRectLine(0, 0); f_IsFirstWS = f_IsLastWS = false; f_DLines = new TDynamicArray(); f_DShapes = new TDynamicArray(); }
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); } } }
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; }
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; }
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 CheckTFS() { TAlternativeParserGrpItemTFS Temp; TAlternativeParserGrpItemBase Item; TAlternativeParserGrpItemList List; TDynamicArray mTfs = new TDynamicArray(); TDynamicArray mGrp = new TDynamicArray(); TDynamicArray mDbl = new TDynamicArray(); for (int i = 0; i <= f_List.Count - 1; i++) { Item = (TAlternativeParserGrpItemBase)(f_List.ElementAt(i)); int m_who = Item.Who(); if (m_who <= 0) { mTfs.Append(Item); } if (m_who == 1) { mGrp.Append(Item); } } for (int i = 0; i <= mTfs.Count - 1; i++) { Item = (TAlternativeParserGrpItemBase)(mTfs.GetItems(i)); Temp = (TAlternativeParserGrpItemTFS)(Item); for (int j = 0; j <= mGrp.Count - 1; j++) { Item = (TAlternativeParserGrpItemBase)(mGrp.GetItems(j)); List = (TAlternativeParserGrpItemList)(Item); if (List.FindItemTfs(Temp.TFS) != null) { mDbl.Append(Temp); } } } for (int i = 0; i <= mDbl.Count - 1; i++) { Item = (TAlternativeParserGrpItemBase)(mDbl.GetItems(i)); FreeItem(Item); } mDbl = null; mGrp = null; mTfs = null; }
public bool CompareBasisAndMassiv(TDynamicArray AMass) { int LenB = BasisCount; int LenA = AMass.Count; if (LenA != LenB) { return(false); } for (int i = 0; i <= LenA - 1; i++) { if (GetBasisItems(i) != AMass.GetItems(i)) { return(false); } } return(true); }
void RestructEnlarge(TAlternativeParserGrpCrossItem AItem) { TAlternativeParserGrpItemTFS mPos; TAlternativeParserGrpCrossItemEnlarge Enl; TAlternativeParserEnlargerTrashItem TrItem; TDynamicArray Mass = new TDynamicArray(); f_Enlarger.FindTrashItem(AItem, Mass); for (int i = 0; i <= Mass.Count - 1; i++) { TrItem = (TAlternativeParserEnlargerTrashItem)(Mass.GetItems(i)); Enl = AItem.FindEnlarge(TrItem.Pos); if (Enl == null) { AddToListEnlarge(AItem.RestructEnlarge(TrItem)); } } Mass = null; }