Exemplo n.º 1
0
        protected override void derivedDumpNode(MLink pLink)
        {
            Debug.Assert(pLink != null);
            Texture pNode = (Texture)pLink;

            pNode.DumpNodeData();
        }
Exemplo n.º 2
0
        // remove the node from the given list
        public static void removeNode(MLink dataNode, ref MLink list)
        {
            Debug.Assert(dataNode != null);
            //if data node position is at head
            if (dataNode.pPrev == null)
            {
                if (dataNode.pNext == null)
                {
                    list = null;
                }
                else
                {
                    dataNode.pNext.pPrev = null;
                }
                list           = dataNode.pNext;
                dataNode.pNext = null;
            }
            //if data node position is last
            else if (dataNode.pNext == null)
            {
                dataNode.pPrev.pNext = null;
                dataNode.pPrev       = null;
            }
            // if data node position is in between
            else
            {
                dataNode.pPrev.pNext = dataNode.pNext;
                dataNode.pNext.pPrev = dataNode.pPrev;

                dataNode.pPrev = null;
                dataNode.pNext = null;
            }
        }
Exemplo n.º 3
0
        override protected void derivedDumpNode(MLink pLink)
        {
            Debug.Assert(pLink != null);
            ProxySprite pData = (ProxySprite)pLink;

            pData.DumpNodeData();
        }
Exemplo n.º 4
0
        protected override void derivedDumpNode(MLink pLink)
        {
            Debug.Assert(pLink != null);
            BoxSprite pNode = (BoxSprite)pLink;

            pNode.DumpNodeData();
        }
Exemplo n.º 5
0
        protected MLink baseAddToFront()
        {
            // Are there any nodes on the Reserve list?
            if (this.pReserve == null)
            {
                // refill the reserve list by the refill size
                this.privFillReservedPool(this.mRefillSize);
            }

            // Always take from the reserve list
            MLink pNode = MLink.PullFromFront(ref this.pReserve);

            Debug.Assert(pNode != null);

            // Update stats
            this.mNumActive++;
            //update active high count if needed;
            if (this.mNumActive > this.mActiveHighCount)
            {
                this.mActiveHighCount = this.mNumActive;
            }
            this.mNumReserve--;

            // copy to active
            MLink.AddToFront(ref this.pActive, pNode);

            //Debug.WriteLine("Base Add Node called");

            // YES - here's your new one (may its reused from reserved)
            return(pNode);
        }
Exemplo n.º 6
0
        public void printContainer()
        {
            Debug.WriteLine("");
            Debug.WriteLine("------ Active List: ---------------------------\n");

            MLink pNode = this.activeList;

            int i = 0;
            while (pNode != null)
            {
                Debug.WriteLine("{0}: SpriteBatchName-------------", i , name);
                pNode.print();
                i++;
                pNode = pNode.pNext;
            }

            Debug.WriteLine("");
            Debug.WriteLine("------ Reserve List: ---------------------------\n");

            pNode = this.reserveList;
            i = 0;
            while (pNode != null)
            {
                Debug.WriteLine("{0}: -------------", i);
                pNode.print();
                i++;
                pNode = pNode.pNext;
            }
        }
        public static void printList()
        {
            Debug.WriteLine("");
            Debug.WriteLine("------ Active List: ---------------------------\n");

            MLink pNode = sbmInstance.activeList;

            int i = 0;

            while (pNode != null)
            {
                Debug.WriteLine("{0}: -------------", i);
                pNode.print();
                i++;
                pNode = pNode.pNext;
            }

            Debug.WriteLine("");
            Debug.WriteLine("------ Reserve List: ---------------------------\n");

            pNode = sbmInstance.reserveList;
            i     = 0;
            while (pNode != null)
            {
                Debug.WriteLine("{0}: -------------", i);
                pNode.print();
                i++;
                pNode = pNode.pNext;
            }
        }
