/// <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(WebFactorTreeNode data)
 {
     if (data.IsNotNull() && _idHashtable[data.Id].IsNull())
     {
         Add(data);
     }
 }
예제 #2
0
        private void CheckCircularTree(WebFactorTreeNode factorTree,
                                       List <Int32> factorIds)
        {
            List <Int32> childFactorIds;

            if (factorTree.IsNotNull())
            {
                if (factorIds.Contains(factorTree.Id))
                {
                    // Circular factor tree found.
                    throw new Exception("Circular factor tree found! Factor id = " + factorTree.Id);
                }
                else
                {
                    factorIds.Add(factorTree.Id);
                }

                if (factorTree.Children.IsNotEmpty())
                {
                    foreach (WebFactorTreeNode child in factorTree.Children)
                    {
                        childFactorIds = new List <Int32>();
                        childFactorIds.AddRange(factorIds);
                        CheckCircularTree(child, childFactorIds);
                    }
                }
            }
        }