|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.node.preproc.rowkey.RowKeyUtil
public class RowKeyUtil
Provides methods to append a new row with the row key values or to replace the row key by the values of another column.
Field Summary | |
---|---|
protected static String |
MISSING_VALUE_REPLACEMENT
This value is used instead of a missing value as new row key if the replaceMissingVals variable is set to true . |
Constructor Summary | |
---|---|
RowKeyUtil()
|
Method Summary | |
---|---|
BufferedDataTable |
changeRowKey(BufferedDataTable inData,
ExecutionContext exec,
String selRowKeyColName,
boolean appendColumn,
DataColumnSpec newColSpec,
boolean ensureUniqueness,
boolean replaceMissingVals,
boolean removeRowKeyCol,
boolean hiliteMap)
Replaces the row key by the values of the column with the given name and appends a new column with the old key values if the newColName variable is a non empty String . |
static ColumnRearranger |
createColumnRearranger(DataTableSpec inSpec,
String newColName,
DataType type)
Creates the ColumnRearranger that appends a new column with the
values of the row id to a data table. |
static DataTableSpec |
createTableSpec(DataTableSpec spec,
String... columnNames2Drop)
|
int |
getDuplicatesCounter()
|
Map<RowKey,Set<RowKey>> |
getHiliteMapping()
The hilite translation Map or null if
the enableHilte flag in the constructor was set to false . |
int |
getMissingValueCounter()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String MISSING_VALUE_REPLACEMENT
true
.
Constructor Detail |
---|
public RowKeyUtil()
Method Detail |
---|
public static ColumnRearranger createColumnRearranger(DataTableSpec inSpec, String newColName, DataType type)
ColumnRearranger
that appends a new column with the
values of the row id to a data table.
inSpec
- the DataTableSpec
of table were the column
should be appendednewColName
- the name of the added columntype
- the DataType
of the new column
ColumnRearranger
to usepublic BufferedDataTable changeRowKey(BufferedDataTable inData, ExecutionContext exec, String selRowKeyColName, boolean appendColumn, DataColumnSpec newColSpec, boolean ensureUniqueness, boolean replaceMissingVals, boolean removeRowKeyCol, boolean hiliteMap) throws Exception
Replaces the row key by the values of the column with the given name
and appends a new column with the old key values if the
newColName
variable is a non empty String
.
Call the getDuplicatesCounter()
and
getMissingValueCounter()
methods to get information about the replaced duplicates and missing
values after this method is completed.
inData
- The BufferedDataTable
with the input dataexec
- the ExecutionContext
to check for cancel and to
provide status messagesselRowKeyColName
- the name of the column which should replace
the row key or null
if a new one should be createdappendColumn
- true
if a new column should be creatednewColSpec
- the DataColumnSpec
of the new column or
null
if no column should be created at allensureUniqueness
- if set to true
the method ensures
the uniqueness of the row key even if the values of the selected row
aren't uniquereplaceMissingVals
- if set to true
the method
replaces missing values with ?removeRowKeyCol
- removes the selected row key column if set
to true
hiliteMap
- true
if a map should be maintained that
maps the new row id to the old row id
BufferedDataTable
with the replaced row key and
the optional appended new column with the old row keys.
Exception
- if the cancel button was pressed or the input data
isn't valid.public int getMissingValueCounter()
public int getDuplicatesCounter()
public Map<RowKey,Set<RowKey>> getHiliteMapping()
Map
or null
if
the enableHilte flag in the constructor was set to false
.
The key of the Map
is the row key of the new row and
the corresponding value is the Set
with the corresponding
old row key.
Map
or null
if
the enableHilte flag in the constructor was set to false
.public static DataTableSpec createTableSpec(DataTableSpec spec, String... columnNames2Drop)
spec
- the original DataTableSpec
columnNames2Drop
- the names of the column to remove from the
original table specification
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |