java.lang.Object
io.deephaven.engine.table.impl.by.ssmcountdistinct.compactmodifications.CharCompactModifications

public class CharCompactModifications extends Object
Reduces a parallel pair of "removed" (pre-modify) and "added" (post-modify) value runs to the net change required of a SegmentedSortedMultiSet: values that were both removed and added in equal quantity cancel out, leaving only the net removals in removedValues and the net additions in addedValues.
  • Constructor Details

    • CharCompactModifications

      public CharCompactModifications()
  • Method Details

    • compactAndCountModifications

      public static void compactAndCountModifications(WritableCharChunk<? extends Values> removedValues, WritableIntChunk<ChunkLengths> removedCounts, WritableCharChunk<? extends Values> addedValues, WritableIntChunk<ChunkLengths> addedCounts, int removedStart, int removedLength, int addedStart, int addedLength, boolean countNull, boolean countNaN, MutableInt removedSize, MutableInt addedSize)
      Diff the removedLength removed values beginning at removedStart against the addedLength added values beginning at addedStart: values that were both removed and added in equal quantity cancel out. After the call removedValues/removedCounts hold the net removals compacted to distinct values beginning at removedStart, and addedValues/addedCounts hold the net additions compacted to distinct values beginning at addedStart; the surviving lengths are returned via removedSize/addedSize. The chunk sizes are left unchanged so the inputs may be sub-ranges of larger shared chunks (the removed and added ranges may have different starts and lengths, e.g. when each side is a separately-flattened run of child deltas).
      Parameters:
      removedValues - the removed values; receives the net removals
      removedCounts - receives the count removed for each surviving net removal
      addedValues - the added values; receives the net additions
      addedCounts - receives the count added for each surviving net addition
      removedStart - the first position to process in the removed chunk
      removedLength - the number of positions to process in the removed chunk
      addedStart - the first position to process in the added chunk
      addedLength - the number of positions to process in the added chunk
      countNull - whether null is a countable value
      countNaN - whether NaN is a countable value
      removedSize - set to the number of surviving net removals
      addedSize - set to the number of surviving net additions