예제 #1
0
        public bool Remove(T value)
        {
            BetterLinkedListNode <T> node = Find(value);

            Remove(node);
            return(node != null);
        }
예제 #2
0
        public BetterLinkedListNode <T> AddFirst(T value)
        {
            BetterLinkedListNode <T> newNode = BetterLinkedListNode <T> .Get();

            newNode.InitInfo(this, value);
            mLinkedList.AddFirst(newNode.Node);
            return(newNode);
        }
예제 #3
0
        public BetterLinkedListNode <T> AddBefore(BetterLinkedListNode <T> node, T value)
        {
            BetterLinkedListNode <T> newNode = BetterLinkedListNode <T> .Get();

            newNode.InitInfo(this, value);
            mLinkedList.AddBefore(node.Node, newNode.Node);
            return(newNode);
        }
예제 #4
0
 public void Remove(BetterLinkedListNode <T> node)
 {
     if (node != null)
     {
         mLinkedList.Remove(node.Node);
         node.Release();
     }
 }
예제 #5
0
        public void CopyTo(T[] array, int index)
        {
            BetterLinkedListNode <T> node = First;

            while (node != null && index < Count)
            {
                array[index++] = node.Value;
                node           = node.Next;
            }
        }
예제 #6
0
        static public BetterLinkedListNode <T> Get()
        {
            BetterLinkedListNode <T> node = ObjPool <BetterLinkedListNode <T> > .Get();

            if (node != null)
            {
                node.List  = default(BetterLinkedList <T>);
                node.Value = default(T);
            }
            return(node);
        }
예제 #7
0
        public void Clear()
        {
            BetterLinkedListNode <T> node = First;

            while (node != null)
            {
                node.Release();
                node = node.Next;
            }
            mLinkedList.Clear();
        }
예제 #8
0
 public bool MoveNext()
 {
     if (node == null)
     {
         node = head;
     }
     else
     {
         node = node.Next;
     }
     return(node != null);
 }
예제 #9
0
        public BetterLinkedListNode <T> FindLast(T value)
        {
            BetterLinkedListNode <T> node = Last;
            EqualityComparer <T>     comp = EqualityComparer <T> .Default;

            while (node != null)
            {
                if (comp.Equals(node.Value, value))
                {
                    return(node);
                }

                node = node.Previous;
            }

            return(null);
        }
예제 #10
0
 public BetterLinkedListNodeData(BetterLinkedListNode <T> holder, T value)
 {
     Holder = holder;
     Value  = value;
 }
예제 #11
0
 public void AddLast(BetterLinkedListNode <T> node)
 {
     mLinkedList.AddLast(node.Node);
 }
예제 #12
0
 public void AddBefore(BetterLinkedListNode <T> node, BetterLinkedListNode <T> newNode)
 {
     mLinkedList.AddBefore(node.Node, newNode.Node);
 }
예제 #13
0
 public void AddAfter(BetterLinkedListNode <T> node, BetterLinkedListNode <T> newNode)
 {
     mLinkedList.AddAfter(node.Node, newNode.Node);
 }
예제 #14
0
 void IEnumerator.Reset()
 {
     node = null;
 }
예제 #15
0
 internal NodeEnumerator(BetterLinkedListNode <T> node)
 {
     this.head = node;
     this.node = null;
 }