|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.node.preproc.filter.row.rowfilter.RowFilter
org.knime.base.node.preproc.sample.RandomFractionRowFilter
public class RandomFractionRowFilter
Row Filter class that extracts randomly a given fraction of rows. The
implementation of the matches(DataRow, int)
method only tests if a
random number is less or equal to the fraction argument and if so it will
return true
, i.e. will accept the row currently requested.
The implementation ensures that cloned objects from this object have the same
behaviour (presuming that the matches(DataRow, int)
method is called
in the same sequence)
Constructor Summary | |
---|---|
RandomFractionRowFilter(double fraction)
Creates new Filter that filters out (1-fraction) * 100 percent of the rows. |
Method Summary | |
---|---|
Object |
clone()
|
DataTableSpec |
configure(DataTableSpec inSpec)
Throws exception, not supported. |
void |
loadSettingsFrom(NodeSettingsRO cfg)
Throws exception, not supported. |
boolean |
matches(DataRow row,
int rowIndex)
Return true if the specified row matches the criteria set
in the filter. |
protected void |
saveSettings(NodeSettingsWO cfg)
Throws exception, not supported. |
Methods inherited from class org.knime.base.node.preproc.filter.row.rowfilter.RowFilter |
---|
saveSettingsTo |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomFractionRowFilter(double fraction)
fraction
- the fraction of the rows to suriveMethod Detail |
---|
public boolean matches(DataRow row, int rowIndex) throws EndOfTableException, IncludeFromNowOn
true
if the specified row matches the criteria set
in the filter. Can throw a EndOfTableException
if the filter can
tell that no more rows of the table will be able to fulfill the criteria.
matches
in class RowFilter
row
- the row to testrowIndex
- the row index of the passed row in the original table
true
if the row matches the criteria set in the
filter, false
if not
EndOfTableException
- if there is no chance that any of the rows
coming (including the current rowIndex
) will
fulfill the criteria, thus no further row in the original
table will be a match to this filter. (In general this is
hard to tell, but a row number filter can certainly use it.)
If the exception is received the row filter table iterator
will flag an end of table.
IncludeFromNowOn
- if the current and all following rows from now
on are to be included into the result tablepublic void loadSettingsFrom(NodeSettingsRO cfg) throws InvalidSettingsException
loadSettingsFrom
in class RowFilter
cfg
- the object holding the settings to load
InvalidSettingsException
- if cfg contains
invalid/incorrect/inconsistent settingsRowFilter.loadSettingsFrom(NodeSettingsRO)
protected void saveSettings(NodeSettingsWO cfg)
saveSettings
in class RowFilter
cfg
- object to add the current internal settings toRowFilter.saveSettings(NodeSettingsWO)
public DataTableSpec configure(DataTableSpec inSpec) throws InvalidSettingsException
configure
in class RowFilter
inSpec
- the new spec propagated into the row filter node. Could be
null or empty!
InvalidSettingsException
- if the settings in the row filter are
not compatible with the table spec coming inRowFilter.configure(org.knime.core.data.DataTableSpec)
public Object clone()
clone
in class RowFilter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |