Ejemplo n.º 1
0
        // prefill the
        protected void fillReserve(int fillCount)
        {
            Debug.Assert(fillCount > 0);
            // create the Data Node of the Derieved class and add it to reserve list at front
            for (int i = 0; i < fillCount; i++)
            {
                MLink dataNode = this.createConcreteNode();

                Debug.Assert(dataNode != null);
                MLink.addToFront(dataNode, ref this.reserveList);
                mNumReserveNodes++;
                mTotalNodes++;
            }
        }
Ejemplo n.º 2
0
        // remove a node from active and add it to reserve
        protected void genericRemove(MLink dataNode)
        {
            Debug.Assert(dataNode != null);

            // remove from active
            MLink.removeNode(dataNode, ref this.activeList);

            //wash the data node
            dataNode.wash();

            //add it to reserve list
            MLink.addToFront(dataNode, ref this.reserveList);
            mNumActiveNodes--;
            mNumReserveNodes++;
        }
Ejemplo n.º 3
0
        // Removes a node from reserve and add it to active
        protected MLink genericAdd()
        {
            //Check if the reserve list is empty, If yes, refill

            if (reserveList == null)
            {
                fillReserve(deltaRefillCount);
            }
            // remove from front of reserve list
            MLink dNode = MLink.removeFromFront(ref reserveList);

            Debug.Assert(dNode != null);

            // add it to the front of active list
            MLink.addToFront(dNode, ref activeList);

            mNumReserveNodes--;
            mNumActiveNodes++;

            return(dNode);
        }