Example #1
0
 protected void FillReserveListIfEmpty(int n)
 {
     if (pReserve == null)
     {
         pReserve = this.derivedCreateNode();
         DLink head = pReserve;
         for (int x = 0; x < n - 1; x++)
         {
             pReserve.pNext       = this.derivedCreateNode();
             pReserve.pNext.pPrev = pReserve;
             pReserve             = pReserve.pNext;
         }
         pReserve     = head;
         nNumReserved = n;
     }
 }
Example #2
0
        public static DLink AddToFront(ref DLink pHead, DLink pNode)
        {
            if (pHead == null)
            {
                pHead       = pNode;
                pNode.pNext = null;
                pNode.pPrev = null;
            }
            else
            {
                pNode.pPrev = null;
                pNode.pNext = pHead;

                pHead.pPrev = pNode;
                pHead       = pNode;
            }
            return(pNode);
        }
Example #3
0
        public DLink baseRemove(DLink node)
        {
            if (node == null)
            {
                return(null);
            }
            if (pActive is null)
            {
                return(null);
            }

            DLink.RemoveNode(ref pActive, node);
            this.derivedWash(node);

            --mNumActive;
            ++nNumReserved;
            return(node);
        }
Example #4
0
        public static void RemoveNode(ref DLink pHead, DLink pNode)
        {
            if (pNode.pPrev != null)
            {
                pNode.pPrev.pNext = pNode.pNext;
            }

            else
            {
                pHead = pNode.pNext;
            }

            if (pNode.pNext != null)
            {
                pNode.pNext.pPrev = pNode.pPrev;
            }

            pNode.Clear();
        }
Example #5
0
        public DLink AddToFront()
        {
            FillReserveListIfEmpty(nGrowthSize);
            if (pReserve != null)
            {
                pReserve.pPrev = null;
            }

            DLink node = pReserve;

            this.derivedWash(node);

            pReserve   = pReserve.pNext;
            node.pNext = null;
            node.pPrev = null;

            node    = DLink.AddToFront(ref pActive, node);
            pActive = node;

            ++mNumActive;
            --nNumReserved;
            return(node);
        }
Example #6
0
        public DLink AddBefore(ref DLink node)
        {
            if (node == null || baseFind(node) == null)
            {
                return(null);
            }

            FillReserveListIfEmpty(nGrowthSize);
            if (pReserve != null)
            {
                pReserve.pPrev = null;
            }

            DLink nNode = pReserve;

            pReserve = pReserve.pNext;

            DLink head = pActive;

            if (node == pActive)
            {
                return(AddToFront());
            }

            else
            {
                node.pPrev.pNext = nNode;
                nNode.pPrev      = node.pPrev;
                node.pPrev       = nNode;
                nNode.pNext      = node;
                ++mNumActive;
                --nNumReserved;
            }

            pActive = head;
            return(nNode);
        }
Example #7
0
        protected override void derivedWash(DLink node)
        {
            Image image = (Image)node;

            image.Wash();
        }
Example #8
0
 public void Clear()
 {
     this.pNext = null;
     this.pPrev = null;
 }
Example #9
0
        protected override void derivedWash(DLink node)
        {
            SpriteNode pNode = (SpriteNode)node;

            pNode.Wash();
        }
Example #10
0
 abstract protected void derivedWash(DLink node);
Example #11
0
 abstract protected bool derivedCompare(DLink nodeA, DLink nodeB);