Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        bool CheckPath(TPredicateItemBig AHead, TDynamicArray ADyn)
        {
            TPredicatePathNode N = FillPathNode(AHead, ADyn);

            if (N != null && f_UsedPath.FindLikePathNode(N) == null)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 4
0
        bool CheckPath(TPredicateItemBig AHead, TPredicateItemBase AItem)
        {
            TPredicatePathNode N = FillPathNode(AHead, AItem);

            if (N != null && f_UsedPath.FindLikePathNode(N) == null)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 5
0
        public TPredicatePathNode FindLikePathNode(TPredicatePathNode ANode)
        {
            TPredicatePathNode Item;

            for (int i = 0; i <= NodeCount - 1; i++)
            {
                Item = GetNodeItems(i);
                if (Item.IsLike(ANode))
                {
                    return(Item);
                }
            }
            return(null);
        }
Esempio n. 6
0
        TPredicatePathNode FillPathNode(TPredicateItemBig AHead, TPredicateItemBase AItem)
        {
            TPredicatePathNode N = null;
            int  m_who           = AItem.Who();
            bool valid           = m_who == 0;

            if (m_who == 1)
            {
                valid = ((TPredicateItemBig)(AItem)).ValidDescendant();
            }
            if (valid)
            {
                N = f_BasePath.CreatePathNode(AHead);
                N.AddItem(AItem);
            }
            return(N);
        }
Esempio n. 7
0
        public TPredicatePathNode CreatePathNode(TPredicateItemBase AParentItemBase)
        {
            int mID = 0;
            int Num = 0;

            if (AParentItemBase != null)
            {
                Num = ((TPredicateItemBig)AParentItemBase).NumAlt;
                TPredicatePathNodeItem NI = FindPathNodeByParent(AParentItemBase);
                if (NI != null)
                {
                    mID = NI.BlockID;
                }
            }
            TPredicatePathNode N = new TPredicatePathNode(AParentItemBase, mID, Num);

            f_List.Add(N);
            return(N);
        }
Esempio n. 8
0
        public bool IsLike(TPredicatePathNode ANode)
        {
            int mCnt = 0;

            if (f_List.Count == ANode.Count)
            {
                if (f_ID == ANode.ID)
                {
                    if (f_NumAlt == ANode.NumAlt)
                    {
                        for (int i = 0; i <= ANode.Count - 1; i++)
                        {
                            if (FindByBlockID(ANode.GetItems(i).BlockID) != null)
                            {
                                mCnt++;
                            }
                        }
                        return(mCnt == ANode.Count);
                    }
                }
            }
            return(false);
        }