Exemple #1
0
        public void Remove(TreeListNode node)
        {
            if (m_lastNode == null)
            {
                return;
            }
            m_version++;
            ClearInternalArray();
            Debug.Assert(node != null && object.ReferenceEquals(node.Owner, this), "Remove(Node node)");

            TreeListNode prev = node.PrevSibling;
            TreeListNode next = node.NextSibling;

            node.Remove();

            if (prev == null) // first node
            {
                m_firstNode = next;
            }
            if (next == null) // last node
            {
                m_lastNode = prev;
            }
            m_IdDirty++;
            m_count--;
            TreeListNode.SetHasChildren(m_owner, m_count != 0);
        }
Exemple #2
0
 public virtual void Clear()
 {
     m_version++;
     while (m_firstNode != null)
     {
         TreeListNode node = m_firstNode;
         m_firstNode = node.NextSibling;
         node.Remove();
     }
     m_firstNode      = null;
     m_lastNode       = null;
     m_count          = 0;
     m_totalNodeCount = 0;
     m_IdDirty        = 0;
     m_nextId         = 0;
     ClearInternalArray();
     TreeListNode.SetHasChildren(m_owner, m_count != 0);
 }