Search in sources :

Example 31 with DefaultDataArray

use of org.knime.base.node.util.DefaultDataArray in project knime-core by knime.

the class ScatterPlotNodeModel method loadInternals.

/**
 * {@inheritDoc}
 */
@Override
protected void loadInternals(final File internDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
    File data = new File(internDir, FILE_NAME);
    ContainerTable table = DataContainer.readFromZip(data);
    int rowCount = table.getRowCount();
    m_rows = new DefaultDataArray(table, 1, rowCount, exec);
}
Also used : DefaultDataArray(org.knime.base.node.util.DefaultDataArray) File(java.io.File) ContainerTable(org.knime.core.data.container.ContainerTable)

Example 32 with DefaultDataArray

use of org.knime.base.node.util.DefaultDataArray in project knime-core by knime.

the class ScatterPlotNodeModel method execute.

/**
 * The execute function refreshs the contents of the RowInfo container. The
 * model will create new RowInfos (as many as set in the dialog)
 *
 * @see org.knime.core.node.NodeModel
 *      #execute(BufferedDataTable[],ExecutionContext)
 */
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception {
    assert inData != null;
    assert inData.length == 1;
    if ((m_firstRow < 1) || (m_numRows < 1)) {
        throw new IllegalStateException("Setup the model's settings " + "before you execute it.");
    }
    BufferedDataTable table = inData[0];
    int nrOfRows = Math.min(table.getRowCount(), m_numRows);
    m_rows = new DefaultDataArray(table, m_firstRow, nrOfRows, exec);
    return new BufferedDataTable[] {};
}
Also used : DefaultDataArray(org.knime.base.node.util.DefaultDataArray) BufferedDataTable(org.knime.core.node.BufferedDataTable)

Aggregations

DefaultDataArray (org.knime.base.node.util.DefaultDataArray)32 BufferedDataTable (org.knime.core.node.BufferedDataTable)16 File (java.io.File)14 ContainerTable (org.knime.core.data.container.ContainerTable)13 DataTableSpec (org.knime.core.data.DataTableSpec)12 FileInputStream (java.io.FileInputStream)10 IOException (java.io.IOException)9 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)9 DataRow (org.knime.core.data.DataRow)8 DataColumnSpec (org.knime.core.data.DataColumnSpec)7 HashSet (java.util.HashSet)6 DataArray (org.knime.base.node.util.DataArray)6 DataTable (org.knime.core.data.DataTable)6 Map (java.util.Map)5 RowKey (org.knime.core.data.RowKey)5 NodeSettingsRO (org.knime.core.node.NodeSettingsRO)5 SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)5 PortObject (org.knime.core.node.port.PortObject)5 BufferedInputStream (java.io.BufferedInputStream)4 ArrayList (java.util.ArrayList)4