private SearchResult Search(T key) { ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "DoLookup"); RbtreeNode currentNode = _rootNode; SearchResult result = new Rbtree <T> .SearchResult(); try { while (currentNode != null) { result.Position = _comparer.Compare(currentNode.Value, key); if (result.Position == 0) { result.Node = currentNode; return(result); } result.ParentNode = currentNode; if (result.Position > 0) { currentNode = currentNode.Left; } else { currentNode = currentNode.Right; } } } catch (Exception ex) { Log.Exception(PROC, ex); } return(result); }
public Enumerator(Rbtree <T> parent) { _parent = parent; _node = _parent._rootNode; _stack = new DoubleLinkedListStack <RbtreeNode>(); _current = null; this.Initialize(); }