当前位置: 首页>>代码示例>>Java>>正文


Java DataTableSpec类代码示例

本文整理汇总了Java中org.knime.core.data.DataTableSpec的典型用法代码示例。如果您正苦于以下问题:Java DataTableSpec类的具体用法?Java DataTableSpec怎么用?Java DataTableSpec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataTableSpec类属于org.knime.core.data包,在下文中一共展示了DataTableSpec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@SuppressWarnings("deprecation")
@Override
protected DataTableSpec[] configure(final DataTableSpec[] inSpecs)
        throws InvalidSettingsException {

    m_classColIdx = NodeUtils.autoColumnSelection(inSpecs[DATA_PORT],
            m_classColModel, StringValue.class, this.getClass());

    m_repColIdx = NodeUtils.autoColumnSelection(inSpecs[DATA_PORT],
            m_repColModel, DataValue.class, this.getClass());

    m_renderer = inSpecs[DATA_PORT].getColumnSpec(m_repColIdx).getType()
            .getRenderer(inSpecs[DATA_PORT].getColumnSpec(m_repColIdx));

    m_colNames = inSpecs[DATA_PORT].getColumnNames();

    // Pass through
    if (inSpecs[PASSTHROUGH_PORT] != null) {
        return new DataTableSpec[] { inSpecs[PASSTHROUGH_PORT] };
    }
    // else route the input port
    return new DataTableSpec[] { inSpecs[DATA_PORT] };
}
 
开发者ID:knime,项目名称:knime-activelearning,代码行数:27,代码来源:ActiveLearnLoopEndNodeModel.java

示例2: configure

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected DataTableSpec[] configure(final DataTableSpec[] inSpecs)
        throws InvalidSettingsException {

    // a^2
    final double alphaValue = m_radiusAlphaModel.getDoubleValue();
    m_alpha = 4.0d / (alphaValue * alphaValue);

    // a^2*rb^2
    m_beta = 4.0d / (alphaValue * alphaValue * FACTOR_RB * FACTOR_RB);

    m_exploitation = m_exploitationModel.getDoubleValue();

    m_classIdx = NodeUtils.autoColumnSelection(inSpecs[1], m_classColModel,
            StringValue.class, PBACScorerNodeModel.class);

    m_doubleIndices = NodeTools
            .collectAllColumnIndicesOfType(DoubleValue.class, inSpecs[0]);

    m_resSpec = createResRearranger(inSpecs[0]);

    return new DataTableSpec[] { m_resSpec.createSpec() };
}
 
开发者ID:knime,项目名称:knime-activelearning,代码行数:27,代码来源:PBACScorerNodeModel.java

示例3: createResRearranger

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
/**
 * {@inheritDoc} Variance based score.
 */
@Override
protected ColumnRearranger createResRearranger(final DataTableSpec inSpec)
        throws InvalidSettingsException {
    final ColumnRearranger rearranger = new ColumnRearranger(inSpec);
    final DataColumnSpec newColSpec =
            new DataColumnSpecCreator("Variance Score", DoubleCell.TYPE)
                    .createSpec();

    // utility object that performs the calculation
    rearranger.append(new SingleCellFactory(newColSpec) {
        final List<Integer> m_selectedIndicies =
                NodeTools.getIndicesFromFilter(inSpec, m_columnFilterModel,
                        DoubleValue.class, VarianceScorerNodeModel.class);

        @Override
        public DataCell getCell(final DataRow row) {
            return new DoubleCell(MathUtils.variance(
                    NodeTools.toDoubleArray(row, m_selectedIndicies)));
        }
    });
    return rearranger;
}
 
开发者ID:knime,项目名称:knime-activelearning,代码行数:26,代码来源:VarianceScorerNodeModel.java

