/// <summary>
 /// Merge data object with this list.
 /// Only objects that are not already in the list
 /// are added to the list.
 /// </summary>
 /// <param name='data'>The data to merge.</param>
 public void Merge(WebTaxonTreeNode data)
 {
     if (data.IsNotNull() && _idHashTable[data.Id].IsNull())
     {
         Add(data);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Add a taxon tree node to the children
        /// of this taxon tree node.
        /// </summary>
        /// <param name='taxonTreeNode'>Taxon tree node to add.</param>
        public void AddChild(WebTaxonTreeNode taxonTreeNode)
        {
            Int32 taxonTreeIndex;

            if (Children.IsNull())
            {
                Children = new List <WebTaxonTreeNode>();
            }
            taxonTreeNode.IsChild = true;

            // Sort children in Taxon.SortOrder;
            if (Children.IsNotEmpty())
            {
                for (taxonTreeIndex = 0; taxonTreeIndex < Children.Count; taxonTreeIndex++)
                {
                    if (taxonTreeNode.Taxon.SortOrder < Children[taxonTreeIndex].Taxon.SortOrder)
                    {
                        Children.Insert(taxonTreeIndex, taxonTreeNode);
                        return;
                    }
                }
            }
            Children.Add(taxonTreeNode);
        }