本文整理汇总了Java中org.knime.core.data.DataCell类的典型用法代码示例。如果您正苦于以下问题:Java DataCell类的具体用法?Java DataCell怎么用?Java DataCell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataCell类属于org.knime.core.data包,在下文中一共展示了DataCell类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createCellFactory
import org.knime.core.data.DataCell; //导入依赖的package包/类
/**
* Creates a CellFactory for the class column.
*
* @param colName
* the name of the class column
* @return CellFactory for the class column.
*/
private CellFactory createCellFactory(final String colName) {
return 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(colName, StringCell.TYPE)
.createSpec() };
}
@Override
public DataCell[] getCells(final DataRow row) {
throw new IllegalStateException(
new IllegalAccessException("This shouldn't be called"));
}
};
}
开发者ID:knime,项目名称:knime-activelearning,代码行数:31,代码来源:ActiveLearnLoopStartNodeModel.java
示例2: createResRearranger
import org.knime.core.data.DataCell; //导入依赖的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
示例3: createResRearranger
import org.knime.core.data.DataCell; //导入依赖的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
示例4: getCells
import org.knime.core.data.DataCell; //导入依赖的package包/类
@Override
public DataCell[] getCells(final DataRow row) {
final NoveltyScores noveltyScores = m_model.scoreTestData(row);
final double score = noveltyScores.getScores()[0] / m_normalizer;
final double[] nullspaceCoordinates =
noveltyScores.getCoordinates().getRow(0);
final ArrayList<DataCell> cells = new ArrayList<DataCell>();
if (m_appendNoveltyScore) {
cells.add(new DoubleCell(score));
}
if (m_appendNullspaceCoordinates) {
for (final double coord : nullspaceCoordinates) {
cells.add(new DoubleCell(coord));
}
}
if (cells.isEmpty()) {
return new DataCell[] {};
}
return cells.toArray(new DataCell[cells.size()]);
}
开发者ID:knime,项目名称:knime-activelearning,代码行数:26,代码来源:KNFSTNoveltyScorerCellFactory.java
示例5: readDataRow
import org.knime.core.data.DataCell; //导入依赖的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
示例6: getValueOfType
import org.knime.core.data.DataCell; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@SuppressWarnings("rawtypes")
@Override
public Object getValueOfType(final Class c) throws TypeException {
DataCell cell = m_row.getCell(m_index);
if (cell.isMissing()) {
return null;
}
TypeProvider p = TypeProvider.getDefault();
DataType type = cell.getType();
DataType elemType = type.isCollectionType()
? type.getCollectionElementType() : type;
DataValueToJava conv = p.getDataValueToJava(elemType,
type.isCollectionType());
return conv.getValue(cell, c);
}
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:19,代码来源:JavaSnippetCellFactory.java
示例7: createDataCellUnchecked
import org.knime.core.data.DataCell; //导入依赖的package包/类
/**
* {@inheritDoc}
* @throws IOException if an io error occurs while reading the XML string
* @throws SAXException if an error occurs while parsing
* @throws ParserConfigurationException if the parser cannot be instantiated
* @throws XMLStreamException if error occurs while parsing
*/
@Override
public DataCell createDataCellUnchecked(final Object value)
throws TypeException, IOException, ParserConfigurationException,
SAXException, XMLStreamException {
if (value instanceof Calendar) {
Calendar calendar = (Calendar)value;
return new DateAndTimeCell(calendar.getTimeInMillis(),
calendarHasDate(calendar),
calendarHasTime(calendar),
calendarHasMillis(calendar));
} else { // value instanceof Date
Date date = (Date)value;
return new DateAndTimeCell(date.getTime(),
true, true, true);
}
}
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:24,代码来源:JavaToDateAndTimeCell.java
示例8: getCellValue
import org.knime.core.data.DataCell; //导入依赖的package包/类
/**
* Extract value from cell. Supported types: <code>String</code>,
* <code>Double</code>, <code>Integer</code>, <code>Long</code>,
* <code>Boolean</code>.
*
* @param cell
* <code>DataCell</code>
* @return <code>Object</code> saved in cell or null
*/
private Object getCellValue(DataCell cell) {
DataType type = cell.getType();
if (type == StringCell.TYPE) {
return ((StringCell) cell).getStringValue();
} else if (type == DoubleCell.TYPE) {
return ((DoubleCell) cell).getDoubleValue();
} else if (type == IntCell.TYPE) {
return ((IntCell) cell).getIntValue();
} else if (type == LongCell.TYPE) {
return ((LongCell) cell).getLongValue();
} else if (type == BooleanCell.TYPE) {
return ((BooleanCell) cell).getBooleanValue();
} else {
return null;
}
}
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:27,代码来源:TableToRDDNodeModel.java
示例9: endDocument
import org.knime.core.data.DataCell; //导入依赖的package包/类
@Override
public void endDocument() throws SAXException
{
if(this.countExported==0)
{
DataCell cells[]=new DataCell[8];
for(int i=0;i< cells.length;++i)
{
cells[i]=DataType.getMissingCell();
}
this.container.addRowToTable(
new AppendedColumnRow(
RowKey.createRowKey(++outIndex),
this.row,
cells
)
);
}
}
开发者ID:lindenb,项目名称:knime4bio,代码行数:21,代码来源:DasFeaturesNodeModel.java
示例10: execute
import org.knime.core.data.DataCell; //导入依赖的package包/类
private int execute(int outIndex,List<Range> ranges,BufferedDataContainer container)
throws Exception
{
for(int i=0;i<ranges.size();++i)
{
Range prev=(i>0?ranges.get(i-1):null);
Range mid=ranges.get(i);
Range next=(i+1< ranges.size()?ranges.get(i+1):null);
DataCell cells[]=new DataCell[]
{
new StringCell(mid.chrom),
new IntCell(prev==null?mid.chromStart:prev.chromEnd+1),
new IntCell(next==null?mid.chromEnd:next.chromStart-1),
(mid.under?BooleanCell.FALSE:BooleanCell.TRUE),
new IntCell(mid.count),
new DoubleCell(mid.min),
new DoubleCell(mid.max),
new DoubleCell(mid.total/mid.count)
};
container.addRowToTable(new DefaultRow(RowKey.createRowKey(++outIndex),cells));
}
return outIndex;
}
开发者ID:lindenb,项目名称:knime4bio,代码行数:25,代码来源:AggregationNodeModel.java
示例11: makeMutationPrediction
import org.knime.core.data.DataCell; //导入依赖的package包/类
@Override
protected Mutation makeMutationPrediction(DataCell c)
{
if(c.isMissing()) return null;
String cell=StringCell.class.cast(c).getStringValue();
if(cell.equalsIgnoreCase("Coordinates")) return null;
String variant[]=comma.split(cell);
if(!variant[0].startsWith("chr")) variant[0]="chr"+variant[0];
if( variant.length<4 ||
variant[3].length()<2 || variant[3].charAt(1)!='/')
{
throw new IllegalArgumentException("uuhh bad cell: \""+cell+"\"");
}
Position pos= new Position(variant[0],Integer.parseInt(variant[1]));
Mutation mutation=new Mutation(
pos,
variant[3].substring(0,1).toUpperCase(),
variant[3].substring(2).toUpperCase()
);
return mutation;
}
开发者ID:lindenb,项目名称:knime4bio,代码行数:22,代码来源:SiftInNodeModel.java
示例12: toDataCells
import org.knime.core.data.DataCell; //导入依赖的package包/类
public DataCell[] toDataCells(Record rec)
{
List<DataCell> cells=new ArrayList<DataCell>();
if(m_show_chrom.getBooleanValue())
{
cells.add(new StringCell(rec.chrom));
}
if(m_show_chromStart.getBooleanValue())
{
cells.add(new IntCell(rec.chromStart));
}
if(m_show_chromEnd.getBooleanValue())
{
cells.add(new IntCell(rec.chromEnd));
}
if(m_show_name.getBooleanValue())
{
cells.add(new StringCell(rec.name));
}
return cells.toArray(new DataCell[cells.size()]);
}
开发者ID:lindenb,项目名称:knime4bio,代码行数:23,代码来源:Hg19Snp130NodeModel.java
示例13: readBlob
import org.knime.core.data.DataCell; //导入依赖的package包/类
protected DataCell readBlob(ResultSet m_result,int index0) throws SQLException,IOException
{
InputStream is = m_result.getBinaryStream(index0);
if (m_result.wasNull() || is == null) {
return DataType.getMissingCell();
} else {
InputStreamReader reader = new InputStreamReader(is);
StringWriter writer = new StringWriter();
FileUtil.copy(reader, writer);
reader.close();
writer.close();
return new StringCell(writer.toString());
}
}
开发者ID:lindenb,项目名称:knime4bio,代码行数:17,代码来源:AbstractSqlNodeModel.java
示例14: getValueAt
import org.knime.core.data.DataCell; //导入依赖的package包/类
@Override
public synchronized Object getValueAt(int rowIndex, int columnIndex)
{
if(this.dataTable==null) return null;
if( rowIndex>=this.cachedRowIndex &&
rowIndex-this.cachedRowIndex<this.cachedRows.size())
{
DataCell cell= this.cachedRows.get(rowIndex-this.cachedRowIndex).getCell(columnIndex);
if(cell.isMissing()) return null;
return toObject(cell);
}
ScanThread thread=this.scanthread;
if(thread!=null && thread.startRow<=rowIndex && rowIndex< thread.startRow+CACHE_SIZE )
{
return null;
}
scan(rowIndex);
return null;
}
开发者ID:lindenb,项目名称:knime4bio,代码行数:22,代码来源:BufferedDataTableModel.java
示例15: compare
import org.knime.core.data.DataCell; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public int compare(DataCell cell1,DataCell cell2)
{
if(cell1.isMissing())
{
if(cell2.isMissing()) return 0;
return -1;
}
if(cell2.isMissing())
{
return 1;
}
Comparable c1= comparable(cell1);
Comparable c2= comparable(cell2);
return c1.compareTo(c2);
}
开发者ID:lindenb,项目名称:knime4bio,代码行数:18,代码来源:CellSorter.java
示例16: make
import org.knime.core.data.DataCell; //导入依赖的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
示例17: make
import org.knime.core.data.DataCell; //导入依赖的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
示例18: execute
import org.knime.core.data.DataCell; //导入依赖的package包/类
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inData,
final ExecutionContext exec) throws Exception {
// Create data cells.
final DataTableSpec outSpecs = configure(new DataTableSpec[]{null})[0];
int numCols = outSpecs.getNumColumns();
DataCell[][] stringCells = new DataCell[1][numCols];
// Build a table of string values.
DataColumnSpec[] stringColSpecs = new DataColumnSpec[numCols];
for (int i=0; i<numCols; i++) {
StringCell sCell = new StringCell(this.colValues.get(i));
stringCells[0][i] = sCell;
stringColSpecs[i] = new DataColumnSpecCreator(colNames.get(i), StringCell.TYPE).createSpec();
}
DataRow row = new DefaultRow(new RowKey("0"), stringCells[0]);
BufferedDataContainer cnt = exec.createDataContainer(new DataTableSpec(stringColSpecs));
cnt.addRowToTable(row);
cnt.close();
BufferedDataTable bufTbl = exec.createBufferedDataTable(cnt.getTable(), exec);
// Now, convert to the proper column types as configured by the input columns.
BufferedDataTable out = exec.createSpecReplacerTable(bufTbl, outSpecs);
return new BufferedDataTable[]{out};
}
开发者ID:helixyte,项目名称:knime_atc,代码行数:24,代码来源:ATCNodeModel.java
示例19: getQualityValues
import org.knime.core.data.DataCell; //导入依赖的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
示例20: requireRenderer
import org.knime.core.data.DataCell; //导入依赖的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
注:本文中的org.knime.core.data.DataCell类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论