private static IEnumerable <Entry <T> > TraverseNode(PersistentBTree <T> tree, Node <T> node) { if (node.ChildNodes.Count == 0) { foreach (var e in node.Keys) { yield return(e); } yield break; } for (int i = 0; i < node.Keys.Count; i++) { foreach (var e in TraverseNode(tree, tree.LoadNode(node.ChildNodes[i]))) { yield return(e); } yield return(node.Keys[i]); } foreach (var e in TraverseNode(tree, tree.LoadNode(node.ChildNodes.Last()))) { yield return(e); } }
public static IEnumerable <Entry <T> > InOrderTraversal(PersistentBTree <T> tree) { return(TraverseNode(tree, tree.Root)); }
/// <summary> /// Create a new resource id index. /// </summary> public ResourceIdIndex(Store store, PersistentBTree <Bucket> index) { _store = store; _index = index; _resourceIdCache = new Dictionary <string, ulong>(); }