Class IntTestSource

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

The IntTestSource is a ColumnSource used only for testing; not in live code.

It uses a fastutil open addressed hash map from long Index keys to int 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.Long2IntOpenHashMap data
    • prevData

      protected io.deephaven.shadow.fastutil.it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap 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<Integer>
      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<Integer>
      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<Integer>
      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 Integer 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 ColumnSourceGetDefaults.ForInt
      Specified by:
      get in interface ElementSource<Integer>
      Parameters:
      index - the location in index space to get the value from.
      Returns:
      the value at the index, potentially null.
    • getInt

      public int getInt(long index)
      Description copied from interface: ElementSource
      Get the value at the index as an int.
      Specified by:
      getInt in interface ElementSource<Integer>
      Parameters:
      index - the location in index space to get the value from.
      Returns:
      the int at the index, null values are represented by QueryConstants.NULL_INT
    • 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<Integer>
      Specified by:
      isImmutable in interface MutableColumnSource<Integer>
      Returns:
      true if the values at a given index of the column source never change, false otherwise
    • getPrev

      public Integer 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<Integer>
      Specified by:
      getPrev in interface MutableColumnSourceGetDefaults.ForInt
      Parameters:
      index - the location in index space to get the value from.
      Returns:
      the previous value at the index, or null.
    • getPrevInt

      public int getPrevInt(long index)
      Description copied from interface: ElementSource
      Get the previous value at the index as an int. See ElementSource.getPrev(long) for more details.
      Specified by:
      getPrevInt in interface ElementSource<Integer>
      Parameters:
      index - the location in index space to get the previous value from.
      Returns:
      the previous int at the index, null values are represented by QueryConstants.NULL_INT
    • flushPrevious

      public static void flushPrevious(IntTestSource 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<Integer>