Beispiel #1
0
 internal void RemoveParent(TreeElement<T> parent)
 {
     _parents.Remove(parent);
     parent._children.Remove(this);
     PathCountRecalulate();
 }
Beispiel #2
0
 internal void RemoveChild(TreeElement<T> child)
 {
     _children.Remove(child);
     child._parents.Remove(this);
     child.PathCountRecalulate();
 }
Beispiel #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);
                    }
                }
            }
        }
Beispiel #4
0
        internal static IEnumerable <TreeElement <T> > GetElementsDown <T>(TreeElement <T> element)
        {
            var elementsWeFound = new HashSet <TreeElement <T> >();

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