void AssertValid() { if (_stack.Count == 0) { TreeNodeUtils.ThrowCursorHaveToBeValid(); } }
void AssertWritable() { if (!_rootNode._writable) { TreeNodeUtils.ThrowCursorNotWritable(); } }
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); }
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++; } }); }
// 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; } }
public void CalcCommonLengthWithIdenticalPrefixes() { PreviousCurrentCommonLength = (uint)(CurrentPrefix.Length + TreeNodeUtils.FindFirstDifference(PreviousSuffix, CurrentSuffix)); }
public void CalcCommonLength() { PreviousCurrentCommonLength = (uint) TreeNodeUtils.FindFirstDifference(PreviousPrefix, PreviousSuffix, CurrentPrefix, CurrentSuffix); }
internal static IntPtr Read12Ptr(IntPtr childPtr) { return(TreeNodeUtils.ReadIntPtrUnaligned(childPtr + sizeof(uint))); }
internal static IntPtr ReadPtr(IntPtr ptr) { return(TreeNodeUtils.ReadIntPtrUnaligned(ptr)); }
public void CreateTree(IEnumerable <ITreeNode> nodes) { InstantiateTree(TreeNodeUtils.FindRoot(nodes), null); }