Ejemplo n.º 1
0
        /// <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
        }
Ejemplo n.º 2
0
//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);
        }
Ejemplo n.º 3
0
//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);
        }