public void Insert(DListIterator p_iterator, string p_data) { if (p_iterator.m_list != this) { return; } if (p_iterator.m_node != null) { p_iterator.m_node.InsertAfter(p_data); if (p_iterator.m_node == m_tail) { m_tail = p_iterator.m_node.m_next; } m_count++; } else { Append(p_data); } }
public void Remove(DListIterator p_iterator, DListNode node) { if (p_iterator.m_list != this) { return; } if (p_iterator.m_node == null) { return; } if (p_iterator.m_node == m_head) { p_iterator.Forth(); RemoveHead(); } else { while (node.m_next != p_iterator.m_node) { node = node.m_next; } p_iterator.Forth(); if (node.m_next == m_tail) { m_tail = node; } node.m_next = null; node.m_next = p_iterator.m_node; } m_count--; }