GAM456-SpaceInvaders / SpaceInvaders / 0_Manager / DLink / DLink.cs
DLink.cs
Raw
using System;
using System.Diagnostics;


namespace SpaceInvaders
{
    public abstract class DLink : Node
    {
        //-------------------------------------------------------------------
        //  FIELDS
        //-------------------------------------------------------------------

        public DLink pNext;
        public DLink pPrev;

        //-------------------------------------------------------------------
        //  CLASS METHODS
        //-------------------------------------------------------------------

        public DLink()
        {
            this.Clear();
        }


        //-------------------------------------------------------------------
        //  PUBLIC METHODS
        //-------------------------------------------------------------------

        public override void Reset()
        {
            this.Clear();
        }

        public override void PrintStats()
        {
            if (this.pPrev == null)
            {
                Debug.WriteLine("      prev: null");
            }
            else
            {
                Node pTmp = (Node)this.pPrev;
                Debug.WriteLine("      prev: {0} ({1})", pTmp.GetName(), pTmp.GetHashCode());
            }

            if (this.pNext == null)
            {
                Debug.WriteLine("      next: null");
            }
            else
            {
                Node pTmp = (Node)this.pNext;
                Debug.WriteLine("      next: {0} ({1})", pTmp.GetName(), pTmp.GetHashCode());
            }
        }


        //-------------------------------------------------------------------
        //  PRIVATE METHODS
        //-------------------------------------------------------------------

        //reset links to default
        private void Clear()
        {
            this.pNext = null;
            this.pPrev = null;
        }


    } //end class

} //end namespace