Search in sources :

Example 21 with DefaultRow

use of org.knime.core.data.def.DefaultRow in project knime-core by knime.

the class TwoSampleTTestNodeModel method getLeveneStatistices.

/**
 * Get the table with the Levene-Test statistics
 * @param leveneResult the Levene-Test results
 * @param exec the execution context
 * @return the table with the Levene-Test statistics
 */
private BufferedDataTable getLeveneStatistices(final LeveneTestStatistics[] leveneResult, final ExecutionContext exec) {
    BufferedDataContainer cont = exec.createDataContainer(LeveneTestStatistics.getTableSpec());
    int r = 0;
    for (int i = 0; i < leveneResult.length; i++) {
        for (List<DataCell> cells : leveneResult[i].getTTestCells()) {
            cont.addRowToTable(new DefaultRow(RowKey.createRowKey(r), cells));
            r++;
        }
    }
    cont.close();
    return cont.getTable();
}
Also used : BufferedDataContainer(org.knime.core.node.BufferedDataContainer) DataCell(org.knime.core.data.DataCell) DefaultRow(org.knime.core.data.def.DefaultRow)

Example 22 with DefaultRow

use of org.knime.core.data.def.DefaultRow in project knime-core by knime.

the class TwoSampleTTestNodeModel method getTestStatisticsTable.

/**
 * Get table with test statistics
 * @param result test statistic
 * @param exec the execution context
 * @return a combined table of the test statistic
 */
private BufferedDataTable getTestStatisticsTable(final TwoSampleTTestStatistics[] result, final ExecutionContext exec) {
    BufferedDataContainer cont = exec.createDataContainer(TwoSampleTTestStatistics.getTableSpec());
    int r = 0;
    for (int i = 0; i < result.length; i++) {
        for (List<DataCell> cells : result[i].getTTestCells()) {
            cont.addRowToTable(new DefaultRow(RowKey.createRowKey(r), cells));
            r++;
        }
    }
    cont.close();
    return cont.getTable();
}
Also used : BufferedDataContainer(org.knime.core.node.BufferedDataContainer) DataCell(org.knime.core.data.DataCell) DefaultRow(org.knime.core.data.def.DefaultRow)

Example 23 with DefaultRow

use of org.knime.core.data.def.DefaultRow in project knime-core by knime.

the class DateGeneratorNodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception {
    // prepare the calendars
    Calendar from = m_from.getCalendar();
    // new since 2.8. the start time is the current time.
    if (m_useExecution.getBooleanValue()) {
        from = DateAndTimeCell.getUTCCalendar();
        from.setTimeInMillis(System.currentTimeMillis() + TimeZone.getDefault().getOffset(System.currentTimeMillis()));
    }
    Calendar to = m_to.getCalendar();
    // if the use execution time is set, we ignore the settings for the from date
    boolean useDate = (m_from.useDate() && !m_useExecution.getBooleanValue()) || m_to.useDate();
    boolean useTime = (m_from.useTime() && !m_useExecution.getBooleanValue()) || m_to.useTime();
    boolean useMillis = (m_from.useMilliseconds() && !m_useExecution.getBooleanValue()) || m_to.useMilliseconds();
    if (useDate && !useTime) {
        DateAndTimeCell.resetTimeFields(from);
        DateAndTimeCell.resetTimeFields(to);
    } else if (useTime && !useDate) {
        DateAndTimeCell.resetDateFields(from);
        DateAndTimeCell.resetDateFields(to);
    }
    if (!useMillis) {
        from.clear(Calendar.MILLISECOND);
        to.clear(Calendar.MILLISECOND);
    }
    BufferedDataContainer container = exec.createDataContainer(createOutSpec());
    int nrRows = m_noOfRows.getIntValue();
    double offset = calculateOffset(from, to, nrRows);
    double currentTime = from.getTimeInMillis();
    for (int i = 0; i < nrRows; i++) {
        // zero based row key as FileReader
        RowKey key = new RowKey("Row" + i);
        DateAndTimeCell cell = new DateAndTimeCell((long) Math.ceil(currentTime), useDate, useTime, useMillis);
        container.addRowToTable(new DefaultRow(key, cell));
        currentTime += offset;
        exec.setProgress((i + 1) / (double) nrRows, "Generating row #" + (i + 1));
        exec.checkCanceled();
    }
    container.close();
    return new BufferedDataTable[] { exec.createBufferedDataTable(container.getTable(), exec) };
}
Also used : BufferedDataContainer(org.knime.core.node.BufferedDataContainer) RowKey(org.knime.core.data.RowKey) Calendar(java.util.Calendar) SettingsModelCalendar(org.knime.timeseries.util.SettingsModelCalendar) BufferedDataTable(org.knime.core.node.BufferedDataTable) DateAndTimeCell(org.knime.core.data.date.DateAndTimeCell) DefaultRow(org.knime.core.data.def.DefaultRow)