示例4: createResRearranger

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
private ColumnRearranger createResRearranger(final DataTableSpec inSpec) {
    final ColumnRearranger rearranger = new ColumnRearranger(inSpec);
    rearranger.append(new CellFactory() {

        @Override
        public void setProgress(final int curRowNr, final int rowCount,
                final RowKey lastKey, final ExecutionMonitor exec) {
            exec.setProgress((double) curRowNr / rowCount);

        }

        @Override
        public DataColumnSpec[] getColumnSpecs() {
            return new DataColumnSpec[] {
                    new DataColumnSpecCreator("Graph Density Score",
                            DoubleCell.TYPE).createSpec() };
        }

        @Override
        public DataCell[] getCells(final DataRow row) {
            return new DataCell[] { new DoubleCell(
                    m_dataPoints.get(row.getKey()).getDensity()) };
        }
    });
    return rearranger;
}
 
开发者ID:knime,项目名称:knime-activelearning,代码行数:27,代码来源:GraphDensityScorerNodeModel.java

示例5: configure

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected DataTableSpec[] configure(final DataTableSpec[] inSpecs)
        throws InvalidSettingsException {

    if (NodeTools.collectAllColumnIndicesOfType(DoubleValue.class,
            inSpecs[UNLABELED_PORT]).isEmpty()) {
        throw new InvalidSettingsException("No Double columns avaiable!");
    }

    m_beta = 4.0d / ((m_radiusAlphaModel.getDoubleValue() * FACTOR_RB)
            * (m_radiusAlphaModel.getDoubleValue() * FACTOR_RB));

    m_alpha = 4.0d / (m_radiusAlphaModel.getDoubleValue()
            * m_radiusAlphaModel.getDoubleValue());

    m_resSpec = createResRearranger(inSpecs[UNLABELED_PORT]);

    return new DataTableSpec[] { m_resSpec.createSpec() };
}
 
开发者ID:knime,项目名称:knime-activelearning,代码行数:23,代码来源:NodePotentialScorerNodeModel.java

示例6: firstCompatibleColumn

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
/**
 * Searches the first compatible column from the table specs.
 *
 * @param inSpec
 * @param valueClass
 * @param except
 *            columns that should not be chosen e.g. because they are
 *            already in use
 * @return the index of the first compatible column or -1 if no column in
 *         the table specs is compatible
 */
public static final int firstCompatibleColumn(final DataTableSpec inSpec,
        final Class<? extends DataValue> valueClass,
        final Integer... except) {

    final List<Integer> exceptList = (except == null
            ? new LinkedList<Integer>() : Arrays.asList(except));

    int i = 0;
    for (final DataColumnSpec colspec : inSpec) {
        if (colspec.getType().isCompatible(valueClass)
                && !exceptList.contains(i)) {
            return i;
        }
        i++;
    }
    return -1;
}
 
开发者ID:knime,项目名称:knime-activelearning,代码行数:29,代码来源:NodeUtils.java

示例7: silentOptionalAutoColumnSelection

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
/**
 * If setting holds a valid column name returns the column index. If not
 * search the first compatible column and return the index.
 *
 * @param inSpec
 * @param model
 * @param valueClass
 * @param except
 *            columns that should not be chosen e.g. because they are
 *            already in use
 * @return The column index, maybe -1, if not found
 */
public static final int silentOptionalAutoColumnSelection(
        final DataTableSpec inSpec, final SettingsModelString model,
        final Class<? extends DataValue> valueClass,
        final Integer... except) {

    int i = inSpec.findColumnIndex(model.getStringValue());
    if ((i > -1)
            && inSpec.getColumnSpec(i).getType().isCompatible(valueClass)) {
        return i;
    }
    i = autoOptionalColumnSelection(inSpec, model, valueClass, except);

    return i;

}
 
开发者ID:knime,项目名称:knime-activelearning,代码行数:28,代码来源:NodeUtils.java

示例8: getIndicesFromFilter

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
/**
 * Provides a safe method to get the indices of the selected columns from a
 * Filter Model, falls back on selecting all compatible types in case the
 * selection is invalid.
 *
 * @param spec
 *            the spec of the table.
 * @param filterModel
 *            the filter model that specifies the selection
 * @param valueClass
 *            the value class selected in case the selection is invalid
 * @param nodeModelClass
 *            node model class to be able to set right logger message
 *
 * @return the indices of the selected columns
 */
