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 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 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; }
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; }
/* 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); } } }
TMainTreeList FindByLevel(TMainTreeList ABegin, int ALevel) { TMainTreeList Res = null; TDynamicArray Dyn = new TDynamicArray(); Dyn.Append(ABegin); int q = 0; while (Dyn.GetItems(q) != null) { Res = (TMainTreeList)(Dyn.GetItems(q)); for (int i = 0; i <= Res.ItemCount - 1; i++) { for (int j = 0; j <= Res.GetAlternateItem(i).ItemCount - 1; j++) { for (int k = 0; k <= Res.GetAlternateItem(i).GetTreeTFSItem(j).ItemCount - 1; k++) { if (Res.GetAlternateItem(i).GetTreeTFSItem(j).GetTreeTFEItem(k).MainNode != null) { Dyn.Append(Res.GetAlternateItem(i).GetTreeTFSItem(j).GetTreeTFEItem(k).MainNode); } } } } q++; } for (int i = 0; i <= Dyn.Count - 1; i++) { Res = (TMainTreeList)(Dyn.GetItems(i)); if (Res.Level == ALevel) { Dyn.Clear(); return(Res); } } Dyn.Clear(); return(null); }
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); } } }
/* 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 void InitData() { TBaseWorkShape WS; TBaseShape TFE; TGlsBinaryTree BTree = new TGlsBinaryTree(OPM_CompareNode); for (int i = 0; i <= MassWork.Count - 1; i++) { WS = (TBaseWorkShape)(MassWork.GetItems(i)); for (int j = 0; j <= WS.WorkShapesCount - 1; j++) { TFE = (TBaseShape)(WS.GetWorkShape(j)); BTree.insert(TFE); } } MassWork.Clear(); BTree.inorder(OPM_Inorder); // delete BTree; CheckCol(); }
public void Restruct() { int mpos; TAlternativeParserEnlargerTrashItem TI; TDynamicArray mDel = new TDynamicArray(); for (int i = 0; i <= f_Trash.Count - 1; i++) { TI = f_Trash.GetItems(i); mpos = TI.Owner.Find(TI.Pos); if (mpos >= 0) { mDel.Clear(); for (int j = mpos; j <= mpos + TI.Length - 1; j++) { mDel.Append(TI.Owner.GetItems(j)); } TI.Owner.CascadeDelete(mDel); } } mDel = null; }
void FindAlternate2(TBaseWorkShape AFirstWorkShape, TBaseWorkShape AEndWorkShape, TDynamicArray D) { TBaseWorkShape Tfs1, Tfs2; D.Clear(); for (int i = 0; i <= ItemCount - 1; i++) { Tfs1 = null; Tfs2 = null; if (GetAlternateItem(i).NodeStart != null) { Tfs1 = GetAlternateItem(i).NodeStart.WorkShape; } if (GetAlternateItem(i).NodeEnd != null) { Tfs2 = GetAlternateItem(i).NodeEnd.WorkShape; } if ((Tfs1 == AFirstWorkShape) && (Tfs2 == AEndWorkShape)) { D.Append(GetAlternateItem(i)); } } }
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; }
public void BasisClear() { f_Basis.Clear(); }