Interface WritableRowSet

All Superinterfaces:
AutoCloseable, LogOutputAppendable, LongSizedDataStructure, RowSequence, RowSet, SafeCloseable
All Known Subinterfaces:
TrackingWritableRowSet
All Known Implementing Classes:
TrackingWritableRowSetImpl, WritableRowSetImpl

public interface WritableRowSet extends RowSet
RowSet that may be mutated (that is, have its contents changed in-place). Note that all RowSet implementations conform to this interface, but many APIs only expose the super-interface to discourage inappropriate changes.
  • Method Details

    • insert

      void insert(long key)
      Add a single key to this RowSet if it's not already present.
      Parameters:
      key - The key to add
    • insertRange

      void insertRange(long startKey, long endKey)
      Add all keys in a closed range to this RowSet if they are not already present.
      Parameters:
      startKey - The first key to add
      endKey - The last key to add (inclusive)
    • insert

      void insert(LongChunk<OrderedRowKeys> keys, int offset, int length)
      Add all of the (ordered) keys in a slice of keys to this RowSet if they are not already present.
      Parameters:
      keys - The LongChunk of OrderedRowKeys to insert
      offset - The offset in keys to begin inserting keys from
      length - The number of keys to insert
    • insert

      void insert(RowSet added)
      Add all of the keys in added to this RowSet if they are not already present.
      Parameters:
      added - The RowSet to add
    • remove

      void remove(long key)
      Remove a single key from this RowSet if it's present.
      Parameters:
      key - The key to remove
    • removeRange

      void removeRange(long startKey, long endKey)
      Remove all keys in a closed range from this RowSet if they are present.
      Parameters:
      startKey - The first key to remove
      endKey - The last key to remove (inclusive)
    • remove

      void remove(LongChunk<OrderedRowKeys> keys, int offset, int length)
      Remove all of the (ordered) keys in a slice of keys from this RowSet if they are present.
      Parameters:
      keys - The LongChunk of OrderedRowKeys to remove
      offset - The offset in keys to begin removing keys from
      length - The number of keys to remove
    • remove

      void remove(RowSet removed)
      Remove all of the keys in removed that are present in this RowSet.
      Parameters:
      removed - The RowSet to remove
    • update

      void update(RowSet added, RowSet removed)
      Simultaneously adds the keys from the first RowSet and removes the keys from the second one. API assumption: the intersection of added and removed is empty.
    • extract

      @NotNull default @NotNull WritableRowSet extract(@NotNull @NotNull RowSet other)
      Removes all the keys from other RowSet that are present in this RowSet.
      Returns:
      a new RowSet representing the keys removed
    • retain

      void retain(RowSet rowSetToIntersect)
      Modifies the RowSet by removing any keys not in the rowSetToIntersect argument.
      Parameters:
      rowSetToIntersect - a rowSet with the keys to retain; any other keys not in rowSetToIntersect will be removed.
    • retainRange

      void retainRange(long startRowKey, long endRowKey)
      Modifies the RowSet by keeping only keys in the interval [startRowKey, endRowKey]
      Parameters:
      startRowKey - beginning of interval of keys to keep.
      endRowKey - endRowKey of interval of keys to keep (inclusive).
    • clear

      void clear()
    • shiftInPlace

      void shiftInPlace(long shiftAmount)
    • insertWithShift

      void insertWithShift(long shiftAmount, RowSet other)
      For each key in the provided RowSet, shift it by shiftAmount and insert it in the current RowSet.
      Parameters:
      shiftAmount - the amount to add to each key in the RowSet argument before insertion.
      other - the RowSet with the keys to shift and insert.
    • compact

      void compact()
      May reclaim some unused memory.
    • resetTo

      void resetTo(@NotNull @NotNull RowSet other)
      Reset this RowSet to exactly match another RowSet. Subsequent modifications to other will not change this.
      Parameters:
      other - The RowSet to reset to
    • trackingCast

      default TrackingWritableRowSet trackingCast()
      Description copied from interface: RowSet

      Cast this RowSet reference to a TrackingRowSet.

      Specified by:
      trackingCast in interface RowSet
      Returns:
      this cast to a TrackingRowSet
    • toTracking

      Destructively convert this WritableRowSet into a TrackingWritableRowSet.

      This is really only suitable when the caller "owns" this WritableRowSet. Programming errors may occur if the any code holds onto references to this rather than the result, because there may be ambiguity about resource ownership.

      Implementations are free to transfer ownership of resources from this object to the result. As such, it is an error to directly use this object afterwards; callers must instead use the returned result.

      It is an error to invoke this on an instance that is already tracking.

      Returns:
      A TrackingWritableRowSet constructed from this WritableRowSet, or this if already tracking