public static List<Integer> getIndicesFromFilter(final DataTableSpec spec,
        final SettingsModelColumnFilter2 filterModel,
        final Class<? extends DataValue> valueClass,
        final Class<? extends NodeModel> nodeModelClass) {

    final FilterResult result = filterModel.applyTo(spec);

    // in case of an invalid selection, select all
    if ((result.getIncludes().length == 0)
            && (result.getExcludes().length == 0)) {
        NodeLogger.getLogger(nodeModelClass)
                .warn("Invalid column selection, automatically selecting "
                        + "all columns of the following type: "
                        + valueClass.getSimpleName());
        return collectAllColumnIndicesOfType(valueClass, spec);
    }
    return columnNamesToIndices(result.getIncludes(), spec);
}
 
开发者ID:knime,项目名称:knime-activelearning,代码行数:35,代码来源:NodeTools.java

示例9: updateData

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
/**
 * Update the settings and input spec.
 * @param settings the settings
 * @param spec the input spec
 * @param flowVars the available flow variables
 */
public void updateData(final JavaSnippetSettings settings,
        final DataTableSpec spec,
        final Map<String, FlowVariable> flowVars) {
    m_inListenerArmed = false;
    m_outListenerArmed = false;
    m_inFieldsTable.updateData(settings.getJavaSnippetFields(),
            spec, flowVars);
    m_outFieldsTable.updateData(settings.getJavaSnippetFields(),
            spec, flowVars);
    // update snippet.
    m_snippet.setJavaSnippetFields(new JavaSnippetFields(
            m_inFieldsTable.getInColFields(),
            m_inFieldsTable.getInVarFields(),
            m_outFieldsTable.getOutColFields(),
            m_outFieldsTable.getOutVarFields()));
    m_inListenerArmed = true;
    m_outListenerArmed = true;
}
 
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:25,代码来源:JSnippetFieldsController.java

示例10: createVcfDataColumnSpec

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
private DataTableSpec createVcfDataColumnSpec()
{
DataColumnSpec[] allColSpecs = new DataColumnSpec[11];

   allColSpecs[0] =  new DataColumnSpecCreator("CHROM", StringCell.TYPE).createSpec();
   allColSpecs[1] =  new DataColumnSpecCreator("POS", IntCell.TYPE).createSpec();
   allColSpecs[2] =  new DataColumnSpecCreator("ID", StringCell.TYPE).createSpec();
   allColSpecs[3] =  new DataColumnSpecCreator("REF", StringCell.TYPE).createSpec();
   allColSpecs[4] =  new DataColumnSpecCreator("ALT", StringCell.TYPE).createSpec();
   allColSpecs[5] =  new DataColumnSpecCreator("QUAL", DoubleCell.TYPE).createSpec();
   allColSpecs[6] =  new DataColumnSpecCreator("FILTER", StringCell.TYPE).createSpec();
   allColSpecs[7] =  new DataColumnSpecCreator("INFO", StringCell.TYPE).createSpec();
   allColSpecs[8] =  new DataColumnSpecCreator("FORMAT", StringCell.TYPE).createSpec();
   allColSpecs[9] = new DataColumnSpecCreator("CALL", StringCell.TYPE).createSpec();
allColSpecs[10] =  new DataColumnSpecCreator("SAMPLE", StringCell.TYPE).createSpec();
   return new DataTableSpec( allColSpecs);
}
 
开发者ID:lindenb,项目名称:knime4bio,代码行数:18,代码来源:ReadOneVCFNodeModel.java

