Class TrackingWritableRowSetImpl

All Implemented Interfaces:
LogOutputAppendable, RowSequence, RowSet, TrackingRowSet, TrackingWritableRowSet, WritableRowSet, LongSizedDataStructure, SafeCloseable, Externalizable, Serializable, AutoCloseable

public class TrackingWritableRowSetImpl extends WritableRowSetImpl implements TrackingWritableRowSet
See Also:
  • Constructor Details

    • TrackingWritableRowSetImpl

      public TrackingWritableRowSetImpl()
    • TrackingWritableRowSetImpl

      public TrackingWritableRowSetImpl(OrderedLongSet innerSet)
  • Method Details

    • indexer

      public <INDEXER_TYPE extends TrackingRowSet.Indexer> INDEXER_TYPE indexer(@NotNull @NotNull Function<TrackingRowSet,INDEXER_TYPE> indexerFactory)
      Description copied from interface: TrackingRowSet
      Get an opaque TrackingRowSet.Indexer object previously associated with this TrackingRowSet, or set and get one created with indexerFactory if this is the first invocation.
      Specified by:
      indexer in interface TrackingRowSet
      Parameters:
      indexerFactory - The indexer factory to be used if no indexer has been set previously
      Returns:
      An opaque indexer object associated with this TrackingRowSet
    • indexer

      public <INDEXER_TYPE extends TrackingRowSet.Indexer> INDEXER_TYPE indexer()
      Description copied from interface: TrackingRowSet
      Get an opaque TrackingRowSet.Indexer object previously associated with this TrackingRowSet.
      Specified by:
      indexer in interface TrackingRowSet
      Returns:
      An opaque indexer object associated with this TrackingRowSet, or null if none has been set
    • preMutationHook

      protected void preMutationHook()
      Overrides:
      preMutationHook in class WritableRowSetImpl
    • toTracking

      public TrackingWritableRowSet toTracking()
      Description copied from interface: WritableRowSet

      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.

      Specified by:
      toTracking in interface WritableRowSet
      Overrides:
      toTracking in class WritableRowSetImpl
      Returns:
      A TrackingWritableRowSet constructed from this WritableRowSet, or this if already tracking
    • close

      public void close()
      Description copied from interface: RowSequence

      Free any resources associated with this object.

      Using any RowSequence methods after close() is an error and may produce exceptions or undefined results.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface RowSequence
      Specified by:
      close in interface RowSet
      Specified by:
      close in interface SafeCloseable
      Overrides:
      close in class WritableRowSetImpl
    • initializePreviousValue

      public void initializePreviousValue()
      Description copied from interface: TrackingWritableRowSet
      Initializes our previous value from the current value.

      This call is used by operations that manipulate a TrackingWritableRowSet while constructing it, but need to set the state at the end of the initial operation to the current state.

      Calling this in other circumstances will yield undefined results.

      Specified by:
      initializePreviousValue in interface TrackingWritableRowSet
    • sizePrev

      public long sizePrev()
      Description copied from interface: TrackingRowSet
      Get the size of this TrackingRowSet as of the end of the previous update graph cycle.
      Specified by:
      sizePrev in interface TrackingRowSet
      Returns:
      The previous size
    • copyPrev

      public WritableRowSet copyPrev()
      Description copied from interface: TrackingRowSet
      Get a copy of the value of this TrackingRowSet as of the end of the previous update graph cycle. As in other operations that return a WritableRowSet, the result must be closed by the caller when it is no longer needed. The result will never be a TrackingRowSet; use WritableRowSet.toTracking() on the result as needed.
      Specified by:
      copyPrev in interface TrackingRowSet
      Returns:
      A copy of the previous value
    • prev

      public RowSet prev()
      Description copied from interface: TrackingRowSet
      Access the read-only value of this TrackingRowSet as of the end of the previous update graph cycle. The returned RowSet must not be mutated or closed; it belongs to this TrackingRowSet. Callers should be sure to only use the result during the updating phase of a cycle, and never across logical clock phases/steps.
      Specified by:
      prev in interface TrackingRowSet
      Returns:
      A read-only view of the previous value, owned by this TrackingRowSet
    • getPrev

      public long getPrev(long rowPosition)
      Description copied from interface: TrackingRowSet
      Same as get(rowPosition), as of the end of the previous update graph cycle.
      Specified by:
      getPrev in interface TrackingRowSet
      Parameters:
      rowPosition - A row position in this RowSet between 0 and sizePrev() - 1.
      Returns:
      The row key previously at the supplied row position
    • findPrev

      public long findPrev(long rowKey)
      Description copied from interface: TrackingRowSet
      Returns the position in [0..(size-1)] where the row key is found in the previous value of this. If not found, then return (-(position it would be) - 1), as in Array.binarySearch.
      Specified by:
      findPrev in interface TrackingRowSet
      Parameters:
      rowKey - The row key to search for
      Returns:
      A position from [0..(size-1)] if the row key was found. If the row key was not found, then (-position - 1) as in Array.binarySearch
    • firstRowKeyPrev

      public long firstRowKeyPrev()
      Description copied from interface: TrackingRowSet
      Same as firstRowKey(), as of the end of the previous update graph cycle.
      Specified by:
      firstRowKeyPrev in interface TrackingRowSet
      Returns:
      The previous first row key
    • lastRowKeyPrev

      public long lastRowKeyPrev()
      Description copied from interface: TrackingRowSet
      Same as lastRowKey(), as of the end of the previous update graph cycle.
      Specified by:
      lastRowKeyPrev in interface TrackingRowSet
      Returns:
      The previous last row key
    • readExternal

      public void readExternal(@NotNull @NotNull ObjectInput in) throws IOException
      Specified by:
      readExternal in interface Externalizable
      Overrides:
      readExternal in class WritableRowSetImpl
      Throws:
      IOException