Пример #1
0
 void AssertValid()
 {
     if (_stack.Count == 0)
     {
         TreeNodeUtils.ThrowCursorHaveToBeValid();
     }
 }
Пример #2
0
 void AssertWritable()
 {
     if (!_rootNode._writable)
     {
         TreeNodeUtils.ThrowCursorNotWritable();
     }
 }
Пример #3
0
        public void Test222_1()
        {
            var sol  = new _222CountCompleteTreeNodes();
            var root = TreeNodeUtils.CreateCompleteTree(
                new int[] { 1, 2, 3, 4, 5, 6 }
                );
            var res = sol.CountNodes(root);

            Assert.AreEqual(6, res);
        }
Пример #4
0
        private void InitializeFilters(TreeView treeData, string filter)
        {
            if (!Settings.Default.ShowObsolete)
            {
                _filters.Add(new ObsoleteNodeFilter());
            }
            if (filter != null)
            {
                _filters.Add(new SearchNodeFilter(filter));
            }

            TreeNodeUtils.IterateNodes(treeData, node => _filters.ForEach(strategy => strategy.Initialize(node)));

            TreeNodeUtils.IterateNodes(treeData, node =>
            {
                if (FilterAction(node))
                {
                    _visibleNodesCount++;
                }
            });
        }
Пример #5
0
        // since we have data in _treeData, but are displaying _tree,
        // we need to copy data from treedata to trees (according to applied filter)
        private void UpdateDrawnNodes()
        {
            _treeData.SelectedNode = _treeBindings.FindDataNode(_tree.SelectedNode);

            _treeIsUnderUpdate = true;
            _tree.BeginUpdate();
            try
            {
                var filters = new NodeFilter(_treeData, _filter);

                _treeBindings = TreeNodeUtils.CopyTree(_treeData, _tree, filters.FilterAction, filters.UpdateAction);

                _tree.SetHorizontalScroll(0);

                UpdateDrawnNodesSelection();
            }
            finally
            {
                _tree.EndUpdate();
                _treeIsUnderUpdate = false;
            }
        }
Пример #6
0
 public void CalcCommonLengthWithIdenticalPrefixes()
 {
     PreviousCurrentCommonLength =
         (uint)(CurrentPrefix.Length + TreeNodeUtils.FindFirstDifference(PreviousSuffix, CurrentSuffix));
 }
Пример #7
0
 public void CalcCommonLength()
 {
     PreviousCurrentCommonLength = (uint)
                                   TreeNodeUtils.FindFirstDifference(PreviousPrefix, PreviousSuffix, CurrentPrefix, CurrentSuffix);
 }
Пример #8
0
 internal static IntPtr Read12Ptr(IntPtr childPtr)
 {
     return(TreeNodeUtils.ReadIntPtrUnaligned(childPtr + sizeof(uint)));
 }
Пример #9
0
 internal static IntPtr ReadPtr(IntPtr ptr)
 {
     return(TreeNodeUtils.ReadIntPtrUnaligned(ptr));
 }
Пример #10
0
 public void CreateTree(IEnumerable <ITreeNode> nodes)
 {
     InstantiateTree(TreeNodeUtils.FindRoot(nodes), null);
 }