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


Java DataRow.getCell方法代码示例

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


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

示例1: getValueAt

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Object getValueAt(final int row, final int col) {
    if (m_rows.size() == 0) { // this will probably not be called if,
        // but making sure anyway
        return null;
    }

    if (col == 0) {
        return getRowKeyOf(row);
    } else if (col == m_classColumnIndex) {
        return m_listener.m_classMap.get(getRowKeyOf(row));
    }

    final DataRow data = m_rows.get(row); // get the row
    return data.getCell(col - 1); // return the column (<-1> because
    // first column is RowID and is not
    // contained in data)
}
 
开发者ID:knime,项目名称:knime-activelearning,代码行数:22,代码来源:ClassViewerTable.java

示例2: readDataRow

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
private double[] readDataRow(final DataRow row) {
    final double[] data = new double[row.getNumCells()];
    for (int i = 0; i < row.getNumCells(); i++) {
        final DataCell cell = row.getCell(i);
        if (cell.isMissing()) {
            throw new IllegalArgumentException(
                    "Missing values are not supported.");
        } else if (!cell.getType().isCompatible(DoubleValue.class)) {
            throw new IllegalArgumentException(
                    "Only numerical data types are currently supported.");
        } else {
            data[i] = ((DoubleValue) cell).getDoubleValue();
        }
    }
    return data;
}
 
开发者ID:knime,项目名称:knime-activelearning,代码行数:17,代码来源:KernelCalculator.java

示例3: isPairRDD

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
/**
 * Check if table contain JavaPairRDD object. Only for RddTables. Other
 * tables will throw a ClassCastException.
 * 
 * @param table
 *            <code>BufferedDataTable</code>
 * @throws IndexOutOfBoundsException
 *             If <code>table</code> contains more than one cell
 * @throws ClassCastException
 *             If <code>table</code> isn't a RddTable
 * @return
 */
public static Boolean isPairRDD(BufferedDataTable table) {
	String[] names = table.getSpec().getColumnNames();
	if (names.length != 1) {
		throw new IndexOutOfBoundsException(
				"table should contain only one cells");
	}
	CloseableRowIterator it = table.iterator();
	DataRow firstRow = it.next();
	try {
		RddCell rddCell = (RddCell) firstRow.getCell(0);
		return false;
	} catch (ClassCastException e) {
		PairRddCell pairRddCell = (PairRddCell) firstRow.getCell(0);
		return true;
	}
}
 
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:29,代码来源:TableCellUtils.java

示例4: isRDDTable

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
/**
 * Check if table contains JavaRDDLike object
 * 
 * @param table
 *            <code>BufferedDataTable</code>
 * @return
 */
public static Boolean isRDDTable(BufferedDataTable table) {
	String[] names = table.getSpec().getColumnNames();
	if (names.length != 1) {
		// RDD table should contain just one column
		return false;
	}
	CloseableRowIterator it = table.iterator();
	DataRow firstRow = it.next();
	if (it.hasNext()) {
		// RDD table should contain just one row
		return false;
	}
	try {
		RddCell rddCell = (RddCell) firstRow.getCell(0);
		return true;
	} catch (Exception e) {
		try {
			PairRddCell pairRddCell = (PairRddCell) firstRow.getCell(0);
			return true;
		} catch (Exception ee) {
			return false;
		}
	}
}
 
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:32,代码来源:TableCellUtils.java

示例5: make

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
public Segment make(DataRow row)
{
DataCell c=row.getCell(chromCol);
if(c.isMissing()) return null;
String chrom=StringCell.class.cast(c).getStringValue();

c=row.getCell(chromStartCol);
if(c.isMissing()) return null;
int start=IntCell.class.cast(c).getIntValue();


c=row.getCell(chromEndCol);
if(c.isMissing()) return null;
int end=IntCell.class.cast(c).getIntValue();
return new Segment(chrom, start,end);
}
 
开发者ID:lindenb,项目名称:knime4bio,代码行数:17,代码来源:BedKSorter.java

示例6: make

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
public Mutation make(DataRow row)
{
DataCell c=row.getCell(chromCol);
if(c.isMissing()) return null;
String chrom=StringCell.class.cast(c).getStringValue();
c=row.getCell(posCol);
if(c.isMissing()) return null;
int pos=IntCell.class.cast(c).getIntValue();
c=row.getCell(refCol);
if(c.isMissing()) return null;
String ref=StringCell.class.cast(c).getStringValue();
c=row.getCell(altCol);
if(c.isMissing()) return null;
String alt=StringCell.class.cast(c).getStringValue();
return new Mutation(new Position(chrom, pos),ref.toUpperCase(),alt.toUpperCase());
}
 
开发者ID:lindenb,项目名称:knime4bio,代码行数:17,代码来源:MutationKSorter.java