Exemplo n.º 8
0
        protected override void derivedWashNode(MLink pLink)
        {
            Debug.Assert(pLink != null);
            DeathNode pNode = (DeathNode)pLink;

            pNode.WashNodeData();
        }
        public static void printList()
        {
            SpriteManager spriteMInstance = SpriteManager.getSingletonInstance();

            Debug.Assert(spriteMInstance != null);

            Debug.WriteLine("");
            Debug.WriteLine("------ Active List: ---------------------------\n");

            MLink pNode = spriteMInstance.activeList;

            int i = 0;

            while (pNode != null)
            {
                Debug.WriteLine("{0}: -------------", i);
                pNode.print();
                i++;
                pNode = pNode.pNext;
            }

            Debug.WriteLine("");
            Debug.WriteLine("------ Reserve List: ---------------------------\n");

            pNode = spriteMInstance.reserveList;
            i     = 0;
            while (pNode != null)
            {
                Debug.WriteLine("{0}: -------------", i);
                pNode.print();
                i++;
                pNode = pNode.pNext;
            }
        }
Exemplo n.º 10
0
        protected override void printStats(ref MLink targetNode)
        {
            FontManager texManInst = FontManager.getSingletonInstance();

            Debug.Assert(texManInst != null);

            Debug.WriteLine("");
            Debug.WriteLine("------ Active List: ---------------------------\n");

            MLink pNode = texManInst.activeList;

            int i = 0;

            while (pNode != null)
            {
                Debug.WriteLine("{0}: -------------", i);
                pNode.print();
                i++;
                pNode = pNode.pNext;
            }

            Debug.WriteLine("");
            Debug.WriteLine("------ Reserve List: ---------------------------\n");

            pNode = texManInst.reserveList;
            i     = 0;
            while (pNode != null)
            {
                Debug.WriteLine("{0}: -------------", i);
                pNode.print();
                i++;
                pNode = pNode.pNext;
            }
        }
Exemplo n.º 11
0
        override protected void derivedWashNode(MLink pLink)
        {
            Debug.Assert(pLink != null);
            ProxySprite pNode = (ProxySprite)pLink;

            pNode.Wash();
        }
Exemplo n.º 12
0
        override protected void derivedDumpNode(MLink pLink)
        {
            Debug.Assert(pLink != null);
            TimerEvent pData = (TimerEvent)pLink;

            pData.Dump();
        }
Exemplo n.º 13
0
        protected void baseDumpNodes()
        {
            Debug.WriteLine("");
            Debug.WriteLine("      ------ Active List: ---------------------------\n");

            MLink pNode = this.activeList;

            int i = 0;

            while (pNode != null)
            {
                Debug.WriteLine("      {0}: -------------", i);
                this.derivedDumpNode(pNode);
                i++;
                pNode = pNode.pNext;
            }

            Debug.WriteLine("");
            Debug.WriteLine("      ------ Reserve List: ---------------------------\n");

            pNode = this.reserveList;
            i     = 0;
            while (pNode != null)
            {
                Debug.WriteLine("      {0}: -------------", i);
                this.derivedDumpNode(pNode);
                i++;
                pNode = pNode.pNext;
            }
        }
Exemplo n.º 14
0
        protected override void derivedDumpNode(MLink pLink)
        {
            Debug.Assert(pLink != null);
            SBNode pNode = (SBNode)pLink;

            pNode.Dump();
        }
Exemplo n.º 15
0
        override protected void derivedWashNode(MLink pLink)
        {
            Debug.Assert(pLink != null);
            TimerEvent pNode = (TimerEvent)pLink;

            pNode.Wash();
        }
Exemplo n.º 16
0
        protected override void derivedWashNode(MLink pLink)
        {
            Debug.Assert(pLink != null);
            SpriteBatch pNode = (SpriteBatch)pLink;

            pNode.WashSpriteBatchData();
        }
