示例#1
0
        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);
                }
            }
        }
        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;
        }
示例#3
0
        void CheckCol()
        {
            int rw = OptSovm.HiRow();
            int rc = OptSovm.HiCol();
            int v;

            for (int i = 0; i <= rw; i++)
            {
                for (int j = 0; j <= rc; j++)
                {
                    v = (int)(OptSovm.GetItems(i, j));
                    if (v != 0 && MassWork.Find((object)j) == null)
                    {
                        OptSovm.SetVal(i, j, 0);
                    }
                }
            }
        }
示例#4
0
        void DoCreateBasis()
        {
            TGlsBinaryTree mTree;
            TAlternativeParserGrpItemTFS  Tfs;
            TAlternativeParserGrpItemList Item;
            TDynamicArray D = new TDynamicArray();

            SharedConst.lc = new List <object>();
            f_Basis.Clear();
            for (int i = 0; i <= Count - 1; i++)
            {
                Item = GetItems(i);
                for (int j = 0; j <= Item.Count - 1; j++)
                {
                    Tfs = Item.GetItems(j);
                    if (D.Find(Tfs.TFS) == null)
                    {
                        MessageBox.Show("ДЕЛАЮ на УГАД, эту строчку НУЖНО ДЕБАЖИТЬ", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    //   D.AppendInteger((int)Tfs, Tfs.TFS); // ХЗ ДЕЛАЮ на УГАД, эту строчку НУЖНО ДЕБАЖИТЬ
                }
            }
            mTree = new TGlsBinaryTree(SharedConst.APC_CompareNode);
            for (int i = 0; i <= D.Count - 1; i++)
            {
                object tmp = D.GetPosition(i).Int_Value;
                Tfs = (TAlternativeParserGrpItemTFS)tmp;
                mTree.insert(Tfs);
            }
            mTree.inorder(SharedConst.APC_Inorder);
            for (int i = 0; i <= SharedConst.lc.Count - 1; i++)
            {
                Tfs = (TAlternativeParserGrpItemTFS)(SharedConst.lc.ElementAt(i));
                f_Basis.Add(Tfs);
            }
            mTree          = null;
            D              = null;
            SharedConst.lc = null;
        }
示例#5
0
        void MakeOUT()
        {
            TAlternativeParserGrpItemList Temp;
            TAlternativeParserGrpItemBase Item;
            TDynamicArray D = 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)
                {
                    f_ListOut.Add(Item);
                }
                if (m_who == 1)
                {
                    Temp = (TAlternativeParserGrpItemList)(Item);
                    Item = CheckOut(Temp);
                    if (Item != null)
                    {
                        if (D.Find(Item) == null)
                        {
                            D.Append(Item);
                            f_ListOut.Add(Item);
                            if (Item.Who() == 2)
                            {
                                TAlternativeParserGrpCrossItem iTmp = (TAlternativeParserGrpCrossItem)(Item);
                                iTmp.CreateBasis();
                                iTmp.CreateListOut();
                            }
                        }
                    }
                }
            }
            D = null;
        }