示例7: getQualityValues

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
public static Map<String, Double> getQualityValues(BufferedDataTable table, String id, List<String> columns) {
	for (DataRow row : getRowsById(table, id)) {
		Map<String, Double> values = new LinkedHashMap<>();

		for (String column : columns) {
			DataCell cell = row.getCell(table.getSpec().findColumnIndex(column));

			if (IO.getDouble(cell) != null) {
				values.put(column, IO.getDouble(cell));
			} else if (IO.getInt(cell) != null) {
				values.put(column, IO.getInt(cell).doubleValue());
			} else {
				values.put(column, null);
			}
		}

		return values;
	}

	return new LinkedHashMap<>();
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:22,代码来源:NlsUtils.java

示例8: requireRenderer

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
/**
 * Get renderer of data referenced by RowKey parameter.
 *
 * @param key
 *            the key of the desired row
 * @return Component which represents a renderer for the data referenced by
 *         key
 */
public Component requireRenderer(final RowKey key) {
    final DataRow dataRow = m_rowMap.get(key);
    if (dataRow == null) {
        throw new IllegalStateException();
    }
    final DataCell cell = dataRow.getCell(m_repColIdx);
    return m_renderer.getRendererComponent(cell);
}
 
开发者ID:knime,项目名称:knime-activelearning,代码行数:17,代码来源:ActiveLearnLoopEndNodeModel.java

示例9: readBufferedDataTable

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
public static double[][]
        readBufferedDataTable(final BufferedDataTable table) {
    final long size = table.size();
    if (size > Integer.MAX_VALUE) {
        throw new IllegalStateException("The input table is too large.");
    }
    final double[][] data = new double[(int) size][table.getDataTableSpec()
            .getNumColumns()];

    final Iterator<DataRow> iterator = table.iterator();

    for (int r = 0; iterator.hasNext(); r++) {
        final DataRow next = iterator.next();
        for (int c = 0; c < table.getDataTableSpec().getNumColumns(); c++) {
            final DataCell cell = next.getCell(c);
            if (cell.isMissing()) {
                throw new IllegalArgumentException(
                        "Missing values are not supported.");
            } else if (!cell.getType().isCompatible(DoubleValue.class)) {
                throw new IllegalArgumentException(
                        "Only numerical data types are currently supported.");
            } else {
                data[r][c] = ((DoubleValue) cell).getDoubleValue();
            }
        }
    }

    return data;
}
 
开发者ID:knime,项目名称:knime-activelearning,代码行数:30,代码来源:KernelCalculator.java

示例10: getQuery

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
protected String getQuery(DataRow row,DataTableSpec spec)
throws ExecuteException
{
String query=m_term.getStringValue();
int i=0;
while(i< query.length())
	{
	int j=query.indexOf("##",i);
	if(j==-1 || j+2==query.length())
		{
		break;
		}
	int k=query.indexOf("##",j+2);
	if(k==-1 || k==j+2)
		{
		break;
		}
	String colName=query.substring(j+2, k);
	int n=spec.findColumnIndex(colName);
	if(n==-1) throw new ExecuteException("Cannot find "+colName+" in columns");
	DataCell cell=row.getCell(n);
	if(cell.isMissing()) return null;
	String replace=String.valueOf(cell);
	
	query=query.substring(0,j)+replace+query.substring(k+2);
	i=j+2+replace.length();
	}
return query;
}
 
开发者ID:lindenb,项目名称:knime4bio,代码行数:30,代码来源:AbstractNcbiEUtilsNodeModel.java

示例11: getPosition

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
public  Position getPosition(DataRow row)
{
DataCell k=row.getCell(this.chromColumn);
DataCell p=row.getCell(this.positionColumn);
if(k.isMissing()) return null;
if(p.isMissing()) return null;
return new Position(
		StringCell.class.cast(k).getStringValue(),
		IntCell.class.cast(p).getIntValue()
		);
}
 
开发者ID:lindenb,项目名称:knime4bio,代码行数:12,代码来源:DistanceSnpNodeModel.java

示例12: compare

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
@Override
public int compare(DataRow r1,DataRow r2)
	{
	for(int i=0;i<indexes.size();++i)
		{
		DataCell cell1 = r1.getCell(indexes.get(i));
		DataCell cell2 = r2.getCell(indexes.get(i));
		int d= comparators.get(i).compare(cell1,cell2);
		if(d!=0) return d;
		}
	return 0;
	}
 
开发者ID:lindenb,项目名称:knime4bio,代码行数:13,代码来源:UniqNodeModel.java

示例13: execute

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
@Override
  protected BufferedDataTable[] execute(
  		final BufferedDataTable[] inData,
          final ExecutionContext exec
          ) throws Exception
          {
	BufferedDataContainer container1=null;
	BufferedDataTable inTable=inData[0];
	int chromCol=findColumnIndex(inTable.getDataTableSpec(),m_chromColumn,StringCell.TYPE);
   	int posCol=findColumnIndex(inTable.getDataTableSpec(),m_posColumn,IntCell.TYPE);
	
	String selChrom=this.m_selectChrom.getStringValue();
	int chromStart= this.m_selectChromStart.getIntValue();
	int chromEnd= this.m_selectChromEnd.getIntValue();
	
	try
    	{
	
        container1 = exec.createDataContainer(inTable.getDataTableSpec());
       
        
        double total=inTable.getRowCount();
        int nRow=0;
        CloseableRowIterator iter=null;
        try {
        	iter=inTable.iterator();
        	while(iter.hasNext())
        		{
        		++nRow;
        		DataRow row=iter.next();
        		DataCell cell=row.getCell(chromCol);
        		if(cell.isMissing()) continue;
        		String chrom=StringCell.class.cast(cell).getStringValue();
        		
        		cell=row.getCell(posCol);
        		if(cell.isMissing()) continue;
        		int pos=IntCell.class.cast(cell).getIntValue();
        		
        		if((chrom.equals(selChrom) && chromStart<=pos && chromEnd>=pos) == !m_invert.getBooleanValue() )
        			{
        			container1.addRowToTable(row);
        			}
        		
        		exec.checkCanceled();
            	exec.setProgress(nRow/total,"Cut Region...");
        		}
			} 
        catch (Exception e)
			{
			throw e;
			}
		finally
			{
			if(iter!=null) iter.close();
			}
        
		// once we are done, we close the container and return its table
		safeClose(container1);
        BufferedDataTable out1 = container1.getTable();
        container1=null;
        
       
        BufferedDataTable array[]= new BufferedDataTable[]{out1};
    	return array;
    	}
catch(Exception err)
	{
	getLogger().error("Boum", err);
	err.printStackTrace();
	throw err;
	}
finally
	{
	safeClose(container1);
	}
     }
 
开发者ID:lindenb,项目名称:knime4bio,代码行数:77,代码来源:CutRegionNodeModel.java

示例14: getSample

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
public String getSample(DataRow row)
{
DataCell k=row.getCell(this.sampleColumn);
if(k.isMissing()) return null;
return StringCell.class.cast(k).getStringValue();
}
 
开发者ID:lindenb,项目名称:knime4bio,代码行数:7,代码来源:DistanceSnpNodeModel.java

示例15: execute

import org.knime.core.data.DataRow; //导入方法依赖的package包/类
@Override
protected BufferedDataTable[] execute(BufferedDataTable[] inData,
		ExecutionContext exec) throws Exception
	{
	
	Pattern comma=Pattern.compile("[,]");
	BufferedDataTable inTable=inData[0];
	DataTableSpec inSpecs=inTable.getDataTableSpec();
	CloseableRowIterator iter=null;
	
	int altColumn = inSpecs.findColumnIndex(this.m_altColumn.getStringValue());

	int rowIndex=0;
	double total= inTable.getRowCount();
	BufferedDataContainer container=exec.createDataContainer(createTableSpec(inSpecs,altColumn));
	try
		{
		iter=inTable.iterator();
		int nRow=0;
		while(iter.hasNext())
			{
			DataRow row=iter.next();
			nRow++;
			DataCell cell=row.getCell(altColumn);
			
			List<DataCell> cells=new ArrayList<DataCell>(row.getNumCells()+1);
			for(int i=0;i< row.getNumCells();++i)
				{
				cells.add(row.getCell(i));
				}
			cells.add(row.getCell(altColumn));//append src
			
			if(cell.isMissing() || StringCell.class.cast(cell).getStringValue().trim().length()==0)
				{
				container.addRowToTable(new DefaultRow(RowKey.createRowKey(++rowIndex), cells));
				}
			else
				{
				String alts=StringCell.class.cast(cell).getStringValue();
				for(String alt:comma.split(alts))
					{
					List<DataCell> cells2=new ArrayList<DataCell>(cells);
					cells2.set(altColumn, new StringCell(alt));
					container.addRowToTable(new DefaultRow(RowKey.createRowKey(++rowIndex), cells2));
					}
				}
            exec.checkCanceled();
            exec.setProgress(nRow/total,"Processing ALTS to ALT");
			}
		}
	catch(Exception err)
		{
		err.printStackTrace();
		throw err;
		}
	finally
		{
		safeClose(iter);
		}
	safeClose(container);
	BufferedDataTable out = container.getTable();
       container=null;
       return new BufferedDataTable[]{out};
	}
 
开发者ID:lindenb,项目名称:knime4bio,代码行数:65,代码来源:AltsToAltNodeModel.java


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