use of org.knime.core.data.RowIterator in project knime-core by knime.
the class SubgroupMinerModel method getKeys.
/**
* {@inheritDoc}
*/
public Set<RowKey> getKeys(final RowKey key) {
LOGGER.debug("getKeys for: " + key);
Set<RowKey> cells = new HashSet<RowKey>();
for (RowIterator itr = m_itemSetTable.iterator(); itr.hasNext(); ) {
DataRow currRow = itr.next();
if (currRow.getKey().equals(key)) {
LOGGER.debug("found key ");
for (int i = 1; i < currRow.getNumCells(); i++) {
cells.add(new RowKey(currRow.getCell(i).toString()));
}
}
}
LOGGER.debug("mapping: " + cells);
return cells;
}
use of org.knime.core.data.RowIterator in project knime-core by knime.
the class ParallelCoordinatesViewContent method computeDoubleValues.
private void computeDoubleValues(final DataTable data, final Vector<Map<String, Integer>> stringieMap, final ExecutionMonitor exec, final int nrRows) throws CanceledExecutionException {
// iterate over the rows that are drawable
int i = 0;
// iterate over the rows
int j = 0;
for (RowIterator it = data.iterator(); (i < nrRows) && it.hasNext(); j++) {
if (exec != null) {
exec.checkCanceled();
// we are doing only half of the job here (but the second half)
exec.setProgress((j / nrRows / 2.0) + 1.0 / 2.0);
}
DataRow row = it.next();
if (m_rowIsDrawable[j]) {
m_doubleArray[i] = new TwoDim[m_nrVisibleColumns];
m_keyVector[i] = row.getKey();
m_colorVector[i] = m_inputSpec.getRowColor(row);
m_sizes[i] = data.getDataTableSpec().getRowSize(row);
for (int col = 0, realCol = 0; col < m_columnCount; col++) {
if (!m_hideColumn[col]) {
m_doubleArray[i][realCol] = new TwoDim();
DataCell cell = row.getCell(col);
if (cell.getType().isCompatible(DoubleValue.class)) {
DoubleValue dcell = (DoubleValue) cell;
double dValue = normalize(dcell.getDoubleValue(), m_minVector[realCol], m_maxVector[realCol]);
m_doubleArray[i][realCol].setMin(dValue);
m_doubleArray[i][realCol].setMax(dValue);
} else if (cell.getType().isCompatible(FuzzyIntervalValue.class)) {
if (cell.isMissing()) {
m_doubleArray[i][realCol].setMin(0);
m_doubleArray[i][realCol].setMax(1);
} else {
FuzzyIntervalValue fcell = (FuzzyIntervalValue) cell;
double mincore = fcell.getMinCore();
double maxcore = fcell.getMaxCore();
m_doubleArray[i][realCol].setMin(normalize(mincore, m_minVector[realCol], m_maxVector[realCol]));
m_doubleArray[i][realCol].setMax(normalize(maxcore, m_minVector[realCol], m_maxVector[realCol]));
}
} else {
// if the column is a string one
// no. corresponding to the string value
int intValue = 0;
double dValue = 0;
intValue = ((stringieMap.get(realCol).get(cell.toString().trim()))).intValue();
dValue = (double) intValue / (stringieMap.get(realCol).size() - 1);
m_doubleArray[i][realCol].setMin(dValue);
m_doubleArray[i][realCol].setMax(dValue);
m_doubleArray[i][realCol].setStringReference(intValue);
}
realCol++;
} else {
// column is hidden
// do nothing
}
}
i++;
}
}
}
Aggregations