Package org.openrefine.operations.cell
Class MultiValuedCellSplitOperation
- java.lang.Object
-
- org.openrefine.operations.cell.MultiValuedCellSplitOperation
-
- All Implemented Interfaces:
Operation
public class MultiValuedCellSplitOperation extends Object implements Operation
Splits the value of a cell and spreads the splits on the following rows, while respecting the record structure. The keyColumnName can be used to specify which column should be treated as record key (although this parameter has never been exposed in the UI as of 2020-05).
-
-
Field Summary
Fields Modifier and Type Field Description protected String
_columnName
protected int[]
_fieldLengths
protected String
_keyColumnName
protected ColumnSplitOperation.Mode
_mode
protected Boolean
_regex
protected String
_separator
-
Constructor Summary
Constructors Constructor Description MultiValuedCellSplitOperation(String columnName, String keyColumnName, int[] fieldLengths)
MultiValuedCellSplitOperation(String columnName, String keyColumnName, String separator, boolean regex)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ChangeResult
apply(Grid projectState, ChangeContext context)
Derives the new grid state from the current grid state.static MultiValuedCellSplitOperation
deserialize(String columnName, String keyColumnName, ColumnSplitOperation.Mode mode, String separator, boolean regex, int[] fieldLengths)
String
getColumnName()
String
getDescription()
A short human-readable description of what this operation does.int[]
getFieldLengths()
String
getKeyColumnName()
ColumnSplitOperation.Mode
getMode()
Boolean
getRegex()
String
getSeparator()
protected static RecordMapper
recordMapper(int columnIdx, CellValueSplitter splitter)
-
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
-
_keyColumnName
protected final String _keyColumnName
-
_mode
protected final ColumnSplitOperation.Mode _mode
-
_separator
protected final String _separator
-
_regex
protected final Boolean _regex
-
_fieldLengths
protected final int[] _fieldLengths
-
-
Method Detail
-
deserialize
public static MultiValuedCellSplitOperation deserialize(String columnName, String keyColumnName, ColumnSplitOperation.Mode mode, String separator, boolean regex, int[] fieldLengths)
-
apply
public ChangeResult apply(Grid projectState, ChangeContext context) throws OperationException
Description copied from interface:Operation
Derives the new grid state from the current grid state. Executing this method should be quick (even on large datasets) since it is expected to just derive the new grid from the existing one without actually executing any expensive computation. Long-running computations should rather go in the derivation of aChangeData
which will be fetched asynchronously.- Specified by:
apply
in interfaceOperation
- Parameters:
projectState
- the state of the grid before the change- Returns:
- an object which bundles up various pieces of information produced by the operation: primarily, the new grid after applying the operation. This object can be subclassed to expose more information, which should be serializable with Jackson so that it reaches the frontend.
- Throws:
OperationException
- when the change cannot be applied to the given grid
-
getColumnName
public String getColumnName()
-
getKeyColumnName
public String getKeyColumnName()
-
getMode
public ColumnSplitOperation.Mode getMode()
-
getSeparator
public String getSeparator()
-
getRegex
public Boolean getRegex()
-
getFieldLengths
public int[] getFieldLengths()
-
getDescription
public String getDescription()
Description copied from interface:Operation
A short human-readable description of what this operation does.- Specified by:
getDescription
in interfaceOperation
-
recordMapper
protected static RecordMapper recordMapper(int columnIdx, CellValueSplitter splitter)
-
-