Example 24 with DefaultRow

use of org.knime.core.data.def.DefaultRow in project knime-core by knime.

the class JoinedTableRowIterator method getLeftMissing.

/* Called when there is no corresponding left row to the right one. */
private DataRow getLeftMissing(final RowKey key) {
    DataTableSpec spec = m_table.getLeftTable().getDataTableSpec();
    if (m_leftMissingCells == null) {
        LOGGER.debug("Creating missing values for top table on key \"" + key + "\"");
        if (!m_table.isPrintedErrorOnMissing()) {
            printMissingError(true);
            m_table.setPrintedErrorOnMissing(true);
        }
        m_leftMissingCells = JoinedTable.createMissingCells(spec);
    }
    return new DefaultRow(key, m_leftMissingCells);
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) DefaultRow(org.knime.core.data.def.DefaultRow)

Example 25 with DefaultRow

use of org.knime.core.data.def.DefaultRow in project knime-core by knime.

the class JoinedTableRowIterator method getRightMissing.

/* Called when there is no corresponding right row to the left one. */
private DataRow getRightMissing(final RowKey key) {
    DataTableSpec spec = m_table.getRightTable().getDataTableSpec();
    if (m_rightMissingCells == null) {
        LOGGER.debug("Creating missing values for bottom table on key \"" + key + "\"");
        if (!m_table.isPrintedErrorOnMissing()) {
            printMissingError(false);
            m_table.setPrintedErrorOnMissing(true);
        }
        m_rightMissingCells = JoinedTable.createMissingCells(spec);
    }
    return new DefaultRow(key, m_rightMissingCells);
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) DefaultRow(org.knime.core.data.def.DefaultRow)

Aggregations

DefaultRow (org.knime.core.data.def.DefaultRow)207 DataCell (org.knime.core.data.DataCell)165 BufferedDataContainer (org.knime.core.node.BufferedDataContainer)94 DataTableSpec (org.knime.core.data.DataTableSpec)92 DataRow (org.knime.core.data.DataRow)88 RowKey (org.knime.core.data.RowKey)80 DoubleCell (org.knime.core.data.def.DoubleCell)66 StringCell (org.knime.core.data.def.StringCell)65 BufferedDataTable (org.knime.core.node.BufferedDataTable)56 IntCell (org.knime.core.data.def.IntCell)46 ArrayList (java.util.ArrayList)26 DataType (org.knime.core.data.DataType)26 DataColumnSpec (org.knime.core.data.DataColumnSpec)22 DataContainer (org.knime.core.data.container.DataContainer)21 HashSet (java.util.HashSet)18 LinkedHashMap (java.util.LinkedHashMap)17 DataColumnSpecCreator (org.knime.core.data.DataColumnSpecCreator)16 LinkedHashSet (java.util.LinkedHashSet)14 DoubleValue (org.knime.core.data.DoubleValue)14 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)14