コード例 #1
0
        public override void Add(T item)
        {
            DojoListNode current = FrontNode;

            if (FrontNode == null)
            {
                FrontNode = new DojoListNode()
                {
                    Data = item
                }
            }
            ;
            else
            {
                while (current.Next != null)
                {
                    current = current.Next;
                }
                current.Next = new DojoListNode()
                {
                    Data = item
                };
            }
            nodeCount++;
        }
コード例 #2
0
 public DojoListNode()
 {
     IsDummyNode = false;
     Data        = default;
     Next        = default;
     Previous    = default;
 }
コード例 #3
0
 public override void Add(T item)
 {
     _ = FrontNode == null
         ? FrontNode = BackNode = new DojoListNode {
         Data = item
     }
         : BackNode.Next = BackNode = new DojoListNode {
         Data = item
     };
 }
コード例 #4
0
ファイル: Dustin.cs プロジェクト: mattshoe81/SamuraiDojo
        public override int Size()
        {
            int          counter     = 0;
            DojoListNode currentNode = base.FrontNode;

            while (currentNode != null)
            {
                counter++;
                currentNode = currentNode.Next;
            }

            return(counter);
        }
コード例 #5
0
        public override string ToString()
        {
            string       result  = "[";
            DojoListNode current = FrontNode;

            while (current != null)
            {
                string separator = current.Next == null ? "" : ", ";
                if (!current.IsDummyNode)
                {
                    result += $"{current.Data.ToString()}{separator}";
                }

                current = current.Next;
            }
            result += "]";

            return(result);
        }
コード例 #6
0
ファイル: Dustin.cs プロジェクト: mattshoe81/SamuraiDojo
        public override void Add(T item)
        {
            DojoListNode newNode = new DojoListNode();

            newNode.Data = item;
            newNode.Next = null;

            if (base.FrontNode == null)
            {
                base.FrontNode = newNode;
                base.BackNode  = newNode;
                return;
            }
            else
            {
                BackNode.Next = newNode;
                base.BackNode = newNode;
            }
        }
コード例 #7
0
        public override void Add(T item)
        {
            DojoListNode node = new DojoListNode();

            node.Data = item;

            if (FrontNode == null)
            {
                FrontNode = node;
                BackNode  = node;
            }
            else
            {
                BackNode.Next = node;
                BackNode      = node;
            }

            size++;
        }