Search in sources :

Example 1 with ComplexNumberCell

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

the class NodeSettingsTest method testDataCell.

/**
 * Test write/read of DataCells.
 *
 * @throws Exception Should not happen.
 */
@Test
public void testDataCell() throws Exception {
    StringCell s = new StringCell("stringi");
    m_settings.addDataCell("string", s);
    assertTrue(m_settings.containsKey("string"));
    assertTrue(m_settings.getDataCell("string").equals(s));
    DoubleCell d = new DoubleCell(45.42);
    m_settings.addDataCell("double", d);
    assertTrue(m_settings.containsKey("double"));
    assertTrue(m_settings.getDataCell("double").equals(d));
    IntCell i = new IntCell(11);
    m_settings.addDataCell("int", i);
    assertTrue(m_settings.containsKey("int"));
    assertTrue(m_settings.getDataCell("int").equals(i));
    DataCell m = DataType.getMissingCell();
    m_settings.addDataCell("missing", m);
    assertTrue(m_settings.containsKey("missing"));
    assertTrue(m_settings.getDataCell("missing").equals(m));
    ComplexNumberCell c = new ComplexNumberCell(5.4, 4.5);
    m_settings.addDataCell("complex", c);
    assertTrue(m_settings.containsKey("complex"));
    assertTrue(m_settings.getDataCell("complex").equals(c));
    FuzzyNumberCell n = new FuzzyNumberCell(1, 2, 4);
    m_settings.addDataCell("fnumber", n);
    assertTrue(m_settings.containsKey("fnumber"));
    assertTrue(m_settings.getDataCell("fnumber").equals(n));
    FuzzyIntervalCell f = new FuzzyIntervalCell(1, 2, 3, 4);
    m_settings.addDataCell("finterval", f);
    assertTrue(m_settings.containsKey("finterval"));
    assertTrue(m_settings.getDataCell("finterval").equals(f));
    DataCell unknownCell = new UnknownCell();
    m_settings.addDataCell("unknownCell", unknownCell);
    assertTrue(m_settings.containsKey("unknownCell"));
    assertTrue(m_settings.getDataCell("unknownCell").equals(unknownCell));
}
Also used : StringCell(org.knime.core.data.def.StringCell) DoubleCell(org.knime.core.data.def.DoubleCell) ComplexNumberCell(org.knime.core.data.def.ComplexNumberCell) DataCell(org.knime.core.data.DataCell) FuzzyNumberCell(org.knime.core.data.def.FuzzyNumberCell) FuzzyIntervalCell(org.knime.core.data.def.FuzzyIntervalCell) IntCell(org.knime.core.data.def.IntCell) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 DataCell (org.knime.core.data.DataCell)1 ComplexNumberCell (org.knime.core.data.def.ComplexNumberCell)1 DoubleCell (org.knime.core.data.def.DoubleCell)1 FuzzyIntervalCell (org.knime.core.data.def.FuzzyIntervalCell)1 FuzzyNumberCell (org.knime.core.data.def.FuzzyNumberCell)1 IntCell (org.knime.core.data.def.IntCell)1 StringCell (org.knime.core.data.def.StringCell)1