Search in sources :

Example 1 with DataColumnProperties

use of org.knime.core.data.DataColumnProperties in project knime-core by knime.

the class TimeMissingValueHandlingNodeDialogPane method createAsIncompatibleMarkedColumnSpec.

private static DataColumnSpec createAsIncompatibleMarkedColumnSpec(final DataColumnSpec originalSpec) {
    DataColumnSpecCreator creator = new DataColumnSpecCreator(originalSpec);
    final DataColumnProperties origProps = originalSpec.getProperties();
    final Map<String, String> map = createIncompatiblePropertiesMap();
    final DataColumnProperties props;
    if (origProps != null) {
        props = origProps.cloneAndOverwrite(map);
    } else {
        props = new DataColumnProperties(map);
    }
    creator.setProperties(props);
    final DataColumnSpec invalidSpec = creator.createSpec();
    return invalidSpec;
}
Also used : DataColumnSpecCreator(org.knime.core.data.DataColumnSpecCreator) DataColumnSpec(org.knime.core.data.DataColumnSpec) DataColumnProperties(org.knime.core.data.DataColumnProperties)

Example 2 with DataColumnProperties

use of org.knime.core.data.DataColumnProperties in project knime-core by knime.

the class HistogramColumn method createHistogramColumnSpec.

/**
 * @return The {@link DataColumnSpec} for the column to be created.
 */
public DataColumnSpec createHistogramColumnSpec() {
    final DataColumnSpecCreator columnSpecCreator = new DataColumnSpecCreator(m_colName, m_format.getDataType());
    if (m_format == ImageFormats.SVG) {
        final Map<String, String> widthAndHeight = new LinkedHashMap<String, String>();
        widthAndHeight.put(SvgValueRenderer.OPTION_KEEP_ASPECT_RATIO, Boolean.toString(true));
        widthAndHeight.put(SvgValueRenderer.OPTION_PREFERRED_WIDTH, Integer.toString(m_width));
        widthAndHeight.put(SvgValueRenderer.OPTION_PREFERRED_HEIGHT, Integer.toString(m_height));
        final DataColumnProperties props = new DataColumnProperties(widthAndHeight);
        columnSpecCreator.setProperties(props);
    }
    DataColumnSpec histogramColumnSpec = columnSpecCreator.createSpec();
    return histogramColumnSpec;
}
Also used : DataColumnSpecCreator(org.knime.core.data.DataColumnSpecCreator) DataColumnSpec(org.knime.core.data.DataColumnSpec) DataColumnProperties(org.knime.core.data.DataColumnProperties) LinkedHashMap(java.util.LinkedHashMap)

Example 3 with DataColumnProperties

use of org.knime.core.data.DataColumnProperties in project knime-core by knime.

the class DataColumnSpecListCellRenderer method createInvalidSpec.

/**
 * @param originalSpec the original {@link DataColumnSpec} to be marked as invalid
 * @return the given {@link DataColumnSpec} with the added invalid flag
 * @since 2.8
 * @see #INVALID_PROPERTY_NAME
 */
public static final DataColumnSpec createInvalidSpec(final DataColumnSpec originalSpec) {
    DataColumnSpecCreator creator = new DataColumnSpecCreator(originalSpec);
    final DataColumnProperties origProps = originalSpec.getProperties();
    final Map<String, String> map = creaeteInvalidPropertiesMap();
    final DataColumnProperties props;
    if (origProps != null) {
        props = origProps.cloneAndOverwrite(map);
    } else {
        props = new DataColumnProperties(map);
    }
    creator.setProperties(props);
    final DataColumnSpec invalidSpec = creator.createSpec();
    return invalidSpec;
}
Also used : DataColumnSpecCreator(org.knime.core.data.DataColumnSpecCreator) DataColumnSpec(org.knime.core.data.DataColumnSpec) DataColumnProperties(org.knime.core.data.DataColumnProperties)

Example 4 with DataColumnProperties

