use of org.knime.base.data.append.column.AppendedColumnRow in project knime-core by knime.
the class RecursiveLoopEndNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception {
validateLoopStart();
// in port 0: collects the data provided at the output port
// in port 1: is fed back to loop start node
BufferedDataContainer loopData = exec.createDataContainer(inData[resultingIn].getDataTableSpec());
for (DataRow row : inData[resultingIn]) {
exec.checkCanceled();
exec.setMessage("Copy input table 1");
loopData.addRowToTable(createNewRow(row, row.getKey()));
}
loopData.close();
m_inData = loopData.getTable();
boolean endLoop = checkDataTableSize(m_minNumberOfRows.getIntValue()) || (m_iterationnr + 1) >= m_maxIterations.getIntValue() || m_endLoop.getStringValue().equalsIgnoreCase("true");
if (m_onlyLastResult.getBooleanValue()) {
if (endLoop) {
return new BufferedDataTable[] { inData[collectingIn] };
}
} else {
if (m_outcontainer == null) {
DataTableSpec dts = createSpec(inData[collectingIn].getDataTableSpec());
m_outcontainer = exec.createDataContainer(dts);
}
if (m_addIterationNr.getBooleanValue()) {
IntCell currIterCell = new IntCell(m_iterationnr);
for (DataRow row : inData[collectingIn]) {
exec.checkCanceled();
exec.setMessage("Collect data for output");
RowKey newKey = new RowKey(row.getKey() + "#" + m_iterationnr);
AppendedColumnRow newRow = new AppendedColumnRow(createNewRow(row, newKey), currIterCell);
m_outcontainer.addRowToTable(newRow);
}
} else {
for (DataRow row : inData[collectingIn]) {
exec.checkCanceled();
exec.setMessage("Collect data for output");
RowKey newKey = new RowKey(row.getKey() + "#" + m_iterationnr);
m_outcontainer.addRowToTable(createNewRow(row, newKey));
}
}
// or the max number of iterations is reached
if (endLoop) {
m_outcontainer.close();
return new BufferedDataTable[] { m_outcontainer.getTable() };
}
}
m_iterationnr++;
// go on with loop
super.continueLoop();
return new BufferedDataTable[1];
}
use of org.knime.base.data.append.column.AppendedColumnRow in project knime-core by knime.
the class BasisFunctionPredictorRowIterator method next.
/**
* {@inheritDoc}
*/
@Override
public DataRow next() {
DataRow row = m_rowIt.next();
DataCell classInfo = m_map.get(row.getKey());
return new AppendedColumnRow(row, classInfo);
}
Aggregations