public virtual Bootstrap BootstrapTree(File file, string targetLayout) { try { // Get meta information about the tree //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: MetaVisitor<?,?> metaVisitor = new MetaVisitor(); MetaVisitor <object, ?> metaVisitor = new MetaVisitor(); GBPTreeStructure.VisitHeader(_pageCache, file, metaVisitor); Meta meta = metaVisitor.MetaConflict; Pair <TreeState, TreeState> statePair = metaVisitor.StatePair; TreeState state = TreeStatePair.SelectNewestValidState(statePair); // Create layout and treeNode from meta //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: Layout<?,?> layout = layoutBootstrapper.create(file, pageCache, meta, targetLayout); Layout <object, ?> layout = _layoutBootstrapper.create(file, _pageCache, meta, targetLayout); TreeNodeSelector.Factory factory = TreeNodeSelector.SelectByFormat(meta.FormatIdentifier, meta.FormatVersion); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: TreeNode<?,?> treeNode = factory.create(meta.getPageSize(), layout); TreeNode <object, ?> treeNode = factory.Create(meta.PageSize, layout); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: GBPTree<?,?> tree = new GBPTree<>(pageCache, file, layout, meta.getPageSize(), NO_MONITOR, NO_HEADER_READER, NO_HEADER_WRITER, ignore(), readOnly); GBPTree <object, ?> tree = new GBPTree <object, ?>(_pageCache, file, layout, meta.PageSize, NO_MONITOR, NO_HEADER_READER, NO_HEADER_WRITER, ignore(), _readOnly); return(new SuccessfulBootstrap(tree, layout, treeNode, state, meta)); } catch (Exception) { return(new FailedBootstrap()); } }
/// <summary> /// Let the passed in {@code cursor} point to the root or sub-tree (internal node) of what to visit. /// </summary> /// <param name="cursor"> <seealso cref="PageCursor"/> placed at root of tree or sub-tree. </param> /// <param name="writeCursor"> Currently active <seealso cref="PageCursor write cursor"/> in tree. </param> /// <param name="visitor"> <seealso cref="GBPTreeVisitor"/> that should visit the tree. </param> /// <exception cref="IOException"> on page cache access error. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void visitTree(org.neo4j.io.pagecache.PageCursor cursor, org.neo4j.io.pagecache.PageCursor writeCursor, GBPTreeVisitor<KEY,VALUE> visitor) throws java.io.IOException internal virtual void VisitTree(PageCursor cursor, PageCursor writeCursor, GBPTreeVisitor <KEY, VALUE> visitor) { // TreeState long currentPage = cursor.CurrentPageId; Pair <TreeState, TreeState> statePair = TreeStatePair.ReadStatePages(cursor, IdSpace.STATE_PAGE_A, IdSpace.STATE_PAGE_B); visitor.TreeState(statePair); TreeNode.GoTo(cursor, "back to tree node from reading state", currentPage); AssertOnTreeNode(Select(cursor, writeCursor)); // Traverse the tree int level = 0; do { // One level at the time visitor.BeginLevel(level); long leftmostSibling = cursor.CurrentPageId; // Go right through all siblings VisitLevel(cursor, writeCursor, visitor); visitor.EndLevel(level); level++; // Then go back to the left-most node on this level TreeNode.GoTo(cursor, "back", leftmostSibling); } while (GoToLeftmostChild(cursor, writeCursor)); // And continue down to next level if this level was an internal level }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @ParameterizedTest @MethodSource(value = "parameters") void shouldCorrectSelectNewestAndOldestState(State stateA, State stateB, Selected expectedNewest, Selected expectedOldest) throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldCorrectSelectNewestAndOldestState(State stateA, State stateB, Selected expectedNewest, Selected expectedOldest) { // GIVEN _cursor.next(PAGE_A); stateA.write(_cursor); _cursor.next(PAGE_B); stateB.write(_cursor); // WHEN Pair <TreeState, TreeState> states = TreeStatePair.ReadStatePages(_cursor, PAGE_A, PAGE_B); // THEN expectedNewest.verify(states, SelectionUseCase.Newest); expectedOldest.verify(states, SelectionUseCase.Oldest); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: static void visitTreeState(org.neo4j.io.pagecache.PageCursor cursor, GBPTreeVisitor visitor) throws java.io.IOException internal static void VisitTreeState(PageCursor cursor, GBPTreeVisitor visitor) { Pair <TreeState, TreeState> statePair = TreeStatePair.ReadStatePages(cursor, IdSpace.STATE_PAGE_A, IdSpace.STATE_PAGE_B); visitor.treeState(statePair); }
public override void TreeState(Pair <TreeState, TreeState> statePair) { this._treeState = TreeStatePair.SelectNewestValidState(statePair); }