Example #1
0
        public void Remove(ref DispLeafLink pDispHead, ref DispLeafLink pLeafHead)
        {
            // Remove from the displacement.
            Prev[LIST_DISP].Next[LIST_DISP] = Next[LIST_DISP];
            Next[LIST_DISP].Prev[LIST_DISP] = Prev[LIST_DISP];

            if (this == pDispHead)
            {
                if (Next[LIST_DISP] == this)
                    pDispHead = null;
                else
                    pDispHead = Next[LIST_DISP];
            }

            // Remove from the leaf.
            Prev[LIST_LEAF].Next[LIST_LEAF] = Next[LIST_LEAF];
            Next[LIST_LEAF].Prev[LIST_LEAF] = Prev[LIST_LEAF];
            if (this == pLeafHead)
            {
                if (Next[LIST_LEAF] == this)
                    pLeafHead = null;
                else
                    pLeafHead = Next[LIST_LEAF];
            }
        }
Example #2
0
        const int LIST_LEAF = 0; // the list that's chained into leaves.

        #endregion Fields

        #region Methods

        public void Add(object pDispInfo, ref DispLeafLink pDispHead, object pLeaf, ref DispLeafLink pLeafHead)
        {
            // Store off pointers.
            m_pDispInfo = pDispInfo;
            m_pLeaf = pLeaf;

            // Link into the displacement's list of leaves.
            if (pDispHead != null)
            {
                Prev[LIST_DISP] = pDispHead;
                Next[LIST_DISP] = pDispHead.Next[LIST_DISP];
            }
            else
            {
                pDispHead = Prev[LIST_DISP] = Next[LIST_DISP] = this;
            }
            Prev[LIST_DISP].Next[LIST_DISP] = Next[LIST_DISP].Prev[LIST_DISP] = this;

            // Link into the leaf's list of displacements.
            if (pLeafHead != null)
            {
                Prev[LIST_LEAF] = pLeafHead;
                Next[LIST_LEAF] = pLeafHead.Next[LIST_LEAF];
            }
            else
            {
                pLeafHead = Prev[LIST_LEAF] = Next[LIST_LEAF] = this;
            }
            Prev[LIST_LEAF].Next[LIST_LEAF] = Next[LIST_LEAF].Prev[LIST_LEAF] = this;
        }