//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public boolean visit(org.neo4j.kernel.api.labelscan.NodeLabelUpdate update) throws java.io.IOException public override bool Visit(NodeLabelUpdate update) { bool visit = base.Visit(update); ProgressReporter.progress(1); return(visit); }
private void ConvertAndAssert(long[] before, long[] after, long[] expectedRemoved, long[] expectedAdded) { NodeLabelUpdate update = NodeLabelUpdate.labelChanges(0, before, after); PhysicalToLogicalLabelChanges.ConvertToAdditionsAndRemovals(update); assertArrayEquals(Terminate(update.LabelsBefore), expectedRemoved); assertArrayEquals(Terminate(update.LabelsAfter), expectedAdded); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void initializeNativeLabelScanStoreWithContent(org.neo4j.io.layout.DatabaseLayout databaseLayout) throws java.io.IOException private void InitializeNativeLabelScanStoreWithContent(DatabaseLayout databaseLayout) { using (Lifespan lifespan = new Lifespan()) { NativeLabelScanStore nativeLabelScanStore = GetNativeLabelScanStore(databaseLayout, false); lifespan.Add(nativeLabelScanStore); using (LabelScanWriter labelScanWriter = nativeLabelScanStore.NewWriter()) { labelScanWriter.Write(NodeLabelUpdate.labelChanges(1, new long[0], new long[] { 1 })); } nativeLabelScanStore.Force(Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited); } }
/// <summary> /// Converts physical before/after state to logical remove/add state. This conversion reuses the existing /// long[] arrays in <seealso cref="NodeLabelUpdate"/>, 'before' is used for removals and 'after' is used for adds, /// by shuffling numbers around and possible terminates them with -1 because the logical change set will be /// equally big or smaller than the physical change set. /// </summary> /// <param name="update"> <seealso cref="NodeLabelUpdate"/> containing physical before/after state. </param> internal static void ConvertToAdditionsAndRemovals(NodeLabelUpdate update) { int beforeLength = update.LabelsBefore.Length; int afterLength = update.LabelsAfter.Length; int bc = 0; int ac = 0; long[] before = update.LabelsBefore; long[] after = update.LabelsAfter; for (int bi = 0, ai = 0; bi < beforeLength || ai < afterLength;) { long beforeId = bi < beforeLength ? before[bi] : -1; long afterId = ai < afterLength ? after[ai] : -1; if (beforeId == afterId) { // no change bi++; ai++; continue; } if (Smaller(beforeId, afterId)) { while (Smaller(beforeId, afterId) && bi < beforeLength) { // looks like there's an id in before which isn't in after ==> REMOVE update.LabelsBefore[bc++] = beforeId; bi++; beforeId = bi < beforeLength ? before[bi] : -1; } } else if (Smaller(afterId, beforeId)) { while (Smaller(afterId, beforeId) && ai < afterLength) { // looks like there's an id in after which isn't in before ==> ADD update.LabelsAfter[ac++] = afterId; ai++; afterId = ai < afterLength ? after[ai] : -1; } } } TerminateWithMinusOneIfNeeded(update.LabelsBefore, bc); TerminateWithMinusOneIfNeeded(update.LabelsAfter, ac); }