use of org.knime.core.data.DataColumnProperties in project knime-core by knime.

the class DataColumnSpecListCellRenderer method createInvalidSpec.

/**
 * @param colName the name of the invalid column
 * @param type Type of the column
 * @return the invalid {@link DataColumnSpec} for the given name and type
 * @since 2.9
 */
public static DataColumnSpec createInvalidSpec(final String colName, final DataType type) {
    DataColumnSpecCreator creator = new DataColumnSpecCreator(colName, type);
    creator.setProperties(new DataColumnProperties(creaeteInvalidPropertiesMap()));
    return creator.createSpec();
}
Also used : DataColumnSpecCreator(org.knime.core.data.DataColumnSpecCreator) DataColumnProperties(org.knime.core.data.DataColumnProperties)

Example 5 with DataColumnProperties

use of org.knime.core.data.DataColumnProperties in project knime-core by knime.

the class SampleDataNodeModel method configure.

/**
 * {@inheritDoc}
 */
@Override
protected DataTableSpec[] configure(final DataTableSpec[] inSpecs) {
    DataColumnSpec[] colSpecs = new DataColumnSpec[m_minValues.length + 1];
    int currentDim = 0;
    for (int u = 0; u < m_clusterCount.length; u++) {
        int dimCountInUniverse = m_uniSize[u];
        Hashtable<String, String> annot = new Hashtable<String, String>();
        annot.put("universe_name", "Universe_" + u);
        for (int i = 0; i < dimCountInUniverse; i++) {
            String n = "Universe_" + u + "_" + i;
            DataType t = DoubleCell.TYPE;
            DataColumnSpecCreator creator = new DataColumnSpecCreator(n, t);
            creator.setProperties(new DataColumnProperties(annot));
            colSpecs[currentDim++] = creator.createSpec();
        }
    }
    String n = "Cluster Membership";
    DataType t = StringCell.TYPE;
    DataColumnSpecCreator creator = new DataColumnSpecCreator(n, t);
    colSpecs[currentDim] = creator.createSpec();
    DataColumnSpec[] centerColSpec = new DataColumnSpec[colSpecs.length - 1];
    System.arraycopy(colSpecs, 0, centerColSpec, 0, centerColSpec.length);
    return new DataTableSpec[] { new DataTableSpec(colSpecs), new DataTableSpec(centerColSpec) };
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) DataColumnSpec(org.knime.core.data.DataColumnSpec) DataColumnSpecCreator(org.knime.core.data.DataColumnSpecCreator) Hashtable(java.util.Hashtable) DataType(org.knime.core.data.DataType) DataColumnProperties(org.knime.core.data.DataColumnProperties)

Aggregations

DataColumnProperties (org.knime.core.data.DataColumnProperties)11 DataColumnSpec (org.knime.core.data.DataColumnSpec)9 DataColumnSpecCreator (org.knime.core.data.DataColumnSpecCreator)9 DataType (org.knime.core.data.DataType)4 DataTableSpec (org.knime.core.data.DataTableSpec)3 BitVectorValue (org.knime.core.data.vector.bitvector.BitVectorValue)3 ByteVectorValue (org.knime.core.data.vector.bytevector.ByteVectorValue)3 FilterResult (org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult)3 ArrayList (java.util.ArrayList)2 DataCell (org.knime.core.data.DataCell)2 DoubleValue (org.knime.core.data.DoubleValue)2 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)2 PMMLPortObjectSpecCreator (org.knime.core.node.port.pmml.PMMLPortObjectSpecCreator)2 BigInteger (java.math.BigInteger)1 HashMap (java.util.HashMap)1 Hashtable (java.util.Hashtable)1 LinkedHashMap (java.util.LinkedHashMap)1 JsonObjectBuilder (javax.json.JsonObjectBuilder)1 Apply (org.dmg.pmml.ApplyDocument.Apply)1 Constant (org.dmg.pmml.ConstantDocument.Constant)1