Beispiel #1
0
        private long[] ReducedNodes(NodeLabelRange range)
        {
            long[] nodes  = range.Nodes();
            long[] result = new long[nodes.Length];
            int    cursor = 0;

            foreach (long node in nodes)
            {
                if (range.Labels(node).Length > 0)
                {
                    result[cursor++] = node;
                }
            }
            return(Arrays.copyOf(result, cursor));
        }
Beispiel #2
0
        private static void AssertRanges(IEnumerator <NodeLabelRange> iterator, int[] expectedRanges)
        {
            for (int expectedRangeId = 0; expectedRangeId < expectedRanges.Length; expectedRangeId++)
            {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(iterator.hasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                NodeLabelRange actualRange = iterator.next();
                assertEquals(expectedRangeId, actualRange.Id());
                int  expectedRange = expectedRanges[expectedRangeId];
                long baseNodeId    = expectedRangeId * RANGE_SIZE;
                for (int i = 0; i < RANGE_SIZE; i++)
                {
                    long   nodeId           = baseNodeId + i;
                    long[] expectedLabelIds = (expectedRange & (1 << i)) == 0 ? EMPTY_LONG_ARRAY : _labelIds;
                    assertArrayEquals(expectedLabelIds, actualRange.Labels(nodeId));
                    assertEquals(nodeId, actualRange.Nodes()[i]);
                }
            }
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertFalse(iterator.hasNext());
        }