Class ModifiedColumnSet

java.lang.Object
io.deephaven.engine.table.ModifiedColumnSet

public class ModifiedColumnSet extends Object
Data structure to represent a subset of columns, used for propagating modifications via TableUpdate instances.
  • Field Details

    • ALL

      public static final ModifiedColumnSet ALL
      A static 'special' ModifiedColumnSet that pretends all columns are dirty. Useful for backwards compatibility and convenience.
    • EMPTY

      public static final ModifiedColumnSet EMPTY
      A static 'special' ModifiedColumnSet that pretends no columns are dirty.
  • Constructor Details

    • ModifiedColumnSet

      public ModifiedColumnSet(Map<String,ColumnSource<?>> columns)
      Create an empty ModifiedColumnSet from the provided Column Source Map. Note: prefer to use the copy constructor on future objects that share this CSM to minimize duplicating state.
      Parameters:
      columns - The column source map this ModifiedColumnSet will use.
    • ModifiedColumnSet

      public ModifiedColumnSet(ModifiedColumnSet other)
      Create a new ModifiedColumnSet that shares all immutable state with the provided MCS. The dirty set will initially be empty.
      Parameters:
      other - The ModifiedColumnSet to borrow immutable state from.
  • Method Details

    • extractAsBitSet

      public BitSet extractAsBitSet()
    • newTransformer

      public ModifiedColumnSet.Transformer newTransformer(String[] columnNames, ModifiedColumnSet[] columnSets)
      Create a transformer that is compatible with the class of ModifiedColumnSets that share a ColumnSourceMap.
      Parameters:
      columnNames - input columns to check for dirtiness
      columnSets - output columns to mark dirty when input column is dirty
      Returns:
      a new Transformer instance
    • newIdentityTransformer

      public ModifiedColumnSet.Transformer newIdentityTransformer(Map<String,? extends ColumnSource<?>> newColumns)
      Create a transformer that uses an identity mapping from one ColumnSourceMap to another. The two CSM's must have equivalent column names and column ordering.
      Parameters:
      newColumns - the column source map for result table
      Returns:
      a simple Transformer that makes a cheap, but CSM compatible copy
    • isCompatibleWith

      public boolean isCompatibleWith(ModifiedColumnSet columnSet)
      Returns:
      whether or not this modified column set is compatible with the provided set
    • requiresTransformer

      public boolean requiresTransformer(ModifiedColumnSet columnSet)
      This method is used to determine whether or not a dependent requires a transformer to propagate dirty columns from its parent. If no transformer is required then it is acceptable to reuse any column set provided by the parent. Note this is intended to be determined during initialization and never during an update cycle. It is illegal to use the specialized ModifiedColumnSet.EMPTY / ModifiedColumnSet.ALL as their innards do not represent any table.
      Parameters:
      columnSet - the column set for the dependent table
      Returns:
      whether or not this modified column set must use a Transformer to propagate modified columns
    • copy

      public ModifiedColumnSet copy()
      Create an exact copy of this ModifiedColumnSet.
      Returns:
      a copy with identical state including dirty bits
    • clear

      public void clear()
      Reset the current dirty column state.
    • setAllDirty

      public void setAllDirty()
      Sets all columns dirty.
    • size

      public int size()
      Returns:
      the number of dirty columns
    • empty

      public boolean empty()
      Returns:
      whether or not this set is empty
    • nonempty

      public boolean nonempty()
      Returns:
      whether or not this set is non-empty
    • numColumns

      public int numColumns()
      Returns:
      the number of columns in this set
      Throws:
      UnsupportedOperationException - on ALL and EMPTY
    • dirtyColumnNames

      public String[] dirtyColumnNames()
      Returns:
      the names of the dirty columns in this set
    • setAll

      public void setAll(String... columnNames)
      Turns on all bits for these columns. Use this method to prepare pre-computed ModifiedColumnSets.
      Parameters:
      columnNames - the columns which need to be marked dirty
    • setAll

      public void setAll(ModifiedColumnSet columnSet)
      Marks all columns in the provided column set in this set as dirty.
      Parameters:
      columnSet - the set of columns to mark dirty
    • setColumnWithIndex

      public void setColumnWithIndex(int columnIndex)
      Marks specifically the column with the given index as dirty.
      Parameters:
      columnIndex - column index to mark dirty
    • setColumnsInIndexRange

      public void setColumnsInIndexRange(int columnStart, int columnEndExclusive)
      Marks specifically a range of adjacent columns. Start is inclusive, end is exclusive; like the BitSet API.
      Parameters:
      columnStart - start column index to mark dirty
      columnEndExclusive - end column index to mark dirty
    • clearAll

      public void clearAll(String... columnNames)
      Turns off all bits for these columns. Use this method to prepare pre-computed ModifiedColumnSets.
      Parameters:
      columnNames - the columns which need to be marked clean
    • clearAll

      public void clearAll(ModifiedColumnSet columnSet)
      Marks all columns in the provided column set in this set as clean.
      Parameters:
      columnSet - the set of columns to mark clean
    • containsAny

      public boolean containsAny(ModifiedColumnSet columnSet)
      Check whether or not any columns are currently marked as dirty.
      Parameters:
      columnSet - the columns to check
      Returns:
      true iff any column is dirty
    • containsAll

      public boolean containsAll(ModifiedColumnSet columnSet)
      Check whether or not all columns are currently marked as dirty.
      Parameters:
      columnSet - the columns to check
      Returns:
      true iff all columns match dirtiness
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • toDebugString

      public String toDebugString()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(int maxColumns)