Exemplo n.º 17
0
        //----------------------------------------------------------------------
        // 4 Override Abstract Methods (From Base Manager)
        //----------------------------------------------------------------------
        protected override void derivedDestroyNode(MLink pLink)
        {
            SpriteBatch pNode = (SpriteBatch)pLink;

            Debug.Assert(pNode != null);
            pNode.Destroy();
        }
Exemplo n.º 18
0
        protected override void derivedWashNode(MLink pLink)
        {
            Debug.Assert(pLink != null);
            Glyph pNode = (Glyph)pLink;

            pNode.WashNodeData();
        }
Exemplo n.º 19
0
        protected Manager(int initialReserveSize = 3, int refillReserveSize = 1)
        {
            //safety first
            Debug.Assert(initialReserveSize > 0);
            Debug.Assert(refillReserveSize > 0);

            this.mStartNumReserve = initialReserveSize;
            //set the refill rate of reserve pool
            this.mRefillSize = refillReserveSize;

            //everything else starts as 0/null,
            //data will get fixed when pool is created below;
            this.mNumActive      = 0;
            this.mNumReserve     = 0;
            this.mTotalNodeCount = 0;

            this.mActiveHighCount = 0;

            this.pActive  = null;
            this.pReserve = null;

            //fill the reserve pool
            //relevent stats updated in this method
            this.privFillReservedPool(initialReserveSize);

            //double check relevant reserve stats;
            Debug.Assert(this.mTotalNodeCount > 0);
            Debug.Assert(this.mNumReserve == initialReserveSize);
            Debug.Assert(this.pReserve != null);
            //check for proper linkage - headNode.pPrev = null;
            Debug.Assert(this.pReserve.pMPrev == null);
        }
Exemplo n.º 20
0
        public static void AddToFront(ref MLink pHead, MLink newNode)
        {
            Debug.Assert(newNode != null);

            //2 scenarios: empty list or head not null;
            if (pHead == null)
            {
                newNode.pMNext = null;
                newNode.pMPrev = null;

                pHead = newNode;
                //Debug.WriteLine("First node added to list");
            }
            else
            {
                //push to front
                //fix the links
                newNode.pMPrev = null;
                newNode.pMNext = pHead;

                pHead.pMPrev = newNode;

                //set head reference as newNode;
                pHead = newNode;

                //Debug.WriteLine("New node added to front of list");
            }

            Debug.Assert(pHead != null);
        }
Exemplo n.º 21
0
        protected override void derivedWashNode(MLink pLink)
        {
            Debug.Assert(pLink != null);
            ColPair pNode = (ColPair)pLink;

            pNode.WashNodeData();
        }
Exemplo n.º 22
0
        protected override void derivedWashNode(MLink pLink)
        {
            Debug.Assert(pLink != null);
            GameSprite pNode = (GameSprite)pLink;

            pNode.WashNodeData();
        }
Exemplo n.º 23
0
        public static void printList()
        {
            TimerManager texManInst = TimerManager.getSingletonInstance();

            Debug.Assert(texManInst != null);

            Debug.WriteLine("");
            Debug.WriteLine("------ Active List: ---------------------------\n");

            MLink pNode = texManInst.activeList;

            int i = 0;

            while (pNode != null)
            {
                Debug.WriteLine("{0}: -------------", i);
                pNode.print();
                i++;
                pNode = pNode.pNext;
            }

            Debug.WriteLine("");
            Debug.WriteLine("------ Reserve List: ---------------------------\n");

            pNode = texManInst.reserveList;
            i     = 0;
            while (pNode != null)
            {
                Debug.WriteLine("{0}: -------------", i);
                pNode.print();
                i++;
                pNode = pNode.pNext;
            }
        }
