|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.core.data.container.DataContainer
org.knime.core.node.BufferedDataContainer
public class BufferedDataContainer
DataContainer
to be used during a
NodeModel
's execution.
A BufferedDataContainer
is special implementation of a
DataContainer
whose getTable()
returns a
BufferedDataTable
, i.e. the return value of each
NodeModel's execute
method.
Use a BufferedDataContainer
when new data is acquired during
the execution or if it does not pay off to reference a node's input data
(it does pay off when you only append a column to the input data, for
instance). Please see the ExecutionContext
for more details on how
to create BufferedDataTable
's.
To get a quick start how to use a BufferedDataTable
, see
the following code:
protected final BufferedDataTable[] execute( final BufferedDataTable[] data, final ExecutionContext exec) throws Exception { // the DataTableSpec of the final table DataTableSpec spec = new DataTableSpec( new DataColumnSpecCreator("A", StringCell.TYPE).createSpec(), new DataColumnSpecCreator("B", DoubleCell.TYPE).createSpec()); // init the container BufferedDataContainer container = exec.createDataContainer(spec); // add arbitrary number of rows to the container DataRow firstRow = new DefaultRow(new RowKey("first"), new DataCell[]{ new StringCell("A1"), new DoubleCell(1.0) }); container.addRowToTable(firstRow); DataRow secondRow = new DefaultRow(new RowKey("second"), new DataCell[]{ new StringCell("B1"), new DoubleCell(2.0) }); container.addRowToTable(secondRow); // finally close the container and get the result table. container.close(); BufferedDataTable result = container.getTable(); ...
For a more detailed explanation refer to the description of the
DataContainer
class.
DataContainer
,
ExecutionContext
Field Summary |
---|
Fields inherited from class org.knime.core.data.container.DataContainer |
---|
DEF_GZIP_COMPRESSION, DEF_MAX_CELLS_IN_MEMORY, MAX_CELLS_IN_MEMORY, PROPERTY_CELLS_IN_MEMORY |
Constructor Summary | |
---|---|
BufferedDataContainer(DataTableSpec spec,
boolean initDomain,
Node node,
SingleNodeContainer.MemoryPolicy policy,
boolean forceCopyOfBlobs,
int maxCellsInMemory,
Map<Integer,ContainerTable> globalTableRepository,
Map<Integer,ContainerTable> localTableRepository)
Creates new container. |
Method Summary | |
---|---|
protected int |
createInternalBufferID()
Get an internal id for the buffer being used. |
protected Map<Integer,ContainerTable> |
getGlobalTableRepository()
Returns the table repository from this workflow. |
protected Map<Integer,ContainerTable> |
getLocalTableRepository()
Returns the local repository of tables. |
BufferedDataTable |
getTable()
Returns the content of this container in a BufferedDataTable. |
protected static ContainerTable |
readFromZipDelayed(ReferencedFile zipFileRef,
DataTableSpec spec,
int bufID,
Map<Integer,ContainerTable> bufferRep)
Just delegates to DataContainer.readFromZipDelayed(
ReferencedFile, DataTableSpec, int, Map)
This method is available in this class to enable other classes in this
package to use it. |
Methods inherited from class org.knime.core.data.container.DataContainer |
---|
addRowKeyForDuplicateCheck, addRowToTable, cache, cache, close, createTempFile, getBufferedTable, getTableSpec, isClosed, isContainerTable, isForceCopyOfBlobs, isOpen, readFromStream, readFromZip, setBufferCreator, setForceCopyOfBlobs, setMaxPossibleValues, size, writeToStream, writeToZip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
BufferedDataContainer(DataTableSpec spec, boolean initDomain, Node node, SingleNodeContainer.MemoryPolicy policy, boolean forceCopyOfBlobs, int maxCellsInMemory, Map<Integer,ContainerTable> globalTableRepository, Map<Integer,ContainerTable> localTableRepository)
spec
- The table spec.initDomain
- Whether or not the spec's domain shall be used for
initialization.node
- The owner of the outcome table.forceCopyOfBlobs
- The property whether to copy any blob cellmaxCellsInMemory
- Number of cells to be kept in memory, if negative
use user settings (according to node)
being added, see DataContainer.setForceCopyOfBlobs(boolean)
.globalTableRepository
- The global (WFM) table repository for blob (de)serialization.localTableRepository
- The local (Node) table repository for blob (de)serialization.DataContainer.DataContainer(DataTableSpec, boolean)
Method Detail |
---|
protected int createInternalBufferID()
An ID of -1 denotes the fact, that the buffer is not intended to be used for sophisticated blob serialization. All blob cells that are added to it will be newly serialized as if they were created for the first time.
This implementation returns -1.
createInternalBufferID
in class DataContainer
protected Map<Integer,ContainerTable> getGlobalTableRepository()
If used along with the ExecutionContext
,
this method returns the global table repository (global = in the context
of the current workflow).
This implementation does not support sophisticated blob serialization.
It will return a new HashMap<Integer, Buffer>()
.
getGlobalTableRepository
in class DataContainer
DataContainer.getLocalTableRepository()
protected Map<Integer,ContainerTable> getLocalTableRepository()
BufferedDataContainer
getLocalTableRepository
in class DataContainer
public BufferedDataTable getTable()
getTable
in class DataContainer
protected static ContainerTable readFromZipDelayed(ReferencedFile zipFileRef, DataTableSpec spec, int bufID, Map<Integer,ContainerTable> bufferRep)
DataContainer.readFromZipDelayed(
ReferencedFile, DataTableSpec, int, Map)
This method is available in this class to enable other classes in this
package to use it.
zipFileRef
- Delegated.spec
- Delegated.bufID
- Delegated.bufferRep
- Delegated.
DataContainer.readFromZipDelayed(
ReferencedFile, DataTableSpec, int, Map)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |