Package org.openrefine.operations.column
Class ColumnSplitOperation
- java.lang.Object
-
- org.openrefine.operations.EngineDependentOperation
-
- org.openrefine.operations.RowMapOperation
-
- org.openrefine.operations.column.ColumnSplitOperation
-
- All Implemented Interfaces:
Operation
public class ColumnSplitOperation extends RowMapOperation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ColumnSplitOperation.Mode
-
Nested classes/interfaces inherited from class org.openrefine.operations.RowMapOperation
RowMapOperation.GridMap
-
-
Field Summary
Fields Modifier and Type Field Description protected String
_columnName
protected int[]
_fieldLengths
protected boolean
_guessCellType
protected Integer
_maxColumns
protected ColumnSplitOperation.Mode
_mode
protected Boolean
_regex
protected boolean
_removeOriginalColumn
protected String
_separator
protected CellValueSplitter
_splitter
-
Fields inherited from class org.openrefine.operations.EngineDependentOperation
_engineConfig
-
-
Constructor Summary
Constructors Constructor Description ColumnSplitOperation(EngineConfig engineConfig, String columnName, boolean guessCellType, boolean removeOriginalColumn, int[] fieldLengths)
ColumnSplitOperation(EngineConfig engineConfig, String columnName, boolean guessCellType, boolean removeOriginalColumn, String separator, boolean regex, int maxColumns)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static RowAggregator<Integer>
buildAggregator(CellValueSplitter splitter, int columnIndex)
Aggregator to compute the maximum number of values generated by a splitting configurationstatic ColumnSplitOperation
deserialize(EngineConfig engineConfig, String columnName, boolean guessCellType, boolean removeOriginalColumn, ColumnSplitOperation.Mode mode, String separator, Boolean regex, Integer maxColumns, int[] fieldLengths)
String
getColumnName()
String
getDescription()
A short human-readable description of what this operation does.protected Engine
getEngine(Grid grid, long projectId)
int[]
getFieldLengths()
RowMapOperation.GridMap
getGridMap(Grid state, ChangeContext context)
Returns the function that is applied to each row and row index, the new column model applied to the grid, and the new overlay models.boolean
getGuessCellType()
Integer
getMaxColumns()
ColumnSplitOperation.Mode
getMode()
Boolean
getRegex()
boolean
getRemoveOriginalColumn()
String
getSeparator()
protected CellValueSplitter
getSplitter()
protected static RowInRecordMapper
mapper(CellValueSplitter splitter, int columnIdx, int nbColumns, boolean removeOrigColumn, boolean guessCellType, int keyColumnIndex)
protected static RowInRecordMapper
negativeMapper(int columnIdx, int nbColumns, boolean removeOrigColumn, int keyColumnIdx)
-
Methods inherited from class org.openrefine.operations.RowMapOperation
apply, getNegativeRowMapper, getNewColumnModel, getNewOverlayModels, getPositiveRowMapper, postTransform
-
Methods inherited from class org.openrefine.operations.EngineDependentOperation
getEngineConfig
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openrefine.operations.Operation
getOperationId, isReproducible
-
-
-
-
Field Detail
-
_columnName
protected final String _columnName
-
_guessCellType
protected final boolean _guessCellType
-
_removeOriginalColumn
protected final boolean _removeOriginalColumn
-
_mode
protected final ColumnSplitOperation.Mode _mode
-
_separator
protected final String _separator
-
_regex
protected final Boolean _regex
-
_maxColumns
protected final Integer _maxColumns
-
_fieldLengths
protected final int[] _fieldLengths
-
_splitter
protected CellValueSplitter _splitter
-
-
Constructor Detail
-
ColumnSplitOperation
public ColumnSplitOperation(EngineConfig engineConfig, String columnName, boolean guessCellType, boolean removeOriginalColumn, String separator, boolean regex, int maxColumns)
-
ColumnSplitOperation
public ColumnSplitOperation(EngineConfig engineConfig, String columnName, boolean guessCellType, boolean removeOriginalColumn, int[] fieldLengths)
-
-
Method Detail
-
deserialize
public static ColumnSplitOperation deserialize(EngineConfig engineConfig, String columnName, boolean guessCellType, boolean removeOriginalColumn, ColumnSplitOperation.Mode mode, String separator, Boolean regex, Integer maxColumns, int[] fieldLengths)
-
getColumnName
public String getColumnName()
-
getGuessCellType
public boolean getGuessCellType()
-
getRemoveOriginalColumn
public boolean getRemoveOriginalColumn()
-
getMode
public ColumnSplitOperation.Mode getMode()
-
getSeparator
public String getSeparator()
-
getRegex
public Boolean getRegex()
-
getMaxColumns
public Integer getMaxColumns()
-
getFieldLengths
public int[] getFieldLengths()
-
getDescription
public String getDescription()
Description copied from interface:Operation
A short human-readable description of what this operation does.
-
getSplitter
protected CellValueSplitter getSplitter()
-
getGridMap
public RowMapOperation.GridMap getGridMap(Grid state, ChangeContext context) throws OperationException
Description copied from class:RowMapOperation
Returns the function that is applied to each row and row index, the new column model applied to the grid, and the new overlay models. Computing these in one go can be useful in certain situations, for instance when the number of columns added to the column model depends on the data. If a subclass needs to return only one non-default value out of mapper, column model and overlay models it can instead override the corresponding method.- Overrides:
getGridMap
in classRowMapOperation
- Parameters:
state
- the initial column model- Throws:
OperationException
- if the change does not apply to the given grid
-
getEngine
protected Engine getEngine(Grid grid, long projectId)
- Overrides:
getEngine
in classEngineDependentOperation
-
negativeMapper
protected static RowInRecordMapper negativeMapper(int columnIdx, int nbColumns, boolean removeOrigColumn, int keyColumnIdx)
-
mapper
protected static RowInRecordMapper mapper(CellValueSplitter splitter, int columnIdx, int nbColumns, boolean removeOrigColumn, boolean guessCellType, int keyColumnIndex)
-
buildAggregator
protected static RowAggregator<Integer> buildAggregator(CellValueSplitter splitter, int columnIndex)
Aggregator to compute the maximum number of values generated by a splitting configuration
-
-