Esempio n. 1
0
 internal void RemoveParent(TreeElement<T> parent)
 {
     _parents.Remove(parent);
     parent._children.Remove(this);
     PathCountRecalulate();
 }
Esempio n. 2
0
 internal void RemoveChild(TreeElement<T> child)
 {
     _children.Remove(child);
     child._parents.Remove(this);
     child.PathCountRecalulate();
 }
Esempio n. 3
0
        private static IEnumerable <TreeElement <T> > GetElementsDownWithDuplicates <T>(TreeElement <T> element)
        {
            foreach (TreeElement <T> child in element.Children)
            {
                yield return(child);

                if (child.HasChildren)
                {
                    foreach (TreeElement <T> grandchild in GetElementsDownWithDuplicates(child))
                    {
                        yield return(grandchild);
                    }
                }
            }
        }
Esempio n. 4
0
        internal static IEnumerable <TreeElement <T> > GetElementsDown <T>(TreeElement <T> element)
        {
            var elementsWeFound = new HashSet <TreeElement <T> >();

            return(GetElementsDown(element, elementsWeFound));
        }
Esempio n. 5
0
 /// <summary>
 /// Удаляет все ветки, которые расположены после данного элемента
 /// </summary>
 /// <param name="startElement"></param>
 public void RemoveBranchesAfter(TreeElement <T> startElement)
 {
     startElement.RemoveAllParents();
     RemoveDown(startElement);
     RecalculateBrachCount();
 }
Esempio n. 6
0
 public TreeDecision()
 {
     Root         = new TreeElement <T>();
     _elements    = new HashSet <TreeElement <T> >();
     _branchCount = 1;
 }