本文整理汇总了Java中org.knime.core.data.DataRow类的典型用法代码示例。如果您正苦于以下问题:Java DataRow类的具体用法?Java DataRow怎么用?Java DataRow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataRow类属于org.knime.core.data包,在下文中一共展示了DataRow类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: ActiveLearnLoopEndNodeModel
import org.knime.core.data.DataRow; //导入依赖的package包/类
/**
*
*/
protected ActiveLearnLoopEndNodeModel() {
super(new PortType[] { BufferedDataTable.TYPE,
BufferedDataTable.TYPE_OPTIONAL, },
new PortType[] { BufferedDataTable.TYPE });
m_isExecuting = false;
m_isTerminated = false;
// empty row map if no input data is present, yet.
m_rowMap = new HashMap<RowKey, DataRow>();
m_classModel = new ClassModel();
m_curIterationIndex = 0;
}
开发者ID:knime,项目名称:knime-activelearning,代码行数:19,代码来源:ActiveLearnLoopEndNodeModel.java
示例2: 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
示例3: initializeClassMap
import org.knime.core.data.DataRow; //导入依赖的package包/类
/**
* Reads the classes from the ground truth table and adds them to the class
* map.
*
* @param inData
* @throws InvalidSettingsException
*/
private void initializeClassMap(final BufferedDataTable[] inData)
throws InvalidSettingsException {
final int classColIdxLabeledTable = NodeUtils.autoColumnSelection(
inData[LABELED_PORT].getDataTableSpec(),
m_groundTruthColumnModel, StringValue.class, this.getClass());
// initialize all classes map
m_allClassesMap = new HashMap<>((int)inData[LABELED_PORT].size());
for (final DataRow row : inData[LABELED_PORT]) {
m_allClassesMap.put(row.getKey(),
((StringCell) row.getCell(classColIdxLabeledTable))
.getStringValue());
}
}
开发者ID:knime,项目名称:knime-activelearning,代码行数:23,代码来源:DBGActiveLearnLoopEndNodeModel.java
示例4: createCellFactory
import org.knime.core.data.DataRow; //导入依赖的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
示例5: createResRearranger
import org.knime.core.data.DataRow; //导入依赖的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
示例6: createResRearranger
import org.knime.core.data.DataRow; //导入依赖的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
示例7: getCells
import org.knime.core.data.DataRow; //导入依赖的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
示例8: 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
示例9: 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
示例10: 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
示例11: execute
import org.knime.core.data.DataRow; //导入依赖的package包/类
/**
* Execute the snippet.
*
* @param table
* the data table at the inport
* @param flowVariableRepository
* the flow variables at the inport
* @param exec
* the execution context to report progress
* @return the table for the output
* @throws InvalidSettingsException
* when settings are inconsistent with the table or the flow
* variables at the input
* @throws CanceledExecutionException
* when execution is canceled by the user
*/
public BufferedDataTable execute(final BufferedDataTable table,
final FlowVariableRepository flowVariableRepository,
final ExecutionContext exec) throws CanceledExecutionException,
InvalidSettingsException {
OutColList outFields = m_fields.getOutColFields();
if (outFields.size() > 0) {
ColumnRearranger rearranger = createRearranger(
table.getDataTableSpec(), flowVariableRepository,
table.getRowCount());
return exec.createColumnRearrangeTable(table, rearranger, exec);
} else {
CellFactory factory = new JavaSnippetCellFactory(this,
table.getDataTableSpec(), flowVariableRepository,
table.getRowCount());
for (DataRow row : table) {
factory.getCells(row);
}
return table;
}
}
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:38,代码来源:JavaSnippet.java
示例12: createRDD
import org.knime.core.data.DataRow; //导入依赖的package包/类
/**
* Creates JavaRDD from BufferedDataTable
*
* @param data
* <code>BufferedDataTable</code> to parallelize
* @param colIndices
* selected columns
* @return <code>JavaRDD</code>
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private JavaRDD createRDD(BufferedDataTable data, int[] colIndices) {
// make a copy of data
ArrayList copyOfData = new ArrayList(data.getRowCount());
CloseableRowIterator rowIt = data.iterator();
while (rowIt.hasNext()) {
DataRow nextRow = rowIt.next();
copyOfData.add(getCellValue(nextRow.getCell(colIndices[0])));
}
// create sparkContext and parallelize collection
JavaSparkContext sparkContext = SparkContexter.getSparkContext(m_master
.getStringValue());
return sparkContext.parallelize(copyOfData);
}
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:25,代码来源:TableToRDDNodeModel.java
示例13: createPairRDD
import org.knime.core.data.DataRow; //导入依赖的package包/类
/**
* Creates JavaPairRDD from BufferedDataTable
*
* @param data
* <code>BufferedDataTable</code> to parallelize
* @param colIndices
* selected columns
* @return <code>JavaPairRDD</code>
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private JavaPairRDD createPairRDD(BufferedDataTable data, int[] colIndices) {
// make a copy of data
ArrayList copyOfData = new ArrayList(data.getRowCount());
CloseableRowIterator rowIt = data.iterator();
while (rowIt.hasNext()) {
DataRow nextRow = rowIt.next();
// Scala Tuple2 as key-value pair
copyOfData.add(new Tuple2(getCellValue(nextRow
.getCell(colIndices[0])), getCellValue(nextRow
.getCell(colIndices[1]))));
}
// create sparkContext and parallelize collection
JavaSparkContext sparkContext = SparkContexter.getSparkContext(m_master
.getStringValue());
return JavaPairRDD.fromJavaRDD(sparkContext.parallelize(copyOfData));
}
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:28,代码来源:TableToRDDNodeModel.java
示例14: endElement
import org.knime.core.data.DataRow; //导入依赖的package包/类
@Override
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
throws SAXException
{
if(builder!=null)
{
DataRow row=new DefaultRow(RowKey.createRowKey(++rowOut),new IntCell(Integer.parseInt(builder.toString())));
container.addRowToTable(row);
exec.setProgress("ESearch "+(rowOut));
try {
exec.checkCanceled();
} catch (CanceledExecutionException e) {
throw new SAXException(e);
}
}
builder=null;
}
开发者ID:lindenb,项目名称:knime4bio,代码行数:18,代码来源:ESearchNodeModel.java
示例15: getMutation
import org.knime.core.data.DataRow; //导入依赖的package包/类
public Mutation getMutation(DataRow row)
{
String ref="A";
String alt="A";
if(useRefAlt)
{
ref= StringCell.class.cast(row.getCell(this.refColumn)).getStringValue();
alt= StringCell.class.cast(row.getCell(this.altColumn)).getStringValue();
}
return new Mutation(
new Position(
StringCell.class.cast(row.getCell(this.chromColumn)).getStringValue(),
IntCell.class.cast(row.getCell(this.positionColumn)).getIntValue()
),
ref, alt
);
}
开发者ID:lindenb,项目名称:knime4bio,代码行数:20,代码来源:VCFNumericSplitNodeModel.java
示例16: 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
示例17: 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
示例18: execute
import org.knime.core.data.DataRow; //导入依赖的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: getIds
import org.knime.core.data.DataRow; //导入依赖的package包/类
public static List<String> getIds(BufferedDataTable table) {
if (table == null) {
return Collections.emptyList();
}
Set<String> ids = new LinkedHashSet<>();
for (DataRow row : table) {
String id = IO.getString(row.getCell(table.getSpec().findColumnIndex(NlsUtils.ID_COLUMN)));
if (id != null) {
ids.add(id);
}
}
return new ArrayList<>(ids);
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:18,代码来源:NlsUtils.java
示例20: 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
注:本文中的org.knime.core.data.DataRow类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论