Search in sources :

Example 31 with ContainerTable

use of org.knime.core.data.container.ContainerTable 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 ContainerTable

use of org.knime.core.data.container.ContainerTable in project knime-core by knime.

the class NativeNodeContainer method putOutputTablesIntoGlobalRepository.

/**
 * Enumerates the output tables and puts them into the workflow global repository of tables. All other (temporary)
 * tables that were created in the given execution context, will be put in a set of temporary tables in the node.
 *
 * <p>
 * This method is only to be called by the framework and by other external executor after execution.
 *
 * @param c The execution context containing the (so far) local tables.
 * @noreference This method is not intended to be referenced by clients.
 */
public final void putOutputTablesIntoGlobalRepository(final ExecutionContext c) {
    HashMap<Integer, ContainerTable> globalRep = getParent().getGlobalTableRepository();
    m_node.putOutputTablesIntoGlobalRepository(globalRep);
    HashMap<Integer, ContainerTable> localRep = Node.getLocalTableRepositoryFromContext(c);
    Set<ContainerTable> localTables = new HashSet<ContainerTable>();
    for (Map.Entry<Integer, ContainerTable> t : localRep.entrySet()) {
        ContainerTable fromGlob = globalRep.get(t.getKey());
        if (fromGlob == null) {
            // not used globally
            localTables.add(t.getValue());
        } else {
            assert fromGlob == t.getValue();
        }
    }
    m_node.addToTemporaryTables(localTables);
}
Also used : Map(java.util.Map) HashMap(java.util.HashMap) ContainerTable(org.knime.core.data.container.ContainerTable) HashSet(java.util.HashSet)

Aggregations

ContainerTable (org.knime.core.data.container.ContainerTable)32 File (java.io.File)18 DefaultDataArray (org.knime.base.node.util.DefaultDataArray)13 FileInputStream (java.io.FileInputStream)12 IOException (java.io.IOException)11 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)9 BufferedInputStream (java.io.BufferedInputStream)7 NodeSettingsRO (org.knime.core.node.NodeSettingsRO)7 DataTable (org.knime.core.data.DataTable)5 DataTableSpec (org.knime.core.data.DataTableSpec)5 Map (java.util.Map)4 GZIPInputStream (java.util.zip.GZIPInputStream)4 ReferencedFile (org.knime.core.internal.ReferencedFile)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 LinkedHashMap (java.util.LinkedHashMap)3 Test (org.junit.Test)3 RowKey (org.knime.core.data.RowKey)3 ExecutionMonitor (org.knime.core.node.ExecutionMonitor)3