Class ObjectTestSource<T>

java.lang.Object
com.illumon.iris.db.v2.sources.AbstractColumnSource<T>
io.deephaven.engine.testutil.v2.sources.ObjectTestSource<T>
All Implemented Interfaces:
ChunkSource<Attributes.Values>, ChunkSource.WithPrev<Attributes.Values>, DefaultChunkSource<Attributes.Values>, DefaultChunkSource.WithPrev<Attributes.Values>, FillContextMaker, GetContextMaker, ColumnSource<T>, ColumnSourceGetDefaults.ForObject<T>, ElementSource<T>, MutableColumnSource<T>, MutableColumnSourceGetDefaults.ForObject<T>, Releasable, TupleExporter<T>, TupleSource<T>, TestColumnSource<T>, Serializable

public class ObjectTestSource<T> extends AbstractColumnSource<T> implements MutableColumnSourceGetDefaults.ForObject<T>, TestColumnSource<T>
The ObjectTestSource is a ColumnSource used only for testing; not in live code.

It uses a fastutil open addressed hash map from long Index keys to Object values. Previous data is stored in a completely separate map, which is copied from the primary map on the first change in a given cycle. If an uninitialized key is accessed; then an IllegalStateException is thrown. The previous value map is discarded in an UpdateCommitter using a TerminalNotification after the live table monitor cycle is complete.

See Also:
  • Field Details

    • data

      protected final io.deephaven.shadow.fastutil.it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<T> data
    • prevData

      protected io.deephaven.shadow.fastutil.it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<T> prevData
  • Constructor Details

  • Method Details

    • checkIndex

      public void checkIndex(Index index)
    • add

      public void add(ReadOnlyIndex index, Chunk<Attributes.Values> vs)
      Description copied from interface: TestColumnSource
      Add the chunk of data, parallel to index to this column source.

      For TestColumnSources with primitive types, the chunk of data must either be of the appropriate primitive type or an ObjectChunk containing boxed values.

      Specified by:
      add in interface TestColumnSource<T>
      Parameters:
      index - the index locations to add the data
      vs - the data to add
    • remove

      public void remove(ReadOnlyIndex index)
      Description copied from interface: TestColumnSource
      Remove the given index from the column source.
      Specified by:
      remove in interface TestColumnSource<T>
      Parameters:
      index - the keys to remove
    • shift

      public void shift(long startKeyInclusive, long endKeyInclusive, long shiftDelta)
      Description copied from interface: TestColumnSource
      Move data within the column source.
      Specified by:
      shift in interface TestColumnSource<T>
      Parameters:
      startKeyInclusive - the first key to shift
      endKeyInclusive - the last key to shift
      shiftDelta - how far to shift the data (either positive or negative)
    • get

      public T get(long index)
      Description copied from interface: ElementSource
      Get the value from the source. This may return boxed values for basic types.
      Specified by:
      get in interface ElementSource<T>
      Parameters:
      index - the location in index space to get the value from.
      Returns:
      the value at the index, potentially null.
    • isImmutable

      public boolean isImmutable()
      Description copied from interface: ColumnSource
      Determine if this column source is immutable, meaning that the values at a given index key never change.
      Specified by:
      isImmutable in interface ColumnSource<T>
      Specified by:
      isImmutable in interface MutableColumnSource<T>
      Returns:
      true if the values at a given index of the column source never change, false otherwise
    • getPrev

      public T getPrev(long index)
      Description copied from interface: ElementSource
      Get the previous value at the index. Previous values are used during an LTM update cycle to process changes in data. During normal operation previous values will be identical to current values.
      Specified by:
      getPrev in interface ElementSource<T>
      Parameters:
      index - the location in index space to get the value from.
      Returns:
      the previous value at the index, or null.
    • flushPrevious

      public static void flushPrevious(ObjectTestSource source)
    • startTrackingPrevValues

      public void startTrackingPrevValues()
      Description copied from interface: ColumnSource
      ColumnSource implementations that track previous values have the option to not actually start tracking previous values until this method is called. This is an option, not an obligation: some simple ColumnSource implementations (like TSingleValueSource for various T) always track previous values; other implementations (like PrevColumnSource) never do; some (like TArrayColumnSource) only start tracking once this method is called. An immutable column source can not have distinct prev values; therefore it is implemented as a no-op.
      Specified by:
      startTrackingPrevValues in interface ColumnSource<T>