示例11: execute

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inData,
		final ExecutionContext exec) throws Exception {

	// create output table
	BufferedDataContainer container = exec
			.createDataContainer(new DataTableSpec(
					new DataColumnSpec[] { new DataColumnSpecCreator(
							"Column 0", LongCell.TYPE).createSpec() }));

	// add row with count
	container.addRowToTable(new DefaultRow(new RowKey("Row 0"),
			new LongCell[] { new LongCell(TableCellUtils.getRDD(inData[0])
					.count()) }));
	container.close();

	BufferedDataTable out = container.getTable();

	// update viewer
	rddViewer = new RddViewer(out, exec);

	return new BufferedDataTable[] { out };
}
 
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:27,代码来源:CountNodeModel.java

示例12: configure

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
@Override
protected DataTableSpec[] configure(DataTableSpec[] inSpecs)
		throws InvalidSettingsException {
	if(inSpecs==null || inSpecs.length!=1)
		{
		throw new InvalidSettingsException("Expected one tables");
		}
	for(String s:m_numericColumns.getIncludeList())
		{
		if(inSpecs[0].findColumnIndex(s)==-1)
			{
			throw new InvalidSettingsException("Cannot find columns "+s);
			}
		}
	return new DataTableSpec[]{new DataTableSpec(inSpecs[0],createDataTableSpec())};
	}
 
开发者ID:lindenb,项目名称:knime4bio,代码行数:17,代码来源:SumNodeModel.java

示例13: createDataTableSpec

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
private DataTableSpec createDataTableSpec() throws InvalidSettingsException
{
List<String> tags=extractFields();
if(tags.isEmpty()) throw new InvalidSettingsException("No tag was defined");
DataColumnSpec cols[]=new DataColumnSpec[tags.size()*this.m_callColumns.getIncludeList().size()];
DataType t=getDataType();
int n=0;
for(String call:this.m_callColumns.getIncludeList())
	{
	for(int i=0;i< tags.size();++i)
		{
		cols[n++]=new DataColumnSpecCreator(call+":"+tags.get(i),t).createSpec();
		}
	}
return new DataTableSpec(cols);
}
 
开发者ID:lindenb,项目名称:knime4bio,代码行数:17,代码来源:ExtractFormatMultiNodeModel.java

示例14: createDataTableSpec

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
private DataTableSpec createDataTableSpec()
 	{
 	List<DataColumnSpec> specs=new ArrayList<DataColumnSpec>();
if(m_show_chrom.getBooleanValue())
	{
	specs.add(new DataColumnSpecCreator("hg19Snp130.chrom",StringCell.TYPE).createSpec());
	}
if(m_show_chromStart.getBooleanValue())
	{
	specs.add(new DataColumnSpecCreator("hg19Snp130.chromStart",IntCell.TYPE).createSpec());
	}
if(m_show_chromEnd.getBooleanValue())
	{
	specs.add(new DataColumnSpecCreator("hg19Snp130.chromEnd",IntCell.TYPE).createSpec());
	}
if(m_show_name.getBooleanValue())
	{
	specs.add(new DataColumnSpecCreator("hg19Snp130.name",StringCell.TYPE).createSpec());
	}
 	return new DataTableSpec(specs.toArray(new DataColumnSpec[specs.size()]));
 	}
 
开发者ID:lindenb,项目名称:knime4bio,代码行数:22,代码来源:Hg19Snp130NodeModel.java

示例15: configure

import org.knime.core.data.DataTableSpec; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected DataTableSpec[] configure(final DataTableSpec[] inSpecs)
        throws InvalidSettingsException
    {
    if(inSpecs==null || inSpecs.length!=1)
    	{
    	throw new InvalidSettingsException("Expected one table.");
    	}
   
    findColumnIndex(inSpecs[0],m_chromCol,StringCell.TYPE);
    findColumnIndex(inSpecs[0],m_posCol,IntCell.TYPE);
    findColumnIndex(inSpecs[0],m_refCol,StringCell.TYPE);
    findColumnIndex(inSpecs[0],m_altCol,StringCell.TYPE);
    
	return new DataTableSpec[0];
	}
 
开发者ID:lindenb,项目名称:knime4bio,代码行数:20,代码来源:AbstractPredictionOutNodeModel.java


注:本文中的org.knime.core.data.DataTableSpec类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。