Exemplo n.º 24
0
        protected override void derivedDumpNode(MLink pLink)
        {
            Debug.Assert(pLink != null);
            GhostNode pNode = (GhostNode)pLink;

            pNode.DumpNodeData();
        }
        public static void printList()
        {
            CollisionPairManager collisionManInst = CollisionPairManager.getSingletonInstance();

            Debug.Assert(collisionMInstance != null);
            Debug.WriteLine("");
            Debug.WriteLine("------ Active List Collision Pair Man: ---------------------------\n");

            MLink pNode = collisionManInst.activeList;

            int i = 0;

            while (pNode != null)
            {
                Debug.WriteLine("{0}: -------------", i);
                pNode.print();
                i++;
                pNode = pNode.pNext;
            }

            Debug.WriteLine("");
            Debug.WriteLine("------ Reserve List Collision Pair Man: ---------------------------\n");

            pNode = collisionManInst.reserveList;
            i     = 0;
            while (pNode != null)
            {
                Debug.WriteLine("{0}: -------------", i);
                pNode.print();
                i++;
                pNode = pNode.pNext;
            }
        }
Exemplo n.º 26
0
        protected override void printStats(ref MLink targetNode)
        {
            Debug.Assert(targetNode != null);
            TimerEvent timerNode = (TimerEvent)targetNode;

            Debug.Assert(timerNode != null);
            timerNode.printStats();
        }
        public static void remove(ref MLink targetNode)
        {
            SpriteBoxManager spriteBoxMInstance = SpriteBoxManager.getSingletonInstance();

            Debug.Assert(spriteBoxMInstance != null);
            Debug.Assert(targetNode != null);
            spriteBoxMInstance.genericRemove(targetNode);
        }
Exemplo n.º 28
0
        protected override bool compareDerivedNode(ref MLink targetNode, ref MLink currNode)
        {
            Debug.Assert(targetNode != null);
            Debug.Assert(currNode != null);

            if (targetNode == currNode)
                return true;
            else
                return false;
        }
Exemplo n.º 29
0
        //----------------------------------------------------------------------
        // Override Abstract methods
        //----------------------------------------------------------------------

        //EDIT THE FOLLOWING METHODS---------------------
        protected override void derivedDestroyNode(MLink pLink)
        {
            DeathNode pNode = (DeathNode)pLink;

            #if (TRACK_DESTRUCTOR)
            if (pNode.pObject != null)
            {
                Debug.WriteLine("     {0} ({1})", pNode.pObject, pNode.pObject.GetHashCode());
            }
            #endif
            pNode.pObject = null;
        }
Exemplo n.º 30
0
        public void addSorted(MLink mTargetNode)
        {
            Debug.Assert(mTargetNode != null);
            mTargetNode.wash();

            TimerEvent mTargetEvent = (TimerEvent)mTargetNode;

            Debug.Assert(mTargetEvent != null);

            if (this.activeList == null)
            {
                activeList = mTargetNode;
            }
            else
            {
                // Add to sorted list

                MLink mCurrNode = this.activeList;
                Debug.Assert(mCurrNode != null);

                while (mCurrNode != null)
                {
                    TimerEvent mCurrEvent = (TimerEvent)mCurrNode;
                    if (mTargetEvent.cTriggerTime <= mCurrEvent.cTriggerTime)
                    {
                        if (mCurrEvent.pPrev != null)
                        {
                            mCurrEvent.pPrev.pNext = mTargetEvent;
                            mTargetEvent.pPrev     = mCurrEvent.pPrev;
                            mTargetEvent.pNext     = mCurrEvent;
                            mCurrEvent.pPrev       = mTargetEvent;
                        }
                        else
                        {
                            mCurrNode.pPrev       = mTargetNode;
                            mCurrNode.pPrev.pNext = mCurrNode;
                            activeList            = mTargetNode;
                        }
                        break;
                    }
                    if (mCurrNode.pNext == null)
                    {
                        mCurrNode.pNext   = mTargetNode;
                        mTargetNode.pPrev = mCurrNode;
                        break;
                    }
                    mCurrNode = mCurrNode.pNext;
                }
                //genericPrint();
            }
        }