Package com.illumon.iris.db.v2
Class ModifiedColumnSet
java.lang.Object
com.illumon.iris.db.v2.ModifiedColumnSet
Data structure to represent a subset of columns, used for propagating modifications via
ShiftAwareListener.Update instances.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA helper utility that simplifies propagating modified columns to a child table. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ModifiedColumnSetA static 'special' ModifiedColumnSet that pretends all columns are dirty.static final ModifiedColumnSetA static 'special' ModifiedColumnSet that pretends no columns are dirty. -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new ModifiedColumnSet that shares all immutable state with the provided MCS.ModifiedColumnSet(Map<String, ColumnSource> columns) Create an empty ModifiedColumnSet from the provided Column Source Map. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Reset the current dirty column state.voidclearAll(ModifiedColumnSet columnSet) Marks all columns in the provided column set in this set as clean.voidTurns off all bits for these columns.booleancontainsAll(ModifiedColumnSet columnSet) Check whether or not all columns are currently marked as dirty.booleancontainsAny(ModifiedColumnSet columnSet) Check whether or not any columns are currently marked as dirty.copy()Create an exact copy of this ModifiedColumnSet.booleanempty()booleanbooleanisCompatibleWith(ModifiedColumnSet columnSet) newIdentityTransformer(Map<String, ColumnSource> newColumns) Create a transformer that uses an identity mapping from one ColumnSourceMap to another.newTransformer(String[] columnNames, ModifiedColumnSet[] columnSets) Create a transformer that is compatible with the class of ModifiedColumnSets that share a ColumnSourceMap.booleannonempty()intbooleanrequiresTransformer(ModifiedColumnSet columnSet) This method is used to determine whether or not a dependent requires a transformer to propagate dirty columns from its parent.voidsetAll(ModifiedColumnSet columnSet) Marks all columns in the provided column set in this set as dirty.voidTurns on all bits for these columns.voidSets all columns dirty.voidsetColumnWithIndex(int columnIndex) Marks specifically the column with the given index as dirty.intsize()toString()toString(int maxColumns)
-
Field Details
-
ALL
A static 'special' ModifiedColumnSet that pretends all columns are dirty. Useful for backwards compatibility and convenience. -
EMPTY
A static 'special' ModifiedColumnSet that pretends no columns are dirty.
-
-
Constructor Details
-
ModifiedColumnSet
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
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
-
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 dirtinesscolumnSets- output columns to mark dirty when input column is dirty- Returns:
- a new Transformer instance
-
newIdentityTransformer
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
- Returns:
- whether or not this modified column set is compatible with the provided set
-
requiresTransformer
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
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- onALLandEMPTY
-
setAll
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
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
-
clearAll
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
Marks all columns in the provided column set in this set as clean.- Parameters:
columnSet- the set of columns to mark clean
-
containsAny
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
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
-
toDebugString
-
toString
-
toString
-