use of de.lmu.ifi.dbs.elki.datasource.filter.StreamFilter in project elki by elki-project.
the class AbstractDatabaseConnection method invokeStreamFilters.
/**
* Transforms the specified list of objects and their labels into a list of
* objects and their associations.
*
* @param stream the objects to process
* @return processed objects
*/
protected BundleStreamSource invokeStreamFilters(BundleStreamSource stream) {
if (filters == null) {
return stream;
}
// We dynamically switch between streaming and bundle operations.
MultipleObjectsBundle bundle = null;
for (ObjectFilter filter : filters) {
if (filter instanceof StreamFilter) {
stream = ((StreamFilter) filter).init((stream != null) ? stream : bundle.asStream());
bundle = null;
} else {
bundle = filter.filter((bundle != null) ? bundle : stream.asMultipleObjectsBundle());
stream = null;
}
}
return (stream != null) ? stream : bundle.asStream();
}
use of de.lmu.ifi.dbs.elki.datasource.filter.StreamFilter in project elki by elki-project.
the class AbstractDatabaseConnection method invokeBundleFilters.
/**
* Transforms the specified list of objects and their labels into a list of
* objects and their associations.
*
* @param bundle the objects to process
* @return processed objects
*/
protected MultipleObjectsBundle invokeBundleFilters(MultipleObjectsBundle bundle) {
if (filters == null) {
return bundle;
}
// We dynamically switch between streaming and bundle operations.
BundleStreamSource stream = null;
for (ObjectFilter filter : filters) {
if (filter instanceof StreamFilter) {
StreamFilter sfilter = (StreamFilter) filter;
stream = sfilter.init((stream != null) ? stream : bundle.asStream());
// No longer a bundle
bundle = null;
} else {
bundle = filter.filter((bundle != null) ? bundle : stream.asMultipleObjectsBundle());
// No longer a stream
stream = null;
}
}
return (bundle != null) ? bundle : stream.asMultipleObjectsBundle();
}
Aggregations