Java Examples for org.knime.core.node.port.inactive.InactiveBranchPortObject
The following java examples will help you to understand the usage of org.knime.core.node.port.inactive.InactiveBranchPortObject. These source code samples are taken from different open source projects.
Example 1
| Project: knip-master File: DontSaveEndNodeModel.java View source code |
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
if (!(this.getLoopStartNode() instanceof DontSaveStartNodeModel)) {
throw new IllegalStateException("Don't Save End node is not connected" + " to matching/corresponding Don't Save Start node.");
}
if ((inObjects[0] instanceof InactiveBranchPortObject)) {
// second iteration returns the data && help the garbage collector a bit
final PortObject[] tmp = m_resultPortObject;
m_resultPortObject = null;
return tmp;
} else {
// first iteration
BufferedDataTable table = (BufferedDataTable) inObjects[0];
BufferedDataContainer container = exec.createDataContainer(table.getDataTableSpec());
// copy the data (here the data really need to be copied, as we will kill the data from the previous node)
for (DataRow row : table) {
container.addRowToTable(new DefaultRow(row.getKey(), row));
}
container.close();
// memorize data for later usage
m_resultPortObject = new BufferedDataTable[] { container.getTable() };
continueLoop();
return new BufferedDataTable